• Tidak ada hasil yang ditemukan

Aplikasi Pembelajaran Klasifikasi Hewan Berbasis Android

N/A
N/A
Protected

Academic year: 2019

Membagikan "Aplikasi Pembelajaran Klasifikasi Hewan Berbasis Android"

Copied!
32
0
0

Teks penuh

(1)

LAMPIRAN

LISTING PROGRAM

1. Main.Java

package aplikasiTA.winda;

import android.app.Activity; import android.content.Intent;

import android.graphics.BitmapFactory; import android.os.Bundle;

import android.view.View; import android.view.Window; import android.widget.Button;

public class Main extends Activity {

/** Called when the activity is first created. */ Button btn, btn1;

private DBhelper Dbhelper;

@Override

public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);

requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.dashboard);

Dbhelper = new DBhelper (this);

Hewanku testTokoh = new Hewanku ( "5", "Cangkang",

BitmapFactory.decodeResource(getResources(), R.drawable.kepiting),

"Hewan yang penutup tubuhnya cangkang.Contoh : Siput, Bekicot, dan Kura-kura.", "Seluruh bagian tubuhnya ditutupi cangkang.");

Dbhelper.open();

Dbhelper.hewanEntry(testTokoh,"penutup_tubuh"); Dbhelper.close();

btn = (Button) findViewById(R.id.Button01);

(2)

public void onClick(View v) {

// TODO Auto-generated method stub

Intent i =new Intent(getApplicationContext(),MenuKlasifikasi.class); startActivity(i);

} });

btn1=(Button) findViewById(R.id.Button02);

btn1.setOnClickListener(new View.OnClickListener() {

@Override

public void onClick(View v) {

Intent exit= new Intent(Intent.ACTION_MAIN); exit.addCategory(Intent.CATEGORY_HOME);

exit.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); Main.this.finish();

startActivity(exit); }}

); }}

2. Menu Klasifikasi.Java

package aplikasiTA.winda;

import android.app.ListActivity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.view.Window;

import android.widget.ArrayAdapter; import android.widget.ListView; import android.widget.Toast;

public class MenuKlasifikasi extends ListActivity { String [] menu = {

"Ada Tidaknya Tulang Belakang","Cara Berkembangbiak","Jenis Makanan","Cara Bergerak","Cara Bernafas","Tempat Hidup","Penutup Tubuh" };

@Override

public void onCreate (Bundle savedInstanceState){ super.onCreate(savedInstanceState);

(3)

this.setListAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, menu));

}

@Override

public void onListItemClick(ListView parent, View v,int position, long id) { Toast.makeText(this, "Anda memilih : " + menu[position],

Toast.LENGTH_SHORT).show();

Object o = this.getListAdapter().getItem(position); String pilihan = o.toString();

Toast.makeText(this, " Klasifikasi yang Anda pilih terdiri atas :" , Toast.LENGTH_LONG).show();

if (pilihan.equals("Ada Tidaknya Tulang Belakang")) {

Intent a = new Intent(getApplicationContext(), TulangBelakang.class); startActivity(a); }

else if (pilihan.equals("Cara Berkembangbiak")){

Intent b = new Intent(getApplicationContext(),CaraBerkembangBiak.class); startActivity(b); }

else if (pilihan.equals("Jenis Makanan")){

Intent c = new Intent(getApplicationContext(),JenisMakanan.class); startActivity(c); }

else if (pilihan.equals("Cara Bergerak")){

Intent d = new Intent(getApplicationContext(),CaraBergerak.class); startActivity(d); }

else if (pilihan.equals("Cara Bernafas")){

Intent e = new Intent(getApplicationContext(),CaraBernafas.class); startActivity(e); }

else if (pilihan.equals("Tempat Hidup")){

Intent f = new Intent(getApplicationContext(),TempatHidup.class); startActivity(f); }

else if (pilihan.equals("Penutup Tubuh")){

Intent g = new Intent(getApplicationContext(),PenutupTubuh.class); startActivity(g); }

(4)

3. Tulang Belakang.Java

package aplikasiTA.winda;

import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.view.Window; import android.widget.Button;

public class TulangBelakang extends Activity { Button btn_avertebrata, btn_vertebrata;

@Override

public void onCreate (Bundle savedInstanceState){ super.onCreate(savedInstanceState);

requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.panel_tulanglayout);

btn_avertebrata = (Button) findViewById(R.id.Button01);

btn_avertebrata.setOnClickListener(new View.OnClickListener()

{

public void onClick(View v) {

Intent i = new Intent(getApplicationContext(), Avertebrata.class); startActivity(i);

// TODO Auto-generated method stub

}});

btn_vertebrata =(Button) findViewById(R.id.Button02);

btn_vertebrata.setOnClickListener(new View.OnClickListener()

{

public void onClick(View v) {

// TODO Auto-generated method stub

Intent j = new Intent (getApplicationContext(), Vertebrata.class); startActivity(j);

}

});

(5)

4. Avertebrata.Java

package aplikasiTA.winda;

import android.app.ListActivity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.view.Window;

import android.widget.ArrayAdapter; import android.widget.ListView; import android.widget.Toast;

public class Avertebrata extends ListActivity{ String[]Avertebrata = {

"PROTOZOA", "PORIFERA", "COELENTERATA", "PLATYHELMINTES", "NEMATHELMINTES", "ANNELIDA", "MOLUSCA",

"ARTHROPODA","ECHINODERMATA","CHORDATA" };

@Override

public void onCreate (Bundle savedInstanceState){ super.onCreate(savedInstanceState);

requestWindowFeature(Window.FEATURE_NO_TITLE);

setListAdapter(new ArrayAdapter<String> (this,android.R.layout.simple_list_item_1, Avertebrata));

}

public void onListItemClick(ListView parent, View v, int position, long id){ Toast.makeText(this,"Anda memilih " + Avertebrata[position], Toast.LENGTH_SHORT).show();

Intent i = new Intent(getApplication(), Hewan.class);

Bundle b = new Bundle();

Object o = this.getListAdapter().getItem(position); String pilihan = o.toString();

String nama_tabel="avertebrata"; String nama_database = "DBHewan"; String namaId;

if(pilihan.equals("PROTOZOA")) {

namaId = "1";

b.putString("parse_nama", namaId); b.putString("parse_tabel", nama_tabel);

b.putString("parse_database", nama_database); }

(6)

else if(pilihan.equals("PORIFERA")) {

namaId = "2";

b.putString("parse_nama", namaId); b.putString("parse_tabel", nama_tabel);

b.putString("parse_database", nama_database); }

else if(pilihan.equals("COELENTERATA")) {

namaId = "3";

b.putString("parse_nama", namaId); b.putString("parse_tabel", nama_tabel);

b.putString("parse_database", nama_database); }

else if(pilihan.equals("PLATYHELMINTES")) {

namaId = "4";

b.putString("parse_nama", namaId); b.putString("parse_tabel", nama_tabel);

b.putString("parse_database", nama_database); }

else if(pilihan.equals("NEMATHELMINTES")) {

namaId = "5";

b.putString("parse_nama", namaId); b.putString("parse_tabel", nama_tabel);

b.putString("parse_database", nama_database); }

else if(pilihan.equals("ANNELIDA")) {

namaId = "6";

b.putString("parse_nama", namaId); b.putString("parse_tabel", nama_tabel);

b.putString("parse_database", nama_database); }

else if(pilihan.equals("MOLUSCA")) {

namaId = "7";

b.putString("parse_nama", namaId); b.putString("parse_tabel", nama_tabel);

(7)

else if(pilihan.equals("ARTHROPODA")) {

namaId = "8";

b.putString("parse_nama", namaId); b.putString("parse_tabel", nama_tabel);

b.putString("parse_database", nama_database); }

else if(pilihan.equals("ECHINODERMATA")) {

namaId = "9";

b.putString("parse_nama", namaId); b.putString("parse_tabel", nama_tabel);

b.putString("parse_database", nama_database); }

else if(pilihan.equals("CHORDATA")) {

namaId = "10";

b.putString("parse_nama", namaId); b.putString("parse_tabel", nama_tabel);

b.putString("parse_database", nama_database); }

i.putExtras(b); startActivity(i); }

}

5. Vertebrata.Java

package aplikasiTA.winda;

import android.app.ListActivity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.view.Window;

(8)

public class Vertebrata extends ListActivity {

String []Vertebrata = {"PISCES", "AMFIBIA", "REPTILIA", "AVES", "MAMALIA"};

@Override

public void onCreate (Bundle savedInstanceState) { super.onCreate(savedInstanceState);

requestWindowFeature(Window.FEATURE_NO_TITLE);

setListAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, Vertebrata));

}

public void onListItemClick(ListView parent, View v, int position, long id){ Toast.makeText(this, "Anda memilih "+ Vertebrata[position],

Toast.LENGTH_SHORT).show();

Intent i = new Intent(getApplication(), Hewan.class);

Bundle b = new Bundle();

Object o = this.getListAdapter().getItem(position); String pilihan = o.toString();

String nama_tabel="vertebrata"; String nama_database = "DBHewan"; String namaId;

if(pilihan.equals("PISCES")) {

namaId = "1";

b.putString("parse_nama", namaId); b.putString("parse_tabel", nama_tabel);

b.putString("parse_database", nama_database); }

else if(pilihan.equals("AMFIBIA")) {

namaId = "2";

b.putString("parse_nama", namaId); b.putString("parse_tabel", nama_tabel);

b.putString("parse_database", nama_database); }

else if(pilihan.equals("REPTILIA")) {

namaId = "3";

b.putString("parse_nama", namaId); b.putString("parse_tabel", nama_tabel);

(9)

else if(pilihan.equals("AVES")) {

namaId = "4";

b.putString("parse_nama", namaId); b.putString("parse_tabel", nama_tabel);

b.putString("parse_database", nama_database); }

else if(pilihan.equals("MAMALIA")) {

namaId = "5";

b.putString("parse_nama", namaId); b.putString("parse_tabel", nama_tabel);

b.putString("parse_database", nama_database); }

i.putExtras(b); startActivity(i);

} }

6. Caraberkembangbiak.java

package aplikasiTA.winda;

import android.app.ListActivity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.view.Window;

import android.widget.ArrayAdapter; import android.widget.ListView; import android.widget.Toast;

public class CaraBerkembangBiak extends ListActivity { String [] CaraBerkembangbiak = {

"OVIPAR","VIVIPAR","OVOVIVIPAR"}; @Override

public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState);

requestWindowFeature(Window.FEATURE_NO_TITLE);

setListAdapter(new ArrayAdapter<String> (this, android.R.layout.simple_list_item_1, CaraBerkembangbiak));

(10)

public void onListItemClick(ListView parent, View v, int position, long id)

{

Toast.makeText(this, "Anda telah memilih : " + CaraBerkembangbiak[position], Toast.LENGTH_LONG).show();

Intent i = new Intent(getApplication(), Hewan.class);

Bundle b = new Bundle();

Object o = this.getListAdapter().getItem(position); String pilihan = o.toString();

String nama_tabel="cara_kembang_biak"; String nama_database = "DBHewan"; String namaId;

if(pilihan.equals("OVIPAR")) {

namaId = "1";

b.putString("parse_nama", namaId); b.putString("parse_tabel", nama_tabel);

b.putString("parse_database", nama_database); }

else if(pilihan.equals("VIVIPAR")) {

namaId = "2";

b.putString("parse_nama", namaId); b.putString("parse_tabel", nama_tabel);

b.putString("parse_database", nama_database); }

else if(pilihan.equals("OVOVIVIPAR")) {

namaId = "3";

b.putString("parse_nama", namaId); b.putString("parse_tabel", nama_tabel);

b.putString("parse_database", nama_database); }

i.putExtras(b);

startActivity(i); }

(11)

7. JenisMakanan.Java

package aplikasiTA.winda;

import android.app.ListActivity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.view.Window;

import android.widget.ArrayAdapter; import android.widget.ListView; import android.widget.Toast;

public class JenisMakanan extends ListActivity {

String [] JenisMakanan = {

"HERBIVORA","CARNIVORA","OMNIVORA", "INSECTIVORA" }; @Override

public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState);

requestWindowFeature(Window.FEATURE_NO_TITLE);

setListAdapter (new ArrayAdapter<String> (this, android.R.layout.simple_list_item_1, JenisMakanan));

}

public void onListItemClick(ListView parent, View v, int position, long id) {

Toast.makeText(this, "Anda telah memilih : " +JenisMakanan[position], Toast.LENGTH_LONG).show();

Intent i = new Intent(getApplication(), Hewan.class);

Bundle b = new Bundle();

Object o = this.getListAdapter().getItem(position); String pilihan = o.toString();

String nama_tabel="jenis_makanan"; String nama_database = "DBHewan"; String namaId;

if(pilihan.equals("HERBIVORA")) {

namaId = "1";

b.putString("parse_nama", namaId); b.putString("parse_tabel", nama_tabel);

(12)

else if(pilihan.equals("CARNIVORA")) {

namaId = "2";

b.putString("parse_nama", namaId); b.putString("parse_tabel", nama_tabel);

b.putString("parse_database", nama_database); }

else if(pilihan.equals("OMNIVORA")) {

namaId = "3";

b.putString("parse_nama", namaId); b.putString("parse_tabel", nama_tabel);

b.putString("parse_database", nama_database); }

else if(pilihan.equals("INSECTIVORA")) {

namaId = "4";

b.putString("parse_nama", namaId); b.putString("parse_tabel", nama_tabel);

b.putString("parse_database", nama_database); }

i.putExtras(b); startActivity(i);

}}

8. CaraBergerak.Java

package aplikasiTA.winda;

import android.app.ListActivity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.view.Window;

import android.widget.ArrayAdapter; import android.widget.ListView; import android.widget.Toast;

public class CaraBergerak extends ListActivity {

(13)

@Override

public void onCreate (Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

requestWindowFeature(Window.FEATURE_NO_TITLE); setListAdapter(new ArrayAdapter<String>(this,

android.R.layout.simple_list_item_1, CaraBergerak)); }

public void onListItemClick(ListView parent, View v, int position, long id) {

Toast.makeText(this,"Anda telah memilih : " +CaraBergerak[position], Toast.LENGTH_LONG).show();

Intent i = new Intent(getApplication(), Hewan.class);

Bundle b = new Bundle();

Object o = this.getListAdapter().getItem(position); String pilihan = o.toString();

String nama_tabel="cara_gerak"; String nama_database = "DBHewan"; String namaId;

if(pilihan.equals("KAKI")) {

namaId = "1";

b.putString("parse_nama", namaId); b.putString("parse_tabel", nama_tabel);

b.putString("parse_database", nama_database); }

else if(pilihan.equals("SAYAP")) {

namaId = "2";

b.putString("parse_nama", namaId); b.putString("parse_tabel", nama_tabel);

b.putString("parse_database", nama_database); }

else if(pilihan.equals("PERUT")) {

namaId = "3";

b.putString("parse_nama", namaId); b.putString("parse_tabel", nama_tabel);

(14)

else if(pilihan.equals("SIRIP")) {

namaId = "4";

b.putString("parse_nama", namaId); b.putString("parse_tabel", nama_tabel);

b.putString("parse_database", nama_database); }

i.putExtras(b); startActivity(i); }

}

9. CaraBernafas.Java

package aplikasiTA.winda;

import android.app.ListActivity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.view.Window;

import android.widget.ArrayAdapter; import android.widget.ListView; import android.widget.Toast;

public class CaraBernafas extends ListActivity { String [] CaraBernafas = {

"INSANG","TRAKEA","KULIT","PARU","KULIT & PARU-PARU"};

@Override

public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState);

requestWindowFeature(Window.FEATURE_NO_TITLE); setListAdapter(new ArrayAdapter<String>

(this,android.R.layout.simple_list_item_1, CaraBernafas)); }

public void onListItemClick(ListView parent, View v, int position, long id) { Toast.makeText(this, "Anda memilih : "+ CaraBernafas[position], Toast.LENGTH_LONG).show();

(15)

Bundle b = new Bundle();

Object o = this.getListAdapter().getItem(position); String pilihan = o.toString();

String nama_tabel="cara_bernafas"; String nama_database = "DBHewan"; String namaId;

if(pilihan.equals("INSANG")) {

namaId = "1";

b.putString("parse_nama", namaId); b.putString("parse_tabel", nama_tabel);

b.putString("parse_database", nama_database); }

else if(pilihan.equals("TRAKEA")) {

namaId = "2";

b.putString("parse_nama", namaId); b.putString("parse_tabel", nama_tabel);

b.putString("parse_database", nama_database); }

else if(pilihan.equals("KULIT")) {

namaId = "3";

b.putString("parse_nama", namaId); b.putString("parse_tabel", nama_tabel);

b.putString("parse_database", nama_database); }

else if(pilihan.equals("PARU-PARU")) {

namaId = "4";

b.putString("parse_nama", namaId); b.putString("parse_tabel", nama_tabel);

b.putString("parse_database", nama_database); }

else if(pilihan.equals("KULIT & PARU-PARU")) {

namaId = "5";

b.putString("parse_nama", namaId); b.putString("parse_tabel", nama_tabel);

(16)

i.putExtras(b); startActivity(i); } }

10.TempatHidup.Java

package aplikasiTA.winda;

import android.app.ListActivity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.view.Window;

import android.widget.ArrayAdapter; import android.widget.ListView; import android.widget.Toast;

public class TempatHidup extends ListActivity{ String [] TempatHidup = {

"Hidup di Darat","Hidup di Air","Hidup di Dua Alam" }; @Override

public void onCreate (Bundle savedInstanceState) { super.onCreate(savedInstanceState);

requestWindowFeature(Window.FEATURE_NO_TITLE); setListAdapter(new ArrayAdapter <String>

(this,android.R.layout.simple_list_item_1,TempatHidup)); }

public void onListItemClick(ListView parent, View v, int position, long id) { Toast.makeText(this,"Anda telah memilih : "+TempatHidup[position], Toast.LENGTH_LONG).show();

Intent i = new Intent(getApplication(), Hewan.class);

Bundle b = new Bundle();

Object o = this.getListAdapter().getItem(position); String pilihan = o.toString();

String nama_tabel="tempathidup"; String nama_database = "DBHewan"; String namaId;

if(pilihan.equals("Hidup di Darat")) {

namaId = "1";

(17)

b.putString("parse_tabel", nama_tabel);

b.putString("parse_database", nama_database); }

else if(pilihan.equals("Hidup di Air")) {

namaId = "2";

b.putString("parse_nama", namaId); b.putString("parse_tabel", nama_tabel);

b.putString("parse_database", nama_database); }

else if(pilihan.equals("Hidup di Dua Alam")) {

namaId = "3";

b.putString("parse_nama", namaId); b.putString("parse_tabel", nama_tabel);

b.putString("parse_database", nama_database); }

i.putExtras(b); startActivity(i); } }

11.PenutupTubuh.Java

package aplikasiTA.winda;

import android.app.ListActivity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.view.Window;

import android.widget.ArrayAdapter; import android.widget.ListView; import android.widget.Toast;

public class PenutupTubuh extends ListActivity { String [] PenutupTubuh = {

"KULIT","SISIK","BULU", "RAMBUT", "CANGKANG"}; @Override

public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);

(18)

setListAdapter(new ArrayAdapter<String> (this,android.R.layout.simple_list_item_1, PenutupTubuh));

}

public void onListItemClick(ListView parent, View v,int position, long id) { Toast.makeText(this,"Anda telah memilih : "+PenutupTubuh[position], Toast.LENGTH_LONG).show();

Intent i = new Intent(getApplication(), Hewan.class);

Bundle b = new Bundle();

Object o = this.getListAdapter().getItem(position); String pilihan = o.toString();

String nama_tabel="penutup_tubuh"; String nama_database = "DBHewan"; String namaId;

if(pilihan.equals("KULIT")) {

namaId = "1";

b.putString("parse_nama", namaId); b.putString("parse_tabel", nama_tabel);

b.putString("parse_database", nama_database); }

else if(pilihan.equals("SISIK")) {

namaId = "2";

b.putString("parse_nama", namaId); b.putString("parse_tabel", nama_tabel);

b.putString("parse_database", nama_database); }

else if(pilihan.equals("BULU")) {

namaId = "3";

b.putString("parse_nama", namaId); b.putString("parse_tabel", nama_tabel);

b.putString("parse_database", nama_database); }

else if(pilihan.equals("RAMBUT")) {

namaId = "4";

b.putString("parse_nama", namaId); b.putString("parse_tabel", nama_tabel);

(19)

else if(pilihan.equals("CANGKANG")) {

namaId = "5";

b.putString("parse_nama", namaId); b.putString("parse_tabel", nama_tabel);

b.putString("parse_database", nama_database); }

i.putExtras(b); startActivity(i); } }

12.DBhelper.Java

package aplikasiTA.winda;

import java.io.ByteArrayOutputStream; import android.content.ContentValues; import android.content.Context; import android.database.Cursor;

import android.database.SQLException;

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_IMG = "gambar";

public static final String KEY_KETERANGAN = "keterangan"; public static final String KEY_CIRI = "ciri_ciri";

private DatabaseHelper mDbHelper; private SQLiteDatabase mDb;

private static final String HEWAN_TABLE = "avertebrata"; private static final String HEWAN_TABLE2 = "vertebrata";

(20)

private static final String DATABASE_NAME = "DBHewan"; private static final int DATABASE_VERSION = 1;

private static final String CREATE_HEWAN_TABLE = "create table "+HEWAN_TABLE+" ("

+KEY_ID+" integer primary key autoincrement, " +KEY_NAME+" text not null, "

+KEY_IMG+" blob not null,"

+KEY_KETERANGAN+" text not null, " +KEY_CIRI+" text not null);";

private static final String CREATE_HEWAN_TABLE2 = "create table "+HEWAN_TABLE2+" ("

+KEY_ID+" integer primary key autoincrement, " +KEY_NAME+" text not null, "

+KEY_IMG+" blob not null,"

+KEY_KETERANGAN+" text not null, " +KEY_CIRI+" text not null);";

private static final String CREATE_HEWAN_TABLE3 = "create table "+HEWAN_TABLE3+" ("

+KEY_ID+" integer primary key autoincrement, " +KEY_NAME+" text not null, "

+KEY_IMG+" blob not null,"

+KEY_KETERANGAN+" text not null, " +KEY_CIRI+" text not null);";

private static final String CREATE_HEWAN_TABLE4 = "create table "+HEWAN_TABLE4+" ("

+KEY_ID+" integer primary key autoincrement, " +KEY_NAME+" text not null, "

+KEY_IMG+" blob not null,"

+KEY_KETERANGAN+" text not null, " +KEY_CIRI+" text not null);";

private static final String CREATE_HEWAN_TABLE5 = "create table "+HEWAN_TABLE5+" ("

+KEY_ID+" integer primary key autoincrement, " +KEY_NAME+" text not null, "

+KEY_IMG+" blob not null,"

+KEY_KETERANGAN+" text not null, " +KEY_CIRI+" text not null);";

private static final String CREATE_HEWAN_TABLE6 = "create table "+HEWAN_TABLE6+" ("

(21)

+KEY_NAME+" text not null, " +KEY_IMG+" blob not null,"

+KEY_KETERANGAN+" text not null, " +KEY_CIRI+" text not null);";

private static final String CREATE_HEWAN_TABLE7 = "create table "+HEWAN_TABLE7+" ("

+KEY_ID+" integer primary key autoincrement, " +KEY_NAME+" text not null, "

+KEY_IMG+" blob not null,"

+KEY_KETERANGAN+" text not null, " +KEY_CIRI+" text not null);";

private static final String CREATE_HEWAN_TABLE8 = "create table "+HEWAN_TABLE8+" ("

+KEY_ID+" integer primary key autoincrement, " +KEY_NAME+" text not null, "

+KEY_IMG+" blob not null,"

+KEY_KETERANGAN+" text not null, " +KEY_CIRI+" text 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_HEWAN_TABLE); db.execSQL(CREATE_HEWAN_TABLE2); db.execSQL(CREATE_HEWAN_TABLE3); db.execSQL(CREATE_HEWAN_TABLE4); db.execSQL(CREATE_HEWAN_TABLE5); db.execSQL(CREATE_HEWAN_TABLE6); db.execSQL(CREATE_HEWAN_TABLE7); db.execSQL(CREATE_HEWAN_TABLE8); }

public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { // db.execSQL("DROP TABLE IF EXISTS "+Hewanku_TABLE);

// onCreate(db); }

(22)

public void Reset() { mDbHelper.onUpgrade(this.mDb, 1, 1); }

public DBhelper open() throws SQLException { mDb = mDbHelper.getWritableDatabase();

public void hewanEntry(Hewanku testTokoh, String tabel) { ByteArrayOutputStream out = new ByteArrayOutputStream();

testTokoh.getBitmap().compress(Bitmap.CompressFormat.PNG, 100, out); ContentValues cv = new ContentValues();

cv.put(KEY_NAME, testTokoh.getNama()); cv.put(KEY_IMG, out.toByteArray());

cv.put(KEY_KETERANGAN, testTokoh.getKeterangan()); cv.put(KEY_CIRI, testTokoh.getCiri_ciri());

mDb.insert(tabel, null, cv); }

public Hewanku getFirstHewankuFromDB(String tabel, String namaId) throws SQLException {

Cursor cur = mDb.query(true, tabel,

new String[] {KEY_ID, KEY_NAME, KEY_IMG, KEY_KETERANGAN, KEY_CIRI},

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 name = cur.getString(cur.getColumnIndex(KEY_NAME)); Bitmap bmp = BitmapFactory.decodeByteArray(blob, 0, blob.length);

String keterangan = cur.getString(cur.getColumnIndex(KEY_KETERANGAN)); String ciri = cur.getString(cur.getColumnIndex(KEY_CIRI));

cur.close();

(23)

cur.close(); return null; }

public void deleteRow(String nilai) {

try{

//mDb.delete(Hewanku_TABLE, KEY_ID + "= " +3, null); }catch(Exception e){

e.printStackTrace(); }

}

// TODO Auto-generated method stub

}

13.Hewan.Java

package aplikasiTA.winda;

import android.app.Activity;

import android.database.SQLException; import android.os.Bundle;

import android.view.Window; import android.widget.ImageView; import android.widget.TextView;

public class Hewan extends Activity { private DBhelper Dbhelper ;

@Override

public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState);

requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.hewan);

Dbhelper= new DBhelper (this); String namaId, tabel;

(24)

Hewanku testing = new Hewanku (); try{

Dbhelper.open();testing = Dbhelper.getFirstHewankuFromDB(tabel, namaId); TextView textnama, textketerangan, textciri;

textnama =(TextView)findViewById(R.id.TextView01); textnama.setText("" +testing.getNama());

ImageView image ;

image = (ImageView)findViewById(R.id.ImageView01); image.setImageBitmap(testing.getBitmap());

textketerangan = (TextView)findViewById(R.id.TextView02); textketerangan.setText("" +testing.getKeterangan());

textciri = (TextView) findViewById(R.id.TextView03); textciri.setText("Ciri-Ciri : " +testing.getCiri_ciri()); }catch (SQLException e1){

e1.printStackTrace(); }

Dbhelper.close(); }}

14.Hewanku.Java

package aplikasiTA.winda;

import android.graphics.Bitmap;

public class Hewanku {

private Bitmap gambar; private String nama; private String keterangan; private String ciri_ciri; private String id;

public Hewanku (){ }

public Hewanku (String i, String n , Bitmap g, String k, String c) { gambar = g;

id = i; ciri_ciri = c ; nama = n;

(25)

public Bitmap getBitmap(){return gambar;} public String getNama(){return nama;}

public String getKeterangan(){return keterangan;} public String getCiri_ciri(){return ciri_ciri;} public String getId () {return id;}

}

15.SplashScreen.Java

package aplikasiTA.winda;

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 SplashScreen extends Activity { MediaPlayer suaraSplash;

@Override

protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub

super.onCreate(savedInstanceState);

requestWindowFeature(Window.FEATURE_NO_TITLE);

getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);

setContentView (R.layout.splashscreen);

suaraSplash = MediaPlayer.create(this, R.raw.burung); suaraSplash.start();

Thread timer = new Thread(){ public void run(){

try {

sleep(4500); } catch (InterruptedException e) {

// TODO Auto-generated catch block e.printStackTrace();

}

(26)

Intent i = new Intent(SplashScreen.this, Main.class); 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(); }

}

16.dashboard.xml

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

<AbsoluteLayout

android:id="@+id/widget0"

android:layout_width="fill_parent" android:layout_height="fill_parent"

(27)

<TextView

android:id="@+id/widget27"

android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="APLIKASI PEMBELAJARAN" android:textSize="23sp"

android:textStyle="bold" android:textColor="#ffff3366" android:layout_x="13px"

android:layout_y="75px"></TextView>

<TextView

android:id="@+id/widget28"

android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="KLASIFIKASI HEWAN" android:textSize="23sp"

android:textStyle="bold" android:textColor="#ffff3366" android:layout_x="28px"

android:layout_y="100px"></TextView>

<Button

android:id="@+id/Button02" android:layout_width="125px" android:layout_height="40px" android:text="KELUAR" android:textSize="16sp" android:textStyle="bold" android:textColor="#ffff" android:layout_x="100px" android:layout_y="270px"

android:background="@drawable/btn_menu"></Button>

<Button

android:id="@+id/Button01" android:layout_width="125px" android:layout_height="40px" android:text="MARI BELAJAR" android:textSize="16sp"

android:textStyle="bold" android:textColor="#ffff" android:layout_x="100px" android:layout_y="190px"

(28)

17.header.xml

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" style="@style/HeaderStyle" >

<TextView

android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:gravity="center"

android:text="Pembelajaran Klasifikasi Hewan" android:textColor="#ffffff"

android:textSize="20dip" android:textStyle="bold" android:typeface="sans"

android:background="@drawable/list_btn3" />

</LinearLayout>

18.tulang_belakang.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" android:background="@drawable/background">

<Button

android:id="@+id/Button01" android:layout_width="165px" android:layout_height="47px" android:text="AVERTEBRATA" android:textStyle="bold" android:textSize="18sp" android:textColor="#ff0000cc" android:layout_x="100px" android:layout_y="100px"

android:background="@drawable/btn_tulang"></Button>

<Button

(29)

android:text="VERTEBRATA" android:textStyle="bold" android:textColor="#ff0000cc" android:textSize="18sp" android:layout_x="100px" android:layout_y="170px"

android:background="@drawable/btn_tulang"></Button>

</AbsoluteLayout>

19.panel_tulang_layout.xml

<LinearLayout

xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/home_root"

android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="match_parent">

<include layout="@layout/header"/>

<include layout="@layout/tulang_belakang"/>

</LinearLayout>

20.hewan.xml

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

<AbsoluteLayout

xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent"

android:layout_height="fill_parent" android:orientation="vertical">

<TextView

android:text="@+id/TextView01" android:id="@+id/TextView01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_x="5dip"

android:layout_y="1dip" android:textSize="18sp" android:textStyle="bold"

(30)

<ImageView

android:id="@+id/ImageView01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_x="74dip"

android:layout_y="35dip"></ImageView>

<TextView

android:text="@+id/TextView02" android:id="@+id/TextView02" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_y="125dip"

android:typeface="monospace"></TextView>

<TextView

android:text="@+id/TextView03" android:id="@+id/TextView03" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_y="275dip"

android:typeface="monospace"></TextView>

</AbsoluteLayout>

21.splashscreen.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" android:orientation="vertical">

<ImageView

android:id="@+id/ImageView01"

android:background ="@drawable/splash2" android:layout_width="wrap_content"

android:layout_height="wrap_content"></ImageView>

(31)

22.style.xml

<resources>

<style name="AppTheme" parent="android:Theme.Light" />

<style name="HeaderStyle">

<item name="android:layout_width">fill_parent</item> <item name="android:layout_height">wrap_content</item> <item name="android:orientation">horizontal</item> </style>

<style name="FooterStyle">

<item name="android:layout_width">fill_parent</item> <item name="android:layout_height">wrap_content</item> <item name="android:orientation">horizontal</item> <item name="android:layout_gravity">bottom</item> </style>

<style name="DashboardButton">

<item name="android:layout_gravity">center_vertical</item> <item name="android:layout_width">wrap_content</item> <item name="android:layout_height">wrap_content</item> <item name="android:gravity">center_horizontal</item> <item name="android:drawablePadding">2dp</item> <item name="android:textSize">14dp</item>

<item name="android:textStyle">bold</item> <item name="android:textColor">#272829</item> <item name="android:background">@null</item> </style>

</resources>

23.AndroidManifest.xml

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

<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="aplikasiTA.winda"

android:versionCode="1" android:versionName="1.0">

<uses-sdk android:minSdkVersion="8" />

(32)

<activity android:name=".SplashScreen" android:label="@string/app_name">

<intent-filter>

<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" /> </intent-filter>

</activity>

<activity android:name=".MenuKlasifikasi"></activity> <activity android:name=".Avertebrata"></activity> <activity android:name=".Vertebrata"></activity> <activity android:name=".CaraBernafas"></activity>

<activity android:name=".CaraBerkembangBiak"></activity> <activity android:name=".CaraBergerak"></activity>

<activity android:name=".JenisMakanan"></activity> <activity android:name=".PenutupTubuh"></activity> <activity android:name=".TempatHidup"></activity> <activity android:name=".TulangBelakang"></activity> <activity android:name=".DBhelper"></activity> <activity android:name=".Hewan"></activity> <activity android:name=".Hewanku"></activity>

<activity android:name="Main" android:label="@string/app_name"></activity>

</application>

Referensi

Dokumen terkait

”Penggunaan Limbah Pertanian Sebagai Biofumigan untuk mengendalikan Nematoda Puru Akar (Meloidogynespp.) pada Tanaman Kentang ”. Dibimbing oleh Lisnawita dan

&#34;roses pengeluaran sputum dari paruparu, bronkus dan trakea yang dihasilkan oleh klien &#34;roses pengeluaran sputum dari paruparu, bronkus dan trakea yang dihasilkan oleh

analyze and identify entrepreneur behaviour on business performance especially to Small Medium Enterprise (SMEs) banana processing in South Garut.. The study was

Kondisi SM Rimbang Baling sangat memprihatinkan saat ini, dan sangat disayangkan jika pada akhirnya, pemasalahan yang terjadi di kawasan konservasi menyebabkan

Supervisi dalam rangka sistem Kerja LAKU SUSI di provinsi dilakukan secara terpadu untuk mengideniikasi dan memecahkan masalah laihan di BP3K dan kunjungan penyuluh

1.4.2.3 Mengidentifikasi spiritualitas anak dalam hubungan anak orang lain. 1.4.2.4 Mengidentifikasi spiritualitas anak dalam hubungan

Definisi Cyber extension menurut (Mulyandari 2011) merupakan salah satu mekanisme pembangunan jaringan komunikasi inovasi pertanian yang terprogram secara efektif

Pada saat Peraturan Daerah ini mulai berlaku, Peraturan Daerah Kabupaten Nomor 7 Tahun 2001 tentang Retribusi dan Sewa Pemakaian Kekayaan Daerah (Lembaran Daerah