LAMPIRAN
LISTING PROGRAM
1. SPLASHSCREEN
SplashsActivity.java
package alat.musik.aku; import android.app.Activity; import android.content.Intent; import android.media.MediaPlayer; import android.os.Bundle;
import android.view.Window;
import android.view.WindowManager;
public class SplashActivity extends Activity { MediaPlayer suaraSplash;
@Override
protected void onCreate(Bundle savedInstanceState) {
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FU LLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.splash);
suaraSplash = MediaPlayer.create(this, R.raw.button);
suaraSplash.start();
Thread timer = new Thread() { public void run() {
try {
//berapalama splashscreen akan ditampilkan dalam milisecond
sleep(3000);
} catch (InterruptedException e) { // TODO: handle exception
e.printStackTrace(); } finally {
//activity yang akan dijalankan setelah splashscreen selesai
Intent i = new
startActivity(i); } }
}; timer.start(); }
@Override
protected void onPause() {
// TODO Auto-generated method stub super.onPause();
suaraSplash.pause(); }
@Override
protected void onResume() {
// TODO Auto-generated method stub super.onResume();
suaraSplash.start(); }
@Override
protected void onStart() {
// TODO Auto-generated method stub super.onStart();
@Override
protected void onDestroy() {
// TODO Auto-generated method stub super.onDestroy();
suaraSplash.release(); }
}
2. HALAMAN MENU UTAMA
Alatmusik.java
package alat.musik.aku;
import java.sql.SQLException; import android.app.Activity; import android.content.Intent;
import android.graphics.BitmapFactory; import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener; import android.widget.Button;
Button btn; Button btn1;
/** Called when the activity is first created. */ @Override
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);
setContentView(R.layout.main);
btn =(Button) findViewById(R.id.widget27); Dbhelper = new DBhelper (this);
Alatmusikku musik = new Alatmusikku (
"3","tehyan "," Tehyan adalah salah satu alat musik Betawi hasil perpaduan kebudayaan Tionghoa yang masih tersisa. Menurutnya, saat ini Tehyan mulai jarang dijumpai karena langkanya alat musik Tehyan digunakan oleh
masyarakat.Tehyan merupakan alat musik gesek berbentuk
panjang dengan bagian bawah yang agak melebar. Jika diamati, alat musik ini mirip rangka manusia mulai bagian badan
hingga bokong.",
"cara memainkan adalah di
try {
Dbhelper.open();
} catch (SQLException e) {
// TODO Auto-generated catch block e.printStackTrace();
}
Dbhelper.musikEntry(musik, "pulau_jawa"); Dbhelper.close();
btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) { Intent i = new
Intent(getApplicationContext(),Kedua.class); startActivity(i);
// finish();
} });
btn1 =(Button) findViewById(R.id.widget28);
btn1.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) { Intent exit= new
Intent(Intent.ACTION_MAIN);
exit.addCategory(Intent.CATEGORY_HOME);
exit.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); alatmusik.this.finish();
startActivity(exit);
// TODO Auto-generated method stub finish();
} });
}
}
3. TAMPILAN MENU KEDUA(LISTVIEW PULAU)
Kedua.java
package alat.musik.aku;
import android.app.ListActivity; import android.content.Intent; import android.os.Bundle;
import android.widget.ListView; import android.widget.Toast;
public class Kedua extends ListActivity { String[] pulau={
"Pulau Sumatera","Pulau Kalimantan","Pulau Jawa","Pulau Maluku dan Papua","Pulau NTT dan
Bali","Sulawesi"};
/** Called when the activity is first created. */ @Override
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);
//setContentView(R.layout.tampilankedua);
setListAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, pulau)); }
public void onListItemClick(ListView parent, View v, int position, long id){
Toast.makeText(this,"anda telah memilih " + pulau[position], Toast.LENGTH_SHORT).show();
String pilihan = o.toString();
if (pilihan.equals("Pulau Sumatera")){ Intent i = new
Intent(getApplicationContext(),Sumatera.class); startActivity(i);
}
else if (pilihan.equals("Pulau Kalimantan")){ Intent a = new
Intent(getApplicationContext(),Kalimantan.class); startActivity(a);
}
else if (pilihan.equals("Pulau Jawa")){ Intent b = new
Intent(getApplicationContext(),Jawa.class); startActivity(b);
}
else if (pilihan.equals("Pulau Maluku dan Papua")){ Intent c = new
}
else if (pilihan.equals("Pulau NTT dan Bali")){ Intent d = new
Intent(getApplicationContext(),Nttdanbali.class); startActivity(d);
}
else if (pilihan.equals("Sulawesi")){ Intent e = new
Intent(getApplicationContext(),Sulawesi.class); startActivity(e);
} }
}
4.Tampilan listview sumatera
Sumatera.java
package alat.musik.aku;
import android.view.View;
import android.widget.ArrayAdapter; import android.widget.ListView; import android.widget.Toast;
public class Sumatera extends ListActivity { String[] PulauSumatera ={
"Sumatera Utara","Sumatera Barat","Sumatera Selatan","Bengkulu","Aceh","Riau","Kep.Riau","Bangka
Belitung"};
/** Called when the activity is first created. */ @Override
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);
// setContentView(R.layout.main);
setListAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, PulauSumatera)); }
public void onListItemClick(ListView parent, View v, int position, long id){
Toast.makeText(this,"anda telah memilih" +
Intent i = new
Intent(getApplicationContext(),Ketiga.class); Bundle b= new Bundle();
Object o = this.getListAdapter().getItem(position); String pilihan = o.toString ();
String nama_table ="pulau_sumatera"; String nama_database="Dbalat2";
String namaId;
if (pilihan.equals("Sumatera Utara")) {
namaId="1";
b.putString("parse_nama", namaId); b.putString("parse_table",nama_table);
b.putString("parse_database", nama_database); }
else if (pilihan.equals("Sumatera Barat")) {
namaId="2";
b.putString("parse_nama", namaId); b.putString("parse_table",nama_table);
b.putString("parse_database", nama_database); }
{
namaId="3";
b.putString("parse_nama", namaId); b.putString("parse_table",nama_table);
b.putString("parse_database", nama_database); }
else if (pilihan.equals ("Bengkulu")) {
namaId="4";
b.putString("parse_nama", namaId); b.putString("parse_table",nama_table);
b.putString("parse_database", nama_database); }
else if (pilihan.equals ("Aceh")) {
namaId="5";
b.putString("parse_nama", namaId); b.putString("parse_table",nama_table);
b.putString("parse_database", nama_database); }
else if (pilihan.equals ("Riau")) {
b.putString("parse_nama", namaId); b.putString("parse_table",nama_table);
b.putString("parse_database", nama_database); }
else if (pilihan.equals ("Kep.Riau")) {
namaId="7";
b.putString("parse_nama", namaId); b.putString("parse_table",nama_table);
b.putString("parse_database", nama_database); }
else if (pilihan.equals ("Bangka Belitung")) {
namaId="8";
b.putString("parse_nama", namaId); b.putString("parse_table",nama_table);
b.putString("parse_database", nama_database); }
i.putExtras(b); startActivity(i);
5. TAMPILAN LIST VIEW KALIMANTAN
Kalimantan.java
import android.app.Activity; import android.app.ListActivity; import android.content.Intent; import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter; import android.widget.ListView; import android.widget.Toast;
public class Kalimantan extends ListActivity { String[] Pulaukalimantan ={
"Kalimantan Barat","Kalimantan Timur","Kalimantan Tengah","Kalimantan Selatan"};
/** Called when the activity is first created. */ @Override
// setContentView(R.layout.main); setListAdapter(new
ArrayAdapter<String>(this,android.R.layout.simple_list_ item_1, Pulaukalimantan));
}
public void onListItemClick(ListView parent, View v, int position, long id){
Toast.makeText(this,"anda telah memilih" +
Pulaukalimantan[position], Toast.LENGTH_SHORT).show(); Intent i = new
Intent(getApplicationContext(),Ketiga.class); Bundle b= new Bundle();
Object o = this.getListAdapter().getItem(position); String pilihan = o.toString ();
String nama_table ="pulau_kalimantan"; String nama_database="Dbalat2";
String namaId;
if (pilihan.equals("Kalimantan Barat")) {
namaId="1";
b.putString("parse_nama", namaId); b.putString("parse_table",nama_table);
}
else if (pilihan.equals("Kalimantan Timur")) {
namaId="2";
b.putString("parse_nama", namaId); b.putString("parse_table",nama_table);
b.putString("parse_database", nama_database); }
else if (pilihan.equals("Kalimantan Tengah")) {
namaId="3";
b.putString("parse_nama", namaId); b.putString("parse_table",nama_table);
b.putString("parse_database", nama_database); }
else if (pilihan.equals ("Kalimantan Selatan")) {
namaId="4";
b.putString("parse_nama", namaId); b.putString("parse_table",nama_table);
b.putString("parse_database", nama_database); }
startActivity(i); }
}
6. TAMPILAN LIST VIEW JAWA
Jawa.java
package alat.musik.aku;
import android.app.ListActivity; import android.content.Intent; import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter; import android.widget.ListView; import android.widget.Toast;
public class Jawa extends ListActivity { String[] Pulaujawa ={
"Jawa barat","Jawa timur","D.I.Yogyakarta","Banten"};
/** Called when the activity is first created. */ @Override
// setContentView(R.layout.main);
setListAdapter(newArrayAdapter<String>(this,android.R.layout .simple_list_item_1, Pulaujawa));
}
public void onListItemClick(ListView parent, View v, int position, long id){
Toast.makeText(this,"anda telah memilih" + Pulaujawa[position], Toast.LENGTH_SHORT).show();
Intent i = new
Intent(getApplicationContext(),Ketiga.class); Bundle b= new Bundle();
Object o = this.getListAdapter().getItem(position); String pilihan = o.toString ();
String nama_table ="pulau_jawa"; String nama_database="Dbalat2"; String namaId;
if (pilihan.equals("Jawa barat")) {
namaId="1";
b.putString("parse_nama", namaId); b.putString("parse_table",nama_table);
}
else if (pilihan.equals("Jawa timur")) {
namaId="2";
b.putString("parse_nama", namaId); b.putString("parse_table",nama_table);
b.putString("parse_database", nama_database); }
else if (pilihan.equals ("D.I.Yogyakarta")) {
namaId="4";
b.putString("parse_nama", namaId); b.putString("parse_table",nama_table);
b.putString("parse_database", nama_database); }
else if (pilihan.equals ("Banten")) {
namaId="5";
b.putString("parse_nama", namaId); b.putString("parse_table",nama_table);
}
i.putExtras(b); startActivity(i);
} }
7. TAMPILAN LIST VIEW MALUKU DAN PAPUA
Maluku.java
package alat.musik.aku;
import android.app.Activity; import android.app.ListActivity; import android.content.Intent; import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter; import android.widget.ListView; import android.widget.Toast;
public class maluku extends ListActivity { String[] Pulaumaluku ={"Maluku
/** Called when the activity is first created. */ @Override
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);
String[] malukudanpapua = null
// setContentView(R.layout.main);
setListAdapter(newArrayAdapter<String>(this,android.R.l ayout.simple_list_item_1, Pulaumaluku));
}
public void onListItemClick(ListView parent, View v, int position, long id){
Toast.makeText(this,"anda telah memilih" + Pulaumaluku[position], Toast.LENGTH_SHORT).show();
Intent i = new
Intent(getApplicationContext(),Ketiga.class); Bundle b= new Bundle();
Object o = this.getListAdapter().getItem(position); String pilihan = o.toString ();
String nama_table ="pulau_maluku_dan_papua"; String nama_database="Dbalat2";
String namaId;
{
namaId="1";
b.putString("parse_nama", namaId); b.putString("parse_table",nama_table);
b.putString("parse_database", nama_database); }
else if (pilihan.equals("Maluku")) {
namaId="2";
b.putString("parse_nama", namaId); b.putString("parse_table",nama_table);
b.putString("parse_database", nama_database); }
else if (pilihan.equals("Papua")) {
namaId="3";
b.putString("parse_nama", namaId); b.putString("parse_table",nama_table);
b.putString("parse_database", nama_database); }
else if (pilihan.equals ("Papua Barat")) {
b.putString("parse_nama", namaId); b.putString("parse_table",nama_table);
b.putString("parse_database", nama_database); }
i.putExtras(b); startActivity(i); }
}
8. TAMPILAN LIST VIEW NTT DAN BALI
Nttdanbali.java
package alat.musik.aku;
import android.app.Activity; import android.app.ListActivity; import android.content.Intent; import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter; import android.widget.ListView; import android.widget.Toast;
"NTT","Bali","NTB"};
/** Called when the activity is first created. */ @Override
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);
// setContentView(R.layout.main);
setListAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, nttdanbali)); }
public void onListItemClick(ListView parent, View v, int position, long id){
Toast.makeText(this,"anda telah memilih" + nttdanbali[position], Toast.LENGTH_SHORT).show();
Intent i = new
Intent(getApplicationContext(),Ketiga.class); Bundle b= new Bundle();
Object o = this.getListAdapter().getItem(position); String pilihan = o.toString ();
String nama_table ="pulau_ntt_dan_bali"; String nama_database="Dbalat2";
String namaId;
{
namaId="1";
b.putString("parse_nama", namaId); b.putString("parse_table",nama_table);
b.putString("parse_database", nama_database); }
else if (pilihan.equals("Bali")) {
namaId="2";
b.putString("parse_nama", namaId); b.putString("parse_table",nama_table);
b.putString("parse_database", nama_database); }
else if (pilihan.equals("NTB")) {
namaId="3";
b.putString("parse_nama", namaId); b.putString("parse_table",nama_table);
b.putString("parse_database", nama_database); }
} }
9. TAMPILAN LIST VIEW SULAWESI
Sulawesi.java
package alat.musik.aku;
import android.app.Activity; import android.app.ListActivity; import android.content.Intent; import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter; import android.widget.ListView; import android.widget.Toast;
String [] Sulawesi ={"Sulawesi Utara","Sulawesi Barat","Sulawesi Selatan","Sulawesi Tenggara","Gorontalo"};
/** Called when the activity is first created. */ @Override
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);
// setContentView(R.layout.main);
setListAdapter(newArrayAdapter<String>(this,android.R.l ayout.simple_list_item_1, Sulawesi));
}
public void onListItemClick(ListView parent, View v, int position, long id){
Toast.makeText(this,"anda telah memilih" + Sulawesi[position], Toast.LENGTH_SHORT).show();
Intent i = new
Intent(getApplicationContext(),Ketiga.class); Bundle b= new Bundle();
Object o = this.getListAdapter().getItem(position); String pilihan = o.toString ();
String namaId;
if (pilihan.equals("Sulawesi Utara")) {
namaId="1";
b.putString("parse_nama", namaId); b.putString("parse_table",nama_table);
b.putString("parse_database", nama_database); }
else if (pilihan.equals("Sulawesi Barat")) {
namaId="2";
b.putString("parse_nama", namaId); b.putString("parse_table",nama_table);
b.putString("parse_database", nama_database); }
else if (pilihan.equals("Sulawesi Selatan")) {
namaId="3";
b.putString("parse_nama", namaId); b.putString("parse_table",nama_table);
b.putString("parse_database", nama_database); }
{
namaId="4";
b.putString("parse_nama", namaId); b.putString("parse_table",nama_table);
b.putString("parse_database", nama_database); }
else if (pilihan.equals ("Gorontalo")) {
namaId="4";
b.putString("parse_nama", namaId); b.putString("parse_table",nama_table);
b.putString("parse_database", nama_database); }
i.putExtras(b); startActivity(i);
} }
10. TAMPILAN DATABASE
Dbhelper.java
import java.io.ByteArrayOutputStream; import java.sql.SQLException;
import android.content.ContentValues; import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
public class DBhelper {
public static final String KEY_ID = "id"; public static final String KEY_NAME = "nama";
public static final String KEY_SEJARAH = "sejarah"; public static final String KEY_CARA = "cara_memainkan"; public static final String KEY_IMG = "gambar";
private DatabaseHelper mDbHelper; private SQLiteDatabase mDb;
private static final String MUSIK_TABLE2 = "pulau_kalimantan";
private static final String MUSIK_TABLE3 = "pulau_jawa"; private static final String MUSIK_TABLE4 =
"pulau_maluku_dan_papua";
private static final String MUSIK_TABLE5 = "pulau_ntt_dan_bali";
private static final String MUSIK_TABLE6 = "pulau_sulawesi";
private static final String DATABASE_NAME = "DBalat2"; private static final int DATABASE_VERSION = 1;
private static final String CREATE_MUSIK_TABLE= "create table "+MUSIK_TABLE+" ("
+KEY_ID+" integer primary key autoincrement, "
+KEY_NAME+" text not null, "
+KEY_CARA+" text not null, "
+KEY_IMG+" blob not null);";
private static final String CREATE_MUSIK_TABLE2 = "create table "+MUSIK_TABLE2+" ("
+KEY_ID+" integer primary key autoincrement, " +KEY_NAME+" text not null, "
+KEY_SEJARAH+" text not null, "
+KEY_CARA+" text not null, " +KEY_IMG+" blob not null);";
private static final String CREATE_MUSIK_TABLE3 = "create table "+MUSIK_TABLE3+" ("
+KEY_ID+" integer primary key autoincrement, " +KEY_NAME+" text not null, "
+KEY_SEJARAH+" text not null, "
private static final String CREATE_MUSIK_TABLE4 = "create table "+MUSIK_TABLE4+" ("
+KEY_ID+" integer primary key autoincrement, " +KEY_NAME+" text not null, "
+KEY_SEJARAH+" text not null, "
+KEY_CARA+" text not null, " +KEY_IMG+" blob not null);";
private static final String CREATE_MUSIK_TABLE5 = "create table "+MUSIK_TABLE5+" ("
+KEY_ID+" integer primary key autoincrement, " +KEY_NAME+" text not null, "
+KEY_SEJARAH+" text not null, "
+KEY_CARA+" text not null, " +KEY_IMG+" blob not null);";
private static final String CREATE_MUSIK_TABLE6 = "create table "+MUSIK_TABLE6+" ("
+KEY_SEJARAH+" text not null, "
+KEY_CARA+" text not null, " +KEY_IMG+" blob not null);";
private final Context mCtx;
private static class DatabaseHelper extends SQLiteOpenHelper {
DatabaseHelper(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
}
public void onCreate(SQLiteDatabase db) { db.execSQL(CREATE_MUSIK_TABLE);
db.execSQL(CREATE_MUSIK_TABLE2); db.execSQL(CREATE_MUSIK_TABLE3); db.execSQL(CREATE_MUSIK_TABLE4); db.execSQL(CREATE_MUSIK_TABLE5); db.execSQL(CREATE_MUSIK_TABLE6);
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
// db.execSQL("DROP TABLE IF EXISTS "+alatmusik_TABLE);
// onCreate(db); }
}
public void Reset() { mDbHelper.onUpgrade(this.mDb, 1, 1); }
public DBhelper(Context ctx) { mCtx = ctx;
mDbHelper = new DatabaseHelper(mCtx); }
public DBhelper open() throws SQLException { mDb = mDbHelper.getWritableDatabase(); return this;
}
public void musikEntry(Alatmusikku testTokoh, String tabel) {
ByteArrayOutputStream out = new ByteArrayOutputStream ();
testTokoh.getBitmap().compress(Bitmap.CompressFormat.PN G, 100 , out);
ContentValues cv = new ContentValues(); cv.put(KEY_ID, testTokoh.getId());
cv.put(KEY_NAME, testTokoh.getNama());
cv.put(KEY_SEJARAH, testTokoh.getSejarah()); cv.put(KEY_CARA, testTokoh.getCara());
cv.put(KEY_IMG, out.toByteArray());
mDb.insert(tabel, null, cv); }
public Alatmusikku getFirstAlatmusikkuFromDB(String tabel,String namaId) throws SQLException {
Cursor cur = mDb.query(true, tabel,
KEY_ID + "=" + namaId, null,null, null, null, null);
if(cur.moveToFirst()) {
byte[] blob = cur.getBlob(cur.getColumnIndex(KEY_IMG)); String id = cur.getString(cur.getColumnIndex(KEY_ID)); String nama = cur.getString(cur.getColumnIndex(KEY_NAME)); String sejarah =
cur.getString(cur.getColumnIndex(KEY_SEJARAH)); String cara_memainkan =
cur.getString(cur.getColumnIndex(KEY_CARA)); android.graphics.Bitmap bmp =
BitmapFactory.decodeByteArray(blob, 0, blob.length); cur.close();
return new Alatmusikku(id, nama, sejarah, cara_memainkan, bmp);
}
cur.close(); return null; }
Cursor cur = mDb.query(true, tabel, new
String[]{KEY_ID, KEY_NAME, KEY_SEJARAH, KEY_CARA,
KEY_IMG}, KEY_ID + "=" + rowId , null, null, null, null, null);
if(cur.moveToFirst()) {
byte[] blob =
cur.getBlob(cur.getColumnIndex(KEY_IMG)); String id =
cur.getString(cur.getColumnIndex(KEY_ID)); String nama =
cur.getString(cur.getColumnIndex(KEY_NAME)); String sejarah =
cur.getString(cur.getColumnIndex(KEY_SEJARAH)); String cara_memainkan =
cur.getString(cur.getColumnIndex(KEY_CARA)); android.graphics.Bitmap bmp =
BitmapFactory.decodeByteArray(blob, 0, blob.length); cur.close();
return new Alatmusikku(id, nama, sejarah, cara_memainkan, bmp);
}
return null; }
public void deleteRow(String nilai) {
try{
// mDb.delete(Hewanku_TABLE, KEY_ID + "= " +3, null);
}catch(Exception e){
e.printStackTrace(); }
}
public Cursor getContact (long rowId, String tabel) throws SQLException{
Cursor mcursor = mDb.query(true, tabel, new String[]{KEY_ID, KEY_NAME, KEY_SEJARAH, KEY_CARA, KEY_IMG}, KEY_ID + "=" + rowId , null, null, null, null, null);
if(mcursor != null) {
}
return mcursor; }
}
11. ISI DATABASE
Alatmusikku.java
package alat.musik.aku;
import android.graphics.Bitmap; public class Alatmusikku {
private Bitmap gambar; private String nama; private String sejarah;
private String cara_memainkan; private String id;
public Alatmusikku() {
}
{
gambar = g; id = i;
cara_memainkan = c ; nama = n;
sejarah = k;
}
/* public DragonBall(String nama2 , String versi2) {
this.nama2 = nama2; this.versi2 = versi2;
}*/
// public String getNama2(){return this.nama2;} // public String getVersi2(){return this.versi2;}
public Bitmap getBitmap(){return gambar;} public String getNama(){return nama;}
public String getSejarah(){return sejarah;} public String getCara(){return cara_memainkan;} public String getId () {return id;}
12. INTENT DATABASE
Ketiga.java
package alat.musik.aku;
import java.sql.SQLException;
import android.app.Activity; import android.os.Bundle;
import android.widget.ImageView; import android.widget.TextView;
public class Ketiga extends Activity { private DBhelper Dbhelper;
@Override
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);
setContentView(R.layout.sumatera); Dbhelper =new DBhelper (this); String namaId,table;
table= b.getString ("parse_table");
Alatmusikku testing = new Alatmusikku(); try {
Dbhelper.open();testing = Dbhelper.getFirstAlatmusikkuFromDB (table,namaId);
TextView textid, textnama, textsejarah, textcara; textnama = (TextView) findViewById (R.id.widget28); textnama.setText("nama : " +testing.getNama());
textsejarah = (TextView) findViewById (R.id.widget29); textsejarah.setText("sejarah : " +testing.getSejarah()); textcara = (TextView) findViewById (R.id.widget30);
textcara.setText("cara : " +testing.getCara()); ImageView image;
image = (ImageView) findViewById(R.id.widget31); image.setImageBitmap(testing.getBitmap());
} catch (SQLException e1) {
// TODO Auto-generated catch block e1.printStackTrace();
}
} }
13. Layout Splah Screen
Splash.xml
<?xml version="1.0" encoding="utf-8"?> <linearlayout
xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent"
android:layout_height="fill_parent"> <imageview
android:id="@+id/imageview01"
android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/pageawal"> </imageview>
</linearlayout>
Main.xml
<?xml version="1.0" encoding="utf-8"?> <AbsoluteLayout
android:id="@+id/widget0"
android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@drawable/screen"
xmlns:android="http://schemas.android.com/apk/res/android">
<Button
android:layout_height="40px" android:typeface="serif" android:text="MASUK" android:textStyle="bold" android:layout_width="80px" android:id="@+id/widget27"
android:background="@drawable/btn" android:layout_x="30dip"
android:layout_y="450dip"> </Button>
<Button
android:typeface="serif" android:text="KELUAR"
android:layout_height="40px" android:id="@+id/widget28" android:textStyle="bold"
android:background="@drawable/btn" android:layout_x="270dip"
android:layout_y="450dip"></Button> </AbsoluteLayout>
15. LAYOUT TAMPILAN DATABASE
Sumatera.xml
<?xml version="1.0" encoding="utf-8"?> <AbsoluteLayout
android:id="@+id/widget0"
android:layout_width="fill_parent" android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android"> <TextView
android:id="@+id/widget28"
android:layout_height="wrap_content" android:typeface="sans"
android:text="TextView" android:layout_x="0px" android:layout_y="0px"> </TextView>
<ImageView
android:id="@+id/widget31"
android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_x="70px"
android:layout_y="300px"> </ImageView>
<TextView
android:layout_width="wrap_content" android:text="TextView"
android:typeface="sans"
android:layout_height="wrap_content" android:id="@+id/widget29"
</TextView> <TextView
android:layout_width="wrap_content" android:text="TextView"
android:layout_height="wrap_content" android:id="@+id/widget30"
android:typeface="sans" android:layout_x="0dip" android:layout_y="250dip"> </TextView>