Membuat Aplikasi Biodata Dengan Android
Langkah langkah Membuat Aplikasi pada android.
1.Buka Aplikasi Eclipse,Klik File>New >Project
2.Maka
akan Muncul Kotak Dialog > Pilih Android application Project>Klik Next
3.Lihat
Gambar 1 Di bawah Ini
Gambar
1
4.Maka akan Muncul Kotak Dialog Berikutnya.
5.Isi nama project yang akan anda buat.di sini
sebagai contoh saya isi biodata.
6.Jika sudah selesai mengisi Klik Next.Lihat pada
gambar 2
Gambar
2
7.Setting Configurasi Icon pilih icon yang anda
sukai seperti pada Gambar 3
Gambar
3
8.Klik next.
9.Muncul kotak dialog berikutnya Pilih BlankActivity
Gambar
4
10.Klik Next.
11.Isikan Title sesuai anda.Contoh saya isi dengan
Biodataku.Lihat pada gambar 5
Gambar
5
12.Klik finish.
Membuat Activity
Langkah Langkah Membuat activity
1.Klik kanan pada project,klik new,klik class
2.Isi nama sesuai yang akan anda bikin ,Klik finish
Di sini saya akan membuat 5 Activity.
1.main
2.Splash
3.biodata.
4.rencana masa depan
5.penutup
Splash.Java
package tugas.zevi;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import
android.view.animation.LayoutAnimationController;
import android.view.animation.Animation.AnimationListener;
import android.widget.ImageView;
import android.widget.TableLayout;
import android.widget.TableRow;
public class Splash extends Activity {
@Override
public
void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash);
startAnimating();
}
private
void startAnimating() {
//
TODO Auto-generated method stub
ImageView
zevi= (ImageView) findViewById(R.id.zevi);
Animation
fade1 = AnimationUtils.loadAnimation(this, R.anim.fade_in);
zevi.startAnimation(fade1);
ImageView
zevi2 = (ImageView) findViewById(R.id.zevi2);
Animation
fade2 = AnimationUtils.loadAnimation(this, R.anim.fade_in2);
zevi2.startAnimation(fade2);
ImageView
logo = (ImageView) findViewById(R.id.logo);
Animation
fade3 = AnimationUtils.loadAnimation(this, R.anim.fade_in);
logo.startAnimation(fade3);
Animation
spinin = AnimationUtils.loadAnimation(this, R.anim.custom_anim);
LayoutAnimationController
controller = new LayoutAnimationController(spinin);
TableLayout
table = (TableLayout) findViewById(R.id.table);
TableRow
row = (TableRow) table.getChildAt(0);
row.setLayoutAnimation(controller);
fade2.setAnimationListener(new AnimationListener() {
public
void onAnimationStart(Animation animation) {
//
TODO Auto-generated method stub
}
public
void onAnimationRepeat(Animation animation) {
//
TODO Auto-generated method stub
}
public
void onAnimationEnd(Animation animation) {
//
TODO Auto-generated method stub
startActivity(new
Intent(Splash.this,MainActivity.class));
Splash.this.finish();
}
});
}
}
Splash.xml
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/coba"
android:id="@+id/table">
<TableRow android:layout_gravity="center">
<ImageView
android:id="@+id/zevi"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top"
android:src="@drawable/welcome"/>
</TableRow>
<TableRow android:layout_gravity="center">
<ImageView
android:id="@+id/zevi2"
android:layout_width="120dp"
android:layout_height="150dp"
android:layout_marginTop="40dp"
android:src="@drawable/tawon" />
</TableRow >
<TableRow android:layout_gravity="center">
<ImageView
android:id="@+id/logo"
android:layout_width="320dp"
android:layout_height="wrap_content"
android:layout_marginTop="90dp"
android:gravity="center"
android:src="@drawable/copyright"
/>
</TableRow>
</TableLayout>
Tampilan
Splash .
Main
activity.java
package tugas.zevi;
import android.accounts.Account;
import android.accounts.OnAccountsUpdateListener;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
@SuppressWarnings("unused")
public class MainActivity extends Activity {
protected ProgressDialog progresDialog;
@Override
public
void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
progresDialog =ProgressDialog.show(MainActivity.this,"Now
Loading...","Harap Tunggu");
new
Thread (){
public void run (){
try {
sleep(5000);
}
catch (Exception e){
Log.e("tag",e.getMessage());
}
progresDialog.dismiss();
}
}.start();
setContentView(R.layout.activity_main);
Button
exit =(Button)this.findViewById(R.id.exit);
exit.setOnClickListener (new OnClickListener() {
public
void onClick (View v) {
//
TODO Auto-generated method stub
finish();
System.exit(1);}
});
}
public
void biodata (View view) {
Intent intent1=new Intent
(this,Biodata.class);
startActivity (intent1);
}
public
void visi_misi (View view) {
Intent intent2=new Intent (this,Visi_misi.class);
startActivity (intent2);
}
public
void diary (View view) {
Intent intent3=new Intent
(this,Diary.class);
startActivity (intent3);
}
@Override
public
boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.activity_main,
menu);
return
true;
}
Main
activity.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/background"
android:orientation="vertical" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:src="@drawable/utama1"
android:layout_marginTop="10dp"/>
<Button
android:id="@+id/biodata"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginTop="30dp"
android:onClick="biodata"
android:text="Biodata"
android:textColor="#000000"
android:textSize="10pt"
android:layout_gravity="center"
android:typeface="serif"
android:textStyle="italic|bold"
/>
<Button
android:id="@+id/visi_misi"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:onClick="visi_misi"
android:text="RMD"
android:textColor="#000000"
android:typeface="serif"
android:textStyle="italic|bold"
android:textSize="10pt"
android:layout_gravity="center"
android:layout_margin="10dp"
/>
<Button
android:id="@+id/diary"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@+id/visi_misi"
android:layout_marginTop="10dp"
android:onClick="diary"
android:text="Penutup"
android:textColor="#000000"
android:typeface="serif"
android:textStyle="italic|bold"
android:textSize="10pt"
android:layout_gravity="center"
/>
<Button
android:id="@+id/exit"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:text="Keluar"
android:textSize="10pt"
android:textColor="#000000"
android:typeface="serif"
android:textStyle="italic|bold"
android:layout_gravity="center"
android:layout_margin="10dp"
/>
</LinearLayout>
Tampilan
main activity
Biodata.java
package tugas.zevi;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
public class Biodata extends Activity {
@Override
public void
onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.biodata);
}
public void
back (View view){
Intent intent = new Intent
(this,MainActivity.class);
startActivity(intent);
}
@Override
public
boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.biodata, menu);
return
true;
}
}
Biodata.xml
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/holodark">
<TableLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:stretchColumns="1"
android:shrinkColumns="1">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top"
android:src="@drawable/bidata"/>
<ImageView
android:layout_width="200dp"
android:layout_height="200dp"
android:layout_gravity="center"
android:src="@drawable/zeni"
android:layout_marginBottom="30dp">
</ImageView>
<TableRow>
<TextView
android:layout_width="100dp"
android:layout_height="wrap_content"
android:text="Nama :"
android:textSize="8pt"
android:textColor="#ffffff"
android:typeface="serif"/>
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Zevi
Apriyandi"
android:textSize="8pt"
android:layout_marginLeft="20dp"
android:textColor="#000000"
android:typeface="serif"/>
</TableRow>
<TableRow>
<TextView
android:layout_width="100dp"
android:layout_height="wrap_content"
android:text="NPM :"
android:textSize="8pt"
android:textColor="#ffffff"
android:typeface="serif"/>
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="10215410187"
android:textSize="8pt"
android:layout_marginLeft="20dp"
android:textColor="#000000"
android:typeface="serif"/>
</TableRow>
<TableRow>
<TextView
android:layout_width="100dp"
android:layout_height="wrap_content"
android:text="Email :"
android:textSize="8pt"
android:textColor="#ffffff"
android:typeface="serif"
/>
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="zevy_andy@rocketmail.com"
android:autoLink="email"
android:textSize="8pt"
android:layout_marginLeft="20dp"
android:textColor="#000000"
android:typeface="serif"
/>
</TableRow>
<TableRow >
<TextView
android:layout_width="100dp"
android:layout_height="wrap_content"
android:text="Alamat :"
android:textSize="8pt"
android:textColor="#ffffff"
android:typeface="serif"/>
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Babakan
Perumnas RT 009/006 Baranang Siang"
android:textSize="8pt"
android:layout_marginLeft="20dp"
android:textColor="#000000"
android:typeface="serif"/>
</TableRow>
<TableRow >
<TextView
android:layout_width="100dp"
android:layout_height="wrap_content"
android:text="NO HP :"
android:textSize="8pt"
android:textColor="#ffffff"
android:typeface="serif"/>
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:linksClickable="true"
android:autoLink="phone"
android:text="085695153674"
android:textSize="8pt"
android:layout_marginLeft="20dp"
android:textColor="#000000"
android:typeface="serif"/>
</TableRow>
<TableRow >
<TextView
android:layout_width="100dp"
android:layout_height="wrap_content"
android:text="SD :"
android:textSize="8pt"
android:textColor="#ffffff"
android:typeface="serif"/>
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="SD N PRUWATAN
5"
android:textSize="8pt"
android:layout_marginLeft="20dp"
android:textColor="#000000"
android:typeface="serif"/>
</TableRow>
<TableRow >
<TextView
android:layout_width="100dp"
android:layout_height="wrap_content"
android:text="SMP :"
android:textSize="8pt"
android:textColor="#ffffff"
android:typeface="serif"/>
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="SMP N2
BUMIAYU"
android:textSize="8pt"
android:layout_marginLeft="20dp"
android:textColor="#000000"
android:typeface="serif"/>
</TableRow>
<TableRow >
<TextView
android:layout_width="100dp"
android:layout_height="wrap_content"
android:text="SMA :"
android:textSize="8pt"
android:textColor="#ffffff"
android:typeface="serif"/>
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="SMK
MUHAMMADIYAH 2 AJIBARANG"
android:textSize="8pt"
android:layout_marginLeft="20dp"
android:textColor="#000000"
android:typeface="serif"/>
</TableRow>
<ImageView
android:layout_width="100dp"
android:layout_height="60dp"
android:id="@+id/back"
android:onClick="back"
android:text="back"
android:textSize="10pt"
android:layout_marginTop="30dp"
android:layout_marginLeft="200dp"
android:src="@drawable/balik"/>
</TableLayout>
</ScrollView>
Tampilan
Biodata
Visi Misi/RMD.Java
package tugas.zevi;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
public class Visi_misi extends Activity {
@Override
public
void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.visi_misi);
}
public
void back (View view){
Intent intent = new Intent
(this,MainActivity.class);
startActivity (intent);
}
@Override
public
boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.visi_misi, menu);
return
true;
}
}
Visi
misi.xml
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/holodark">
<TableLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:stretchColumns="1"
android:shrinkColumns="1">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/rencana"
android:layout_gravity="top"
tools:context=".Visi_misi"/>
<TableRow >
<TextView
android:layout_width="100dp"
android:layout_height="wrap_content"
android:text="1.Lulus Kuliah
8 Semester"
android:textSize="8pt"
android:textColor="#ffffff"
android:layout_marginLeft="8dp"
android:typeface="serif"/>
</TableRow>
<TableRow >
<TextView
android:layout_width="100dp"
android:layout_height="wrap_content"
android:text="2.Lulus dengan
hasil yang memuaskan"
android:textSize="8pt"
android:layout_marginLeft="10dp"
android:textColor="#ffffff"
android:typeface="serif"/>
</TableRow>
<TableRow >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="3.Membahagiakan
orang tua"
android:textSize="8pt"
android:textColor="#ffffff"
android:layout_marginLeft="8dp"
android:typeface="serif"/>
</TableRow>
<TableRow >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="4.Menikah Di usia
25"
android:textSize="8pt"
android:textColor="#ffffff"
android:layout_marginLeft="8dp"
android:typeface="serif"/>
</TableRow>
<TableRow >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="5.Membina
Rumah Tangga yg sakinah mawadah warohmah"
android:textSize="8pt"
android:layout_marginLeft="8dp"
android:textColor="#ffffff"
android:typeface="serif"/>
</TableRow>
<TableRow >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="6.Punya Mobil
dan rumah sebelum 30 tahun"
android:textSize="8pt"
android:layout_marginLeft="8dp"
android:textColor="#ffffff"
android:typeface="serif"/>
</TableRow>
<TableRow >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="7.Naik Hajiin
orang tua"
android:textSize="8pt"
android:layout_marginLeft="8dp"
android:textColor="#ffffff"
android:typeface="serif"/>
</TableRow>
<TableRow >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="8.Bahagia
Dunia Akhirat"
android:textSize="8pt"
android:layout_marginLeft="8dp"
android:textColor="#ffffff"
android:typeface="serif"/>
</TableRow>
<ImageView
android:layout_width="100dp"
android:layout_height="60dp"
android:id="@+id/back"
android:onClick="back"
android:text="back"
android:textSize="10pt"
android:layout_marginLeft="200dp"
android:layout_marginTop="100dp"
android:src="@drawable/balik"/>
</TableLayout>
</ScrollView>
Tampilan
RMD
Diary/Penutup.java
package tugas.zevi;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
public class Diary extends Activity {
@Override
public
void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.diary);
}
public
void back (View view){
Intent intent = new Intent
(this,MainActivity.class);
startActivity (intent);
}
@Override
public
boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.diary, menu);
return
true;
}
}
Diary/Penutup.xml
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/holodark" >
<TableLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:stretchColumns="1"
android:shrinkColumns="1">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top"
android:src="@drawable/penutup"/>
<ImageView
android:layout_width="100dp"
android:layout_height="60dp"
android:id="@+id/back"
android:onClick="back"
android:text="back"
android:textSize="10pt"
android:layout_marginTop="100dp"
android:layout_marginLeft="220dp"
android:layout_marginRight="10dp"
android:src="@drawable/balik" />
</TableLayout>
</ScrollView>
Tampilan Penutup
Manifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="tugas.zevi"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="15"
/>
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".Splash"
android:label="@string/title_activity_splash" >
<intent-filter>
<action android:name="android.intent.action.MAIN"
/>
<category android:name="android.intent.category.LAUNCHER"
/>
</intent-filter>
</activity>
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
<intent-filter>
<category android:name="android.intent.category.LAUNCHER"
/>
</intent-filter>
</activity>
<activity
android:name=".Biodata"
android:label="@string/title_activity_biodata" >
<intent-filter>
<category android:name="android.intent.category.LAUNCHER"
/>
</intent-filter>
</activity>
<activity
android:name=".Visi_misi"
android:label="Rencana Masa Depan" >
<intent-filter>
<category android:name="android.intent.category.LAUNCHER"
/>
</intent-filter>
</activity>
<activity
android:name=".Diary"
android:label="penutup" >
<intent-filter>
<category android:name="android.intent.category.LAUNCHER"
/>
</intent-filter>
</activity>
</application>
Mata kuliah ini bagus dipelajari sebagai konsep dalam pemrograman
BalasHapus