[Andrews] and consequently will not jump between the timing of realization of Andrews Activity

Implementation of a jump to a second timing of Activity Activity.

 // 跳转result
        final Intent it = new Intent(this,ResultActivity.class);
        Timer timer = new Timer();
        TimerTask task = new TimerTask() {
            @Override
            public void run() {
                startActivity(it);
                PreviewActivity.this.finish();
            }
        };
        timer.schedule(task,1000*4);
public class ResultActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_result);

        Toast.makeText(this,"success",Toast.LENGTH_LONG).show();
    }
}

final effect:

Here Insert Picture Description

Guess you like

Origin blog.csdn.net/chen18677338530/article/details/93979587