0

I've three activity.

  • SplashActivity
  • RegisterNewRecordActivity
  • StatisticsActivity

I can reach Register and Statistics from Splash. Given I go to to Register, and I send data to the server, I finish() RegisterNewRecordActivity and I go to Splash.

It is possible to automatically open StatisticsActivity, after the finishing of RegisterNewRecordActivity? At the moment this is my code: after sending data to the server I show a dialog and I finish this activity.

        private void showSavedMealDialog() {
            AlertDialog.Builder alert = new AlertDialog.Builder(getContext());
            alert.setTitle("Data sent");
            alert.setIcon(R.drawable.ic_launcher);
            alert.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    finish();
                }
            });
            alert.show();
        }

But this bring me to SplashActivity, and I dont like this behavior.

4
  • 1
    Call the statisticsactivity using intent inside onClick().
    – Tejas
    Commented Nov 21, 2013 at 5:29
  • 1
    You can start a new activity from same onClick method of you dialog via intent. This way you can go to Statistics Activty
    – DroidDev
    Commented Nov 21, 2013 at 5:30
  • I know, but I dont linke this beahvior: if I open intend from there, when I press back button on my phone, I come back to Register. I dont want this.
    – sensorario
    Commented Nov 21, 2013 at 5:32
  • Uh! Sorry. I've tried to implement code as you sugested and it works. sorry
    – sensorario
    Commented Nov 21, 2013 at 5:37

1 Answer 1

1

After finish() just fire a new intent to statistics activity..

Not the answer you're looking for? Browse other questions tagged or ask your own question.