Java Code Examples for android.widget.Button#getText()
The following examples show how to use
android.widget.Button#getText() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DemoLikePathActivity.java From ArcLayout with Apache License 2.0 | 5 votes |
private void showToast(Button btn) { if (toast != null) { toast.cancel(); } String text = "Clicked: " + btn.getText(); toast = Toast.makeText(this, text, Toast.LENGTH_SHORT); toast.show(); }
Example 2
Source File: DemoActivity.java From ArcLayout with Apache License 2.0 | 5 votes |
private void showToast(Button btn) { if (toast != null) { toast.cancel(); } String text = "Clicked: " + btn.getText(); toast = Toast.makeText(this, text, Toast.LENGTH_SHORT); toast.show(); }
Example 3
Source File: DemoFreeAngleActivity.java From ArcLayout with Apache License 2.0 | 5 votes |
private void showToast(Button btn) { if (toast != null) { toast.cancel(); } String text = "Clicked: " + btn.getText(); toast = Toast.makeText(this, text, Toast.LENGTH_SHORT); toast.show(); }
Example 4
Source File: DemoLikeTumblrActivity.java From ArcLayout with Apache License 2.0 | 5 votes |
private void showToast(Button btn) { if (toast != null) { toast.cancel(); } String text = "Clicked: " + btn.getText(); toast = Toast.makeText(this, text, Toast.LENGTH_SHORT); toast.show(); }
Example 5
Source File: EndToEndTestUtils.java From mytracks with Apache License 2.0 | 4 votes |
/** * Checks if a button is existed in the screen. * * @param buttonName the name string of the button * @param isWait whether wait the text * @param isClick whether click the button if find it * @return the button to search, and null means can not find the button */ public static View getButtonOnScreen(String buttonName, boolean isWait, boolean isClick) { View button = null; instrumentation.waitForIdleSync(); if (isWait) { SOLO.waitForText(buttonName); } // Find on action bar. if (hasActionBar) { ArrayList<View> allViews = SOLO.getViews(); for (View view : allViews) { String className = view.getClass().getName(); if (className.indexOf("ActionMenuItemView") > 0) { String menuItemNameString = view.getContentDescription().toString(); if (menuItemNameString.equalsIgnoreCase(buttonName)) { button = view; break; } } } } // Get all buttons and find. if (button == null) { ArrayList<Button> currentButtons = SOLO.getCurrentViews(Button.class); for (Button oneButton : currentButtons) { String title = (String) oneButton.getText(); if (title.equalsIgnoreCase(buttonName)) { button = oneButton; } } } if (button != null && isClick) { SOLO.clickOnView(button); } if (button == null && isClick) { Log.d(TAG, "Don't find the button " + buttonName); } return button; }
Example 6
Source File: MainActivity.java From journaldev with MIT License | 3 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Button btnSimpleNotification = findViewById(R.id.btnSimpleNotification); Button btnNotificationIcon = findViewById(R.id.btnNotificationIcon); Button btnNotificationImage = findViewById(R.id.btnNotificationImage); Button btnNotificationWithGroupConvo = findViewById(R.id.btnNotificationWithGroupConvo); Button btnNotificationSemantic = findViewById(R.id.btnNotificationSemantic); charSequence = btnNotificationIcon.getText(); btnSimpleNotification.setOnClickListener(this); btnNotificationIcon.setOnClickListener(this); btnNotificationImage.setOnClickListener(this); btnNotificationWithGroupConvo.setOnClickListener(this); btnNotificationSemantic.setOnClickListener(this); notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); CharSequence name = "My Notification"; String description = "yadda yadda"; int importance = NotificationManager.IMPORTANCE_DEFAULT; channel = new NotificationChannel("1", name, importance); channel.setDescription(description); builder = new NotificationCompat.Builder(MainActivity.this, channel.getId()) .setSmallIcon(R.mipmap.ic_launcher); notificationManager.createNotificationChannel(channel); }