0% found this document useful (0 votes)
15 views2 pages

Simontok Activity Navigation Code

The document contains code for an Android application with two activities. Activity1 has a button that, when clicked, starts a new intent to launch Activity2. The layout files for each activity define the user interface with text labels and a button.

Uploaded by

Vanita Bains
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views2 pages

Simontok Activity Navigation Code

The document contains code for an Android application with two activities. Activity1 has a button that, when clicked, starts a new intent to launch Activity2. The layout files for each activity define the user interface with text labels and a button.

Uploaded by

Vanita Bains
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Activity1.

java
package [Link];

import [Link];
import [Link];
import [Link];
import [Link];
import [Link];

public class activity1 extends AppCompatActivity {


Button btn;
@Override
protected void onCreate(Bundle savedInstanceState) {
[Link](savedInstanceState);
setContentView([Link].activity_activity1);
btn=(Button)findViewById([Link]);
[Link](new [Link]() {
@Override
public void onClick(View view) {
Intent i= new Intent([Link],[Link]);
startActivity(i);
}
});

}
}
[Link]

<?xml version="1.0" encoding="utf-8"?>


<RelativeLayout xmlns:android="[Link]
xmlns:app="[Link]
xmlns:tools="[Link]
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".activity1"
android:background="@drawable/background">

<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginStart="114dp"
android:layout_marginLeft="114dp"
android:layout_marginTop="216dp"
android:text="ACTIVITY1"
android:textSize="30sp" />

<Button
android:id="@+id/btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginStart="147dp"
android:layout_marginLeft="147dp"
android:layout_marginTop="297dp"
android:text="Click Me" />
</RelativeLayout>
[Link]

<?xml version="1.0" encoding="utf-8"?>


<RelativeLayout xmlns:android="[Link]
xmlns:app="[Link]
xmlns:tools="[Link]
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".activity1"
android:background="@drawable/bg1">

<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginStart="108dp"
android:layout_marginLeft="108dp"
android:layout_marginTop="250dp"
android:text="ACTIVITY2"
android:textSize="30sp" />

</RelativeLayout>

You might also like