0

I have the main activity with TimerTask and process and create a menu with setup activity.I want when use back button from setup activity go to main activity from start.I want refresh main activity when back.Now when back my main activity stop,break and exit from apk when restart TimerTask.Some code from my apk for understand...

This is inside main activity menu

public boolean onOptionsItemSelected(MenuItem item)
{ 
  switch (item.getItemId())
  {
  case R.id.menu_exit:
      finish();
      return true;
  case R.id.menu_setup:
      startActivity(new Intent(this, Setup.class));
      return true;
    default:
      return super.onOptionsItemSelected(item);
   }

after i have a TimerTask with start and stop from button...

My setup.class is SharedPreference for save delay time for timer...

I want code for back button in this class and go from start(refresh) main activity...with new delay time for TimerTask from preferences.

user1909897
  • 61
  • 4
  • 10

1 Answers1

0

Override onBackPressed() method in your setup activity and start intent for main activity. Send data to intent using bundle

Romans
  • 55
  • 2
  • 14
  • I try this Intent intent = new Intent(getBaseContext(), main.class); intent.setFlags( Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); work with extra back button – user1909897 Dec 25 '12 at 15:27