i have a list in my Android APP and i need to show a progress dialog when the user click on an item.
I use this code for starting the activity. I tried to put a progressdialog and always fail…
Pasted the code and please tell me your opinion.
public OnClickListener myClickListener = new OnClickListener() {
public void onClick(View v) {
String param1 = ((TextView) v.findViewById(R.id.txtdat1))
.getText().toString();
String param2 = ((TextView) v.findViewById(R.id.txtdat2))
.getText().toString();
String param3 = ((TextView) v.findViewById(R.id.txtdat3))
.getText().toString();
String param4 = ((TextView) v.findViewById(R.id.txtdat14))
.getText().toString();
Intent intent = new Intent(v.getContext(), AgendaDetail.class);
intent.putExtra("param1", param1);
intent.putExtra("param2", param2);
intent.putExtra("param3", param3);
intent.putExtra("param4", param4);
startActivity(intent);
}
};
Y try tu put something similar to that
final ProgressDialog dialog = ProgressDialog.show(this, "Loading...",
"Wait");
new Thread(new Runnable() {
public void run() {
startActivity(new Intent("com.places"));
dialog.dismiss();
}
}).start();
You need to write this on the onclick
This will help…