0% found this document useful (0 votes)
55 views4 pages

Biodata Form Implementation Guide

The document contains code for an Android app that collects user biographical data through text fields and displays it in an introduction sentence. The layout file defines the user interface elements like text fields for name, birthplace, hobby. The Java code handles populating dropdowns, getting the birthdate from a date picker, and displaying the introduction sentence by concatenating the user's inputs.

Uploaded by

Yoga Aji Pratama
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)
55 views4 pages

Biodata Form Implementation Guide

The document contains code for an Android app that collects user biographical data through text fields and displays it in an introduction sentence. The layout file defines the user interface elements like text fields for name, birthplace, hobby. The Java code handles populating dropdowns, getting the birthdate from a date picker, and displaying the introduction sentence by concatenating the user's inputs.

Uploaded by

Yoga Aji Pratama
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

Mainactivity.

xml

<?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=".MainActivity"
android:padding="20dp">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">

<EditText
android:id="@+id/edit_namapanjang"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Nama Panjang"/>

<EditText
android:id="@+id/edit_namapanggilan"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Nama Panggilan"/>

<Spinner
android:id="@+id/spn_jkelamin"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginVertical="10dp"></Spinner>

<EditText
android:id="@+id/edit_tempatlahir"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Tempat Lahir"/>

<Button
android:id="@+id/btn_tgllahir"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Tanggal Lahir"/>

<EditText
android:id="@+id/edit_alamat"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Alamat"/>
<EditText
android:id="@+id/edit_hobi"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Hobi"/>

<EditText
android:id="@+id/edit_pekerjaan"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Pekerjaan"/>

<Button
android:id="@+id/btn_proses"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:text="Proses"/>

<TextView
android:id="@+id/[Link]"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Pengenalan Diri by:Yoga aji pratama"/>

</LinearLayout>

</RelativeLayout>

[Link]

package [Link];

import [Link];

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

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

public class MainActivity extends AppCompatActivity {

EditText namapanjang, namapanggilan, tempatlahir, alamat, hobi, pekerjaan;


Spinner jkelamin;
Button tgllahiir, proses;
TextView pengenalandiri;
private int mTahun, mbulan, mhari;

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

namapanjang = (EditText) findViewById([Link].edit_namapanjang);


namapanggilan = (EditText) findViewById([Link].edit_namapanggilan);
tempatlahir = (EditText) findViewById([Link].edit_tempatlahir);
alamat = (EditText) findViewById([Link].edit_alamat);
hobi = (EditText) findViewById([Link].edit_hobi);
pekerjaan = (EditText) findViewById([Link].edit_pekerjaan);

jkelamin = (Spinner) findViewById([Link].spn_jkelamin);

tgllahiir = (Button) findViewById([Link].btn_tgllahir);


proses = (Button) findViewById([Link].btn_proses);

pengenalandiri = (TextView) findViewById([Link].txt_kalimatpengenalan);

List<String> listkelamin = new ArrayList<String>();


[Link]("Laki Laki");
[Link]("Perempuan");

ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,


[Link].simple_spinner_item, listkelamin);

[Link]([Link].simple_spinner_dropdown_item);
[Link](adapter);

[Link](new [Link]() {
@Override
public void onClick(View v) {
Calendar cal = [Link]();
mTahun = [Link]([Link]);
mbulan = [Link]([Link]);
mTahun = [Link](Calendar.DAY_OF_MONTH);

DatePickerDialog mDateDialog = new


DatePickerDialog([Link], new [Link]() {
@Override
public void onDateSet(DatePicker view, int year, int month, int
dayOfMonth) {
[Link]([Link](year) + "-" +
[Link](month+1) + "-" + [Link](dayOfMonth));

}
}, mTahun, mbulan, mhari);
[Link]("Pilih Tanggal Lahir");
[Link]();
}
});

[Link](new [Link]() {
@Override
public void onClick(View v) {

[Link]("Hai nama gue


"+[Link]().toString()+", panggil aja "+
[Link]().toString()+", lahir di
"+[Link]().toString()+", "+
[Link]().toString()+", Gue tinggal di
"+[Link]().toString()+", Hobi gue "+
[Link]().toString()+", Dan gue adalah seorang
"+[Link]().toString()+" Nice to meet you :) ");
}
});

}
}

You might also like