0

I want to create a application where I can redirect from one activity to another activity automatically. When I come back to first activity it shall redirect 1st activity to 2nd again.

Example:

act1--->act2(automatically)--->ac3--->ect....

Now using back button, however I reached act1 then it will again automatically redirect to act2.

I used the handler's postdelay method to redirect automatically but next time when I reached back first activity it become useless.

Ricardo Peres
  • 13,724
  • 5
  • 57
  • 74

2 Answers2

1
Intent i = new Intent(MainActivity.this, CheckActivity.class);
 startActivityForResult(i, REQUEST_CODE_CHECK);

and get reslut In activity

  @Override 
 public void onActivityResult(int requestCode, int resultCode, Intent data)
 { 
 if (requestCode == request_Code) {
    if (resultCode == REQUEST_CODE_CHECK) 
        Toast.makeText(this,data.getData().toString(),Toast.LENGTH_SHORT).show();               
    } 
 }
wadali
  • 2,221
  • 1
  • 20
  • 38
0

In your automatic redirecting Activity add the onResume method in the following way

@Override
public void onResume(){
    startActivity(this, second activity intent);
}
BeingMIAkashs
  • 1,375
  • 11
  • 18