Settext To Edittextbox From Dialog Content?
Am using customDialog which i was customized to show list.my Requirement is Where ever having Edittext in my application.i need to show this dialog.am using Textwatcher in editext
Solution 1:
Simply you can pass your EditText object to this method and inside the OnitemClickListener you can set text to the EditText using the values from your Arraylist.
publicstaticvoidamount_dialog(final Activity activity,String str,EditText edittextObject)
{
amount=str;
sequence_number();//from this method am generating list and setting it into my Arraylist
dialog=newDialog(activity,R.style.CustomDialogTheme);
dialog.setContentView(R.layout.customdialog);
ListView listView=(ListView) dialog.findViewById(R.id.listView12);
adapter=newArrayAdapter<String>(activity,R.layout.list2,R.id.list_text1, strings);
listView.setAdapter(adapter);
listView.setOnItemClickListener(newAdapterView.OnItemClickListener() {
@OverridepublicvoidonItemClick(AdapterView<?> arg0, View arg1, int arg2,
long arg3) {
selected_amount=adapter.getItem(arg2);
edittextObject.setText("get the value from arraylist here");
dialog.dismiss();
}
});
dialog.getWindow().getAttributes().windowAnimations = R.style.DialogAnimation;
dialog.show();
dialog.setCanceledOnTouchOutside(true);
}
Post a Comment for "Settext To Edittextbox From Dialog Content?"