I used the following function to come back to Home page(Home Activity) from any child.
My task is if we are in any child page it should come to home page and want to display an alert box.
Its working fine for all child pages without the alert dialog.
Its working for following case with alert dialog
For ex: HomePage -> child A
Its coming to home page and showing the alert dialog
Its not working for if i'm in more than one child pages
For ex: HomePage -> child A -> Child B
Its coming to HomePage and became unfocussed, but the alert dialog is not showing.
According to my task, the alert should be cancellabe=false, so cant able to go back with out clicking button in alert dialog
public void ShowConnectivityMessage()
{
Intent intent = new Intent( this, Homepage.class );
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
this.startActivity( intent );
new AlertDialog.Builder(this)
.setTitle("Cannot Connect To Service")
.setMessage("The service has been unreachable for 1 hour. ")
.setCancelable(false)
.setPositiveButton("Help me shut down the app", new DialogInterface.OnClickListener()
{
@Override
public void onClick(DialogInterface dialog, int which)
{
if(Homepage.bIsLoggedInM)
{
StartTimer();
ShowHowToQuitTheApp();
}
}
}).show();
}
So please any one help me.................