+ 1
What is the java code and manifest code
What is the java code to start a new activity? like, using a button. Im stack in this code. the intent.I have sub.xml for the new activity layout ang SubActivity.java. the button id is button1. also in the manifest.xml i added new activity with label on it, theme ang name=".SubActivity" startActivity()
3 Respuestas
+ 1
MainActivity.java
Yourbtn.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View v)
{
Intent intent = new Intent(getApplicationContext(), SubActivity.class);
startActivity(intent);
}
});
AndroidManifest.xml
<activity
android:name=".MainActivity"
android:label="Hello World>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:label="Sub Activity" android:name=".SubActivity"/>
0
Thanks you for your answer. I will try that later.
0
I thought the new <activity in manifest will be below the first <activity.