简体   繁体   中英

Use flag in two Activity connect (Android)

I'm building an android application, with two activities: MainActivity and PlayMovieActivity . In the MainActivity , I have one button to start play movie Activity , like :

Intent intent = new Intent();
intent setClassName("xxx.xxx","xxx.startmovie");
startActivity(intent);

Unfortunately , that connect not always smooth , sometime , it will not connect. I try to use a flag to judgment connect or not connect. Is there any way to do it ?

in fact , intent to another Activity is OK , but sometimes it's not ok . I don't know . if playmovie Activity not working , the button is visible can let you press again, but if it's working , the button is invisible.

An Intent is an object that provides runtime binding between separate components, such as two activities. The Intent represents an app's "intent to do something."

Remove setClassName

Intent intent = new Intent(this,PlayMovieActivity.class);
startActivity(intent);

Try this,

Intent intent = new Intent(this, PlayMovieActivity.class);
startActivity(intent);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM