0% found this document useful (0 votes)
120 views6 pages

Mobile Programming: Dewi Cahyanti

The document describes a mobile programming assignment that includes two Android activity layout files (activity_main.xml and activity_main2.xml) and two Java activity classes (MainActivity.java and MainActivity2.java). The first activity allows the user to enter their name and student ID, which are passed to the second activity when the submit button is clicked. The second activity displays the passed name and ID in edit texts when it launches.

Uploaded by

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

Mobile Programming: Dewi Cahyanti

The document describes a mobile programming assignment that includes two Android activity layout files (activity_main.xml and activity_main2.xml) and two Java activity classes (MainActivity.java and MainActivity2.java). The first activity allows the user to enter their name and student ID, which are passed to the second activity when the submit button is clicked. The second activity displays the passed name and ID in edit texts when it launches.

Uploaded by

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

Nama : Dewi Cahyanti

Kelas : C1

Stambuk : 13020170188

Tugas :V

MOBILE PROGRAMING

1. activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<[Link]
xmlns:android="[Link]
xmlns:app="[Link]
xmlns:tools="[Link]
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">

<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="28dp"
android:layout_marginLeft="28dp"
android:layout_marginTop="40dp"
android:text="Stambuk :"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="28dp"
android:layout_marginLeft="28dp"
android:layout_marginTop="88dp"
android:text="Nama :"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView" />

<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Aktivity 1"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/button" />

<EditText
android:id="@+id/editText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="56dp"
android:layout_marginRight="56dp"
android:ems="10"
android:inputType="textPersonName"

app:layout_constraintBaseline_toBaselineOf="@+id/textView"
app:layout_constraintEnd_toEndOf="parent" />

<EditText
android:id="@+id/editText2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="56dp"
android:layout_marginRight="56dp"
android:ems="10"
android:inputType="textPersonName"

app:layout_constraintBaseline_toBaselineOf="@+id/textView2"
app:layout_constraintEnd_toEndOf="parent" />

<Button
android:id="@+id/button"
android:layout_width="260dp"
android:layout_height="56dp"
android:layout_marginTop="84dp"
android:text="SUBMIT"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/editText2" />

</[Link]>

2. activity_main2.xml
<?xml version="1.0" encoding="utf-8"?>
<[Link]
xmlns:android="[Link]
xmlns:app="[Link]
xmlns:tools="[Link]
android:layout_width="match_parent"
android:layout_height="match_parent">

<TextView
android:id="@+id/textView11"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginLeft="16dp"
android:layout_marginTop="56dp"
android:text="Stambuk :"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<EditText
android:id="@+id/editText7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="52dp"
android:layout_marginRight="52dp"
android:ems="10"
android:inputType="textPersonName"

app:layout_constraintBaseline_toBaselineOf="@+id/textView11
"
app:layout_constraintEnd_toEndOf="parent" />

<EditText
android:id="@+id/editText8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="52dp"
android:layout_marginRight="52dp"
android:ems="10"
android:inputType="textPersonName"

app:layout_constraintBaseline_toBaselineOf="@+id/textView12
"
app:layout_constraintEnd_toEndOf="parent" />

<TextView
android:id="@+id/textView12"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginLeft="16dp"
android:layout_marginTop="40dp"
android:text="Nama :"
app:layout_constraintStart_toStartOf="parent"

app:layout_constraintTop_toBottomOf="@+id/textView11" />
<Button
android:id="@+id/button4"
android:layout_width="260dp"
android:layout_height="56dp"
android:layout_marginTop="116dp"
android:text="SUBMIT"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"

app:layout_constraintTop_toBottomOf="@+id/editText8" />

<TextView
android:id="@+id/textView13"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Aktivity2"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/button4"
/>
</[Link]>
3. [Link]

package [Link];

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

public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
[Link](savedInstanceState);
setContentView([Link].activity_main);
final EditText nama = (EditText)
findViewById([Link]);
final EditText stb =
(EditText)findViewById([Link].editText2);
Button btn = (Button) findViewById([Link]);

[Link](new [Link]() {
@Override
public void onClick(View v) {
Intent i = new
Intent([Link],[Link]);
[Link]("nama", [Link]().toString());
[Link]("stb",[Link]().toString());
startActivity(i);
}
});
}
}

4. [Link]

package [Link];

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

public class MainActivity2 extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
[Link](savedInstanceState);
setContentView([Link].activity_main2);

Button btn= (Button) findViewById([Link].button4);


[Link](new [Link]() {
@Override
public void onClick(View v) {
EditText nama = (EditText)
findViewById([Link].editText7);
EditText stb = (EditText)
findViewById([Link].editText8);
Bundle bundle=getIntent().getExtras();
String a=[Link]("nama");
String b=[Link]("stb");
[Link](a);
[Link](b);

}
});
}
}

5. Output:
a) Activity pertama
b) Activity kedua

You might also like