• Solo Great Sale

    Solo Great Sale Powered By Circle Card 2015

  • Solo Great Sale

    Solo Great Sale Powered By Circle Card 2015

  • Oracle Java Magazine

    As Cover of Oracle Java Magazine March/April 2012 issue

  • Launching jDuchess Indonesia

    Gunadarma University 2011

    www.jduchess.or.id

  • Launching jDuchess Indonesia

    Gunadarma University 2011

    www.jduchess.or.id

  • Launching Java 7

    Binus University 2011

  • Eclipse Democamp

    Microsoft Indonesia 2011

  • Oracle Academy

    SMK PGRI 3 Malang 2010

  • Launching JENI 2.0

    ITB Bandung 2012

  • Oracle Academy

    SMK PGRI 3 Malang 2010

  • Java and Android Roadshow

    SMK PGRI 3 Malang 2012

  • Oracle Academy

    SMK PGRI 3 Malang 2010

  • Launching JENI 2.0

    ITB Bandung 2012

  • Oracle Academy

    SMK PGRI 3 Malang 2011

  • Java and Android Roadshow

    SMK Plus Darussalam Kediri 2012

  • Oracle Academy Seminar

    LIKMI Bandung, 2012

  • Oracle Academy Seminar

    Indonesia University, 2012

  • Seminar Android

    Universitas Budi Luhur 2010

  • Java and Android Roadshow

    SMK Hasan Kafrawi Jepara 2012

  • Sosialisasi Kurikulum 2013

    LPMP Surabaya 2013

  • IOSA

    Indonesia Open Source Award 2011

  • Java Training

    SMKN 02 Sukabumi 2010

  • Sosialisasi Kurikulum

    SMKN 01 Tulungagung 2011

  • Sosialisasi Kurikulum 2013

    LPMP Surabaya 2013

Monday, April 2, 2012

Posted by Netty Herawaty
| 3:12 PM
Dashboard adalah menu utama yang biasanya diletakkan di halaman paling depan yang berfungsi sebagai navigasi user. Activity yang dibutuhkan untuk membuat dashboard kali ini adalah :

a. Dashboard.java
b. Home.java
c. MyProfile.java
d. EducationHistory.java
e. JobHistory.java
f. Contact.java

Dashboard.java

packageandroid.example.dashboard;

importandroid.app.Activity;

importandroid.content.Context;

importandroid.content.Intent;

importandroid.os.Bundle;

importandroid.util.Log;

importandroid.view.View;

importandroid.widget.TextView;

importandroid.widget.Toast;

public abstract classDashboard extendsActivity {

protected voidonCreate(Bundle savedInstanceState)

{

super.onCreate(savedInstanceState);

}

protected voidonDestroy (){

super.onDestroy ();

}

protected voidonPause ()

{

super.onPause ();

}

protected voidonRestart ()

{

super.onRestart ();

}

protected voidonResume ()

{

super.onResume ();

}

protected voidonStart ()

{

super.onStart ();

}

protected voidonStop ()

{

super.onStop ();

}

public voidonClickHome (View v)

{

goHome (this);

}

public voidonClickFeature (View v)

{

intid = v.getId ();

caseR.id.home_btn_feature1:

startActivity (newIntent(getApplicationContext(), MyProfile.class));

break;

caseR.id.home_btn_feature2:

startActivity (newIntent(getApplicationContext(), EducationHistory.class));

break;

caseR.id.home_btn_feature3:

startActivity (newIntent(getApplicationContext(), JobHistory.class));

break;

caseR.id.home_btn_feature4:

startActivity (newIntent(getApplicationContext(), Contact.class));

break;

default:

break;

}

}

public voidgoHome(Context context)

{

finalIntent intent = newIntent(context, Home.class);

intent.setFlags (Intent.FLAG_ACTIVITY_CLEAR_TOP);

context.startActivity (intent);

}

public voidsetTitleFromActivityLabel (inttextViewId)

{

TextView tv = (TextView) findViewById (textViewId);

if(tv != null) tv.setText (getTitle ());

}

public voidtoast (String msg)

{

Toast.makeText(getApplicationContext(), msg, Toast.LENGTH_SHORT).show ();

}

public voidtrace (String msg)

{

Log.d("Demo", msg);

toast (msg);

}

}

Home.java

packageandroid.example.dashboard;

importandroid.os.Bundle;

public classHome extendsDashboard {

protected voidonCreate(Bundle savedInstanceState)

{

super.onCreate(savedInstanceState);

setContentView(R.layout.home);

}

protected voidonDestroy ()

{

super.onDestroy ();

}

protected voidonPause ()

{

super.onPause ();

}

protected voidonRestart ()

{

super.onRestart ();

}

protected voidonResume ()

{

super.onResume ();

}

protected voidonStart ()

{

super.onStart ();

}

protected voidonStop ()

{

super.onStop ();

}

}

MyProfile.java

packageandroid.example.dashboard;

importandroid.os.Bundle;

public classMyProfile extendsDashboard

{

protected voidonCreate(Bundle savedInstanceState)

{

super.onCreate(savedInstanceState);

setContentView (R.layout.form1_myprofile);

setTitleFromActivityLabel (R.id.title_text);

}

}

EducationHistory.java

packageandroid.example.dashboard;

importandroid.os.Bundle;

public classEducationHistory extendsDashboard {

protected voidonCreate(Bundle savedInstanceState)

{

super.onCreate(savedInstanceState);

setContentView (R.layout.form2_educationhistory);

setTitleFromActivityLabel (R.id.title_text);

}

}

JobHistory.java

packageandroid.example.dashboard;

importandroid.os.Bundle;

public classJobHistory extendsDashboard

{

protected voidonCreate(Bundle savedInstanceState)

{

super.onCreate(savedInstanceState);

setContentView (R.layout.form3_jobhistory);

setTitleFromActivityLabel (R.id.title_text);

}

}

Contact.java

packageandroid.example.dashboard;

importandroid.os.Bundle;

public classContact extendsDashboard {

protected voidonCreate(Bundle savedInstanceState)

{

super.onCreate(savedInstanceState);

setContentView (R.layout.form4_contact);

setTitleFromActivityLabel (R.id.title_text);

}

}

Membuat Title Dashboard

Untuk semua penamaan title Dashboard dibuat di src/res/values/string.xml
<?xml version="1.0" encoding="utf-8"?>

<resources>

<string name="hello">Choose one of the features below.</string>

<string name="app_name">DashboardDemo</string>

<string name="description_logo">Demo</string>

<string name="description_home">Home</string>

<string name="description_feature1">My Profile</string>

<string name="description_feature2">Education History</string>

<string name="description_feature3">Job History</string>

<string name="description_feature4">Contact</string>

<string name="title_home">Home</string>

<string name="title_feature1">My Profile</string>

<string name="title_feature2">Education History</string>

<string name="title_feature3">Job History</string>

<string name="title_feature4">Contact</string>

</resources>

Membuat Layout Dashboard

Layout  adalah  rancangan  antarmuka  (user  interface)  pada  sebuah  activity.  Android menyediakan XML untuk memudahkan pembuatan layout. Berkas layout XML secara otomatis terhubung dengan kelas view. Kelebihan membuat layout dengan menggunakan XML adalah kita dapat memisahkan antara tampilan dengan kode program. File XML bisa dibuat di src/res/layout. 

Layout yang dibutuhkan untuk membuat aplikasi android dashboard ini adalah :
a. home.xml
b. form1_myprofile.xml
c. form2_educationhistory.xml
d. form3_jobhistory.xml
e. form4_contact.xml

a. home.xml

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

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"

android:id="@+id/db1_root"

android:orientation="vertical"

android:layout_width="fill_parent"

android:layout_height="fill_parent">

<LinearLayout style="@style/TitleBar">

<ImageView style="@style/TitleBarLogo"

android:contentDescription="@string/description_logo"

android:src="@drawable/title_logo" />

<ImageView style="@style/TitleBarSeparator" />

<TextView style="@style/TitleBarText" />

</LinearLayout>

<LinearLayout

android:orientation="vertical"

android:layout_width="fill_parent"

android:layout_height="wrap_content"

android:layout_weight="1"

android:padding="6dip">

<LinearLayout

android:orientation="horizontal"

android:layout_width="fill_parent"

android:layout_height="wrap_content"

android:layout_weight="1">

<Button android:id="@+id/home_btn_feature1"

style="@style/HomeButton"

android:onClick="onClickFeature"

android:text="@string/title_feature1"

android:drawableTop="@drawable/home_button1"/>

<Button android:id="@+id/home_btn_feature2"

style="@style/HomeButton"

android:onClick="onClickFeature"

android:text="@string/title_feature2"

android:drawableTop="@drawable/home_button2"/>

</LinearLayout>

<LinearLayout

android:orientation="horizontal"

android:layout_width="fill_parent"

android:layout_height="wrap_content"

android:layout_weight="1">

<Button android:id="@+id/home_btn_feature3"

style="@style/HomeButton"

android:onClick="onClickFeature"

android:text="@string/title_feature3"

android:drawableTop="@drawable/home_button3"/>

<Button android:id="@+id/home_btn_feature4"

style="@style/HomeButton"

android:onClick="onClickFeature"

android:text="@string/title_feature4"

android:drawableTop="@drawable/home_button4"/>

</LinearLayout>

</LinearLayout>

</LinearLayout>

form1_myprofile.xml

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

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"

android:orientation="vertical"

android:layout_width="fill_parent"

android:layout_height="wrap_content"

>

<LinearLayout style="@style/TitleBar">

<ImageButton style="@style/TitleBarAction"

android:contentDescription="@string/description_home"

android:src="@drawable/title_home"

android:onClick="onClickHome" />

<ImageView style="@style/TitleBarSeparator" />

<TextView style="@style/TitleBarText" />

</LinearLayout>

<TextView

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text= "Nick Name : Nety"

/>

<TextView

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text="Full Name : Nety Herawaty"

/>

<TextView

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text="Place of Birth : Malang"

/>

<TextView

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text="Date of Birth : August, 28th 1993"

/>

<TextView

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text="Blood Type : A"

/>

<TextView

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text="Weight  : 49 kg"

/>

<TextView

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text="Height : 163 cm"

/>

<TextView

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text="Hometown : Malang"

/>

<TextView

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text="Current City : Jakarta"

/>

<TextView

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text="Address : Jl.Swadaya II No 39 Cempaka Baru"

/>

<TextView

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text=" Kemayoran - Jakarta Pusat"

/>

</LinearLayout>

form2_educationhistory.xml

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

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"

android:orientation="vertical"

android:layout_width="fill_parent"

android:layout_height="wrap_content"

>

<LinearLayout style="@style/TitleBar">

<ImageButton style="@style/TitleBarAction"

android:contentDescription="@string/description_home"

android:src="@drawable/title_home"

android:onClick="onClickHome" />

<ImageView style="@style/TitleBarSeparator" />

<TextView style="@style/TitleBarText" />

</LinearLayout>

<TextView

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text="1. SDN 04 Tirtomarto (1999-2005)"

/>

<TextView

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text="2. SMPN 01 Turen (2005-2008)"

/>

<TextView

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text="3. SMK PGRI 03 Malang (2008-2011)"

/>

<TextView

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text="4. Gunadarma University (2011-current)"

/>

</LinearLayout>

form3_jobhistory.xml

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

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"

android:orientation="vertical"

android:layout_width="fill_parent"

android:layout_height="wrap_content"

>

<LinearLayout style="@style/TitleBar">

<ImageButton style="@style/TitleBarAction"

android:contentDescription="@string/description_home"

android:src="@drawable/title_home"

android:onClick="onClickHome" />

<ImageView style="@style/TitleBarSeparator" />

<TextView style="@style/TitleBarText" />

</LinearLayout>

<TextView

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text="1. Meruvian Foundation"

/>

<TextView

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text=" Position : Software Developer,(Bizdev)"

/>

<TextView

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text=" Bussiness Development"

/>

<TextView

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text=" June 2011 - current"

/>

<TextView

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text=""

/>

<TextView

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text="2. MIT (Marketing Innovation Technology)"

/>

<TextView

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text=" Position : Mockup Designer"

/>

<TextView

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text=" January 2012 - current"

/>

</LinearLayout>

form4_contact.xml

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

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"

android:orientation="vertical"

android:layout_width="fill_parent"

android:layout_height="wrap_content"

>

<LinearLayout style="@style/TitleBar">

<ImageButton style="@style/TitleBarAction"

android:contentDescription="@string/description_home"

android:src="@drawable/title_home"

android:onClick="onClickHome" />

<ImageView style="@style/TitleBarSeparator" />

<TextView style="@style/TitleBarText" />

</LinearLayout>

<TextView

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text="1. Mobile Phone"

/>

<TextView

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text=" 089630370498"

/>

<TextView

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text=""

/>

<TextView

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text="2. EMAIL"

/>

<TextView

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text=" nety.ozora@yahoo.com"

/>

<TextView

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text=" netoya93@gmail.com"

/>

<TextView

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text=" nety.herawaty@meruvian.org"

/>

<TextView

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text=" nety.herawaty@mandraguna.com"

/>

<TextView

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text=" nety.herawaty@jtechnopreneur.com"

/>

<TextView

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text=""

/>

<TextView

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text="3. FACEBOOK"

/>

<TextView

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text=" www.facebook.com/netoya.ozora"

/>

<TextView

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text=""

/>

<TextView

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text="4. TWITTER"

/>

<TextView

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text=" www.twitter.com/netoya.ozora"

/>

<TextView

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text=""

/>

<TextView

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text="5. YM"

/>

<TextView

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text=" nety.ozora"

/>

<TextView

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text=""

/>

<TextView

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text="6. FAN PAGE"

/>

<TextView

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text=" www.facebook.com/jduchessid"

/>

</LinearLayout>

Menyimpan Icon Dashboard

Untuk menyimpan icon Dashboard, gambar diletakkan di src/res/drawable

Android Manifest

Semua class harus didefinisikan terlebih dahulu di Android Manifest.xml 
<?xml version="1.0" encoding="utf-8"?>

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

android:versionCode="1"

android:versionName="1.0" package="android.example.dashboard">

<application

android:theme="@style/Theme.D1"

android:icon="@drawable/icon"

android:label="@string/app_name">

<activity android:name=".Home"

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=".MyProfile"

android:theme="@style/Theme.D1"

android:label="@string/title_feature1"

/>

<activity android:name=".EducationHistory"

android:theme="@style/Theme.D1"

android:label="@string/title_feature2"

/>

<activity android:name=".JobHistory"

android:theme="@style/Theme.D1"

android:label="@string/title_feature3"

/>

<activity android:name=".Contact"

android:theme="@style/Theme.D1"

android:label="@string/title_feature4"

/>

</application>

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

</manifest>

Menjalankan Android Dashboard

Untuk menjalankan aplikasi Android Dashboard caranya klik kanan project → Run As →Android Project


Hasil

1. Android Dashboard Home

adalah menu dashboard ketika pertama kali tampil di android emulator


2. Menu Profile

Ketika menu dashboard My Profile ditekan, maka akan tampil informasi profile


3. Menu Education History

Ketika menu dashboard Education History ditekan, akan tampil informasi riwayat pendidikan


4. Menu Job History

Ketika menu dashboard Job History ditekan, maka akan tampil informasi riwayat pekerjaan

5. Menu Contact

Ketika menu dashboard Education History ditekan, maka akan tampil informasi contact




Reactions: