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 while user enter a number like if user enter 1 am passing it to that dialog class and done some functions to made a list like 10,100,1000,10000.
now once the user select any numbers from this list i want to set it into Editext.How can i do this? am trying this for a whole day?
public static void amount_dialog(final Activity activity,String str)
{
amount=str;
sequence_number();//from this method am generating list and setting it into my Arraylist
dialog=new Dialog(activity,R.style.CustomDialogTheme);
dialog.setContentView(R.layout.customdialog);
ListView listView=(ListView) dialog.findViewById(R.id.listView12);
adapter=new ArrayAdapter<String>(activity,R.layout.list2,R.id.list_text1, strings);
listView.setAdapter(adapter);
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
long arg3) {
selected_amount=adapter.getItem(arg2);
dialog.dismiss();
}
});
dialog.getWindow().getAttributes().windowAnimations = R.style.DialogAnimation;
dialog.show();
dialog.setCanceledOnTouchOutside(true);
}
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.