« first day  last day (15 days later) » 

4:27 AM
all you want to do is when activity will start you want to show dialog and on single back press dialog must be hide and activity should finish right? This is one case if you press back now suppose you are not pressing back in this case after api data load dialog must be hide

Am i right till here?
 
 
9 hours later…
1:06 PM
@pratikvekariya when progress bar loading ,user click back pressed then it must be a single click to reach previous activity
 
1:24 PM
@Wini ok for that
progressDialog = new ProgressDialog(NextActivity.this );
progressDialog.setMessage("Loading....");
progressDialog.show();
progressDialog.setCanceledOnTouchOutside(false);
progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
// progressDialog.setCancelable(true);

progressDialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialog) {
//here, dismiss your dialog and finish your activity too
progressDialog.dismiss();
finish();
and for test this work or not comment all things from onCreate api call and all that things
 
 
1 hour later…
2:51 PM
@pratikvekariya
edit your answer with this-->
progressDialog.setCanceledOnTouchOutside(false);
progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
progressDialog.setOnKeyListener(new ProgressDialog.OnKeyListener() {
@Override
public boolean onKey(DialogInterface arg0, int keyCode,
KeyEvent event) {
// TODO Auto-generated method stub
if (keyCode == KeyEvent.KEYCODE_BACK) {
finish();
progressDialog.dismiss();
}
return true;
}
});
I will upvote you
thanks for coopersting
cooperating**
:)
 
3:04 PM
just replace your answer with mine
 
 
1 hour later…
4:30 PM
@Wini OK edited my answer
Thank you for upvote
 

« first day  last day (15 days later) »