Friday, April 25, 2014

Membuat Listview | Tutorial Android

Membuat Listview | Tutorial Android - Hello friend Panduan SEO | Panduan SEO terlengkap tuk pemula yang ingin mulai belajar SEO. Panduan gratis ini meningkatkan pengunjung ke situs anda. On this article you read this time with the title Membuat Listview | Tutorial Android , We have prepared this article well for you to read and take the information in it. hopefully the contents of the post Articles Tutorial Android, That we write this you can understand. okay, happy reading.

Title : Membuat Listview | Tutorial Android
links : Membuat Listview | Tutorial Android

Read also


Membuat Listview | Tutorial Android

Berikut adalah 'tutorial membuat Listview di Android'. Adapun tahap-tahapnya seperti berikut :
1. Buat projek baru dan beri nama 'ListView'
2. Buat kode program pada 'activity_main.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:orientation="vertical">

    <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="@string/hello_world"
        tools:context=".MainActivity"/>
   
    <ListView
        android:id="@+id/lv"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        ></ListView>


</LinearLayout>


3.  Selanjutnya buat kode program pada 'MainActivity.java'

import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.Toast;
import android.app.ListActivity;

public class MainActivity extendsListActivity {

      String[] hewan = new String[] {"Anjing", "Kucing", "Kuda", "Beruang", "Tikus"};
      public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        this.setListAdapter(newArrayAdapter<String>(this, android.R.layout.simple_list_item_1, hewan));
        //setContentView(R.layout.activity_main);
       
    }

      protected voidonListItemClick(ListView l, View v, int position, long id) {
            Toast.makeText(this, "Membuka Form " + hewan[position], Toast.LENGTH_LONG).show();
      }   
}


4. RUN dan lihat hasilnya...






Thus the article Membuat Listview | Tutorial Android

That's an article Membuat Listview | Tutorial Android This article will be useful for you all. okay, see you in other article posting. Do not forget to keep visiting on Panduan SEO | Blogger, Tips , Adsense, Google.

You are now reading the article Membuat Listview | Tutorial Android with the link address https://belajarpanduanseo.blogspot.com/2014/04/membuat-listview-tutorial-android.html


Do not forget to share ^_^ because sharing is caring and I'm waiting for your comment




EmoticonEmoticon