+ 2

When switching to activity, Android Studio shows the wrong activity.

When switching to activity, Android Studio shows the wrong activity. I tried to do everything as the internet said. The activity itself was initialized and the GameActivity.java file also worked. The problem is that during the transition, Android shows the interface of the current activity. IntroActivity.java public class IntroActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_intro); } public void toPlay(View Screen) { Intent intent = new Intent(this, GameActivity.class); startActivity(intent); } } AndroidManifest.xml <activity android:label="@string/@string/gameAct.label" android:name=".GameActivity"> <intent-filter> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter> </activity>

22nd May 2021, 7:45 AM
Operand
Operand - avatar
1 ответ
+ 2
Code is perfect.... Check your GameActivity.java if the setContentView is valid and pointing to the activity page u want to launch....
14th Jun 2021, 4:52 PM
MikkyTech
MikkyTech - avatar