buttonclick

Android - Add item to custom listview on button click

爷,独闯天下 提交于 2019-12-04 03:56:09
问题 I currently have a custom listview where each item on the list contains two rows of text. What I would like to do is each time a user clicks on the button, it creates a new item on the list with the text that the user inputted. While I know how to get the text, I am having trouble adding a new item to the list view as I simply don't know where to begin. Here is my code: public class MainFeedActivity extends ListActivity implements OnClickListener { View sendButton; EditText postTextField;

Using ADB to access a particular UI control on the screen

狂风中的少年 提交于 2019-12-04 01:42:46
Is it possible for adb shell console to access an Android app's specific button using its id? or text? I'm trying to automate the button click on the device. This is a web app accessed from a browser. So if I have that button id can I send an action to that button? pt2121 I think the best you can do is to inject touch based on a coordinate. Please see send touch event from ADB to a device and simulating touch using ADB You might get a coordinate of a button from dumpsys window or activity. You could also check out Monkeyrunner . apricot UI automator gives resource IDs, text, and the bounds of

Android Display Numeric Keypad on Button Click

感情迁移 提交于 2019-12-03 16:39:10
In my application, I am trying to display the numeric keypad when the user clicks on a button. When the button is clicked, I shift the focus to the EditText in my layout using requestFocus() and next I need to display the numeric keypad so that the user can type in the values.. The values will always be numeric and hence I need to show only the numeric keypad. I tired using this inside my button's onClick() method but it does not work. InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE); imm.showSoftInput(editText, InputMethodManager.SHOW_IMPLICIT);

How to open number dialer pad programmatically in android?

99封情书 提交于 2019-12-03 10:14:49
I want to display Number Dial Keypad (Phone Call) Programmatically on button click in android. Code is available for direct number dialing but I only need to show the dial keypad when I click the Button. Intent intent = new Intent(Intent.ACTION_DIAL); startActivity(intent); Kishore Kumar Intent intent = new Intent(Intent.ACTION_DIAL); intent.setData(Uri.parse("tel:9999999999")); startActivity(intent); For this we don't need to add any permission in AndroidManifest.xml Deepak Samuel Rajan Intent intent = new Intent(Intent.ACTION_CALL_BUTTON); startActivity(intent); it will show Dial Window

Immediate play sound on button click in html page

为君一笑 提交于 2019-12-03 09:41:20
问题 In my .html page I have 9 images for dialing numbers and one text box that shows the pressed numbers. I want each of those images to immediately play beep sound when users click on them. I tried to use embed with hidden property and navigate it's source to .wav sound. It is working OK, but when I press the images one after another immediately, it cannot play sound and just bees once at the end. Is there any faster way of playing a .wav sound on 'onclick' method? Thanks in advance. 回答1: If you

RecyclerView onClick for multiple buttons and handling from Activity

余生颓废 提交于 2019-12-03 07:36:24
问题 I'm using RecyclerView with CardView and inside the CardView have 2 buttons. Now, have implemented the onClick events by implementing View.OnClickListener by the ViewHolder static class and overriding the event (its working )like @Override public void onClick(View v) { if (v.getId() == mClassBtn.getId()){ } else if (v.getId() == mDaysBtn.getId()){ } } Looking for a solution/pattern to handle the Click in the Activity class like adapter = new ItemsListAdapter(getActivity(), data, new

Immediate play sound on button click in html page

懵懂的女人 提交于 2019-12-03 00:13:56
In my .html page I have 9 images for dialing numbers and one text box that shows the pressed numbers. I want each of those images to immediately play beep sound when users click on them. I tried to use embed with hidden property and navigate it's source to .wav sound. It is working OK, but when I press the images one after another immediately, it cannot play sound and just bees once at the end. Is there any faster way of playing a .wav sound on 'onclick' method? Thanks in advance. If you only need to support recent browsers, then HTML 5 offers you the Audio object to load/buffer your sound:

RecyclerView onClick for multiple buttons and handling from Activity

≯℡__Kan透↙ 提交于 2019-12-02 21:08:05
I'm using RecyclerView with CardView and inside the CardView have 2 buttons. Now, have implemented the onClick events by implementing View.OnClickListener by the ViewHolder static class and overriding the event (its working )like @Override public void onClick(View v) { if (v.getId() == mClassBtn.getId()){ } else if (v.getId() == mDaysBtn.getId()){ } } Looking for a solution/pattern to handle the Click in the Activity class like adapter = new ItemsListAdapter(getActivity(), data, new CustomItemClickListener() { @override public void onItemClick(View v, int position) { Log.d(TAG, "clicked

How to open a window with a click of a button from another window using PyQt?

蹲街弑〆低调 提交于 2019-12-02 13:40:13
I'm trying to make an application but I keep getting punched by the "simple" things like this one, how do I open a new window though a button click? I tried using new_lib_btn.clicked.connect(newlib) , newlib is the file that contains my second window and new_lib_btn is the button that should open the window, it's in my main window as you can see down here: mainwindow.py from PyQt4 import QtCore, QtGui import newlib import sys # Main Window class Window (QtGui.QMainWindow): def __init__(self): super(Window, self).__init__() centralwidget = QtGui.QWidget(self) self.mainLayout = QtGui.QVBoxLayout

Form validation on Button click in android

拟墨画扇 提交于 2019-12-02 07:48:59
I'm Developing an android app in which the Login activity has editText,RadioButton,Spinner and a button.So when the button is pressed I've to validate my form by checking whether all the fields filled else a alert message is given to the user.Can anyone please help me with the java code. Thanks in Advance. public void OnClickListener(View v) { name=(EditText)findViewById(R.id.editText1); years1=(RadioButton)findViewById(R.id.radioButton3); years2=(RadioButton)findViewById(R.id.radioButton4); years3=(RadioButton)findViewById(R.id.radioButton5); manager=(RadioButton)findViewById(R.id