Anda di halaman 1dari 7

Membuat Auto Complete | Diskusi Android

http://diskusiandroid.com/membuat-auto-complete-t209.html

Skip to content

Advanced search Board index Developer Android Tutorial Basic Android Change font size E-mail friend Print view User Control Panel View your posts FAQ Members Logout [ deky ]

Membuat Auto Complete


Post a reply

14 posts Page 1 of 3 1, 2, 3 Report this post Reply with quote

Membuat Auto Complete


by BluRay March 23rd, 2011, 5:29 pm Tingkat : Pemula Materi : membuat Auto complete di android Pengen bagi-bagi ilmu nih om-om... :dance: izin sharing yaa..

0 new messages Last visit was: May 23rd, 2012, 10:06 am

1 of 7

5/23/2012 12:05 PM

Membuat Auto Complete | Diskusi Android

http://diskusiandroid.com/membuat-auto-complete-t209.html

Ok... first thing to do.. cei lee hahaa 1. Buat project seperti biasa.,, new Android Project dll... 2. Buka main.xml di folder /res/layout/. Di main.xml kita tambahkan Widget AutoCompleteTextView.

Code: Select all


<AutoCompleteTextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/auto" />

3. Kembali lagi ke Main.java,. nah di java kita deklarasikan 3 hal,, yaitu.. String, AutoCompleteTextView dan ArrayAdapter. 4. AutoCompleteTextView akan menampilkan Array dimana Array mengambil String Array. 5. Buat dulu String array. Code: Select all
String [] data = {"cicak","cacing","cumi"};

0 new messages Last visit was: May 23rd, 2012, 10:06 am

2 of 7

5/23/2012 12:05 PM

Membuat Auto Complete | Diskusi Android

http://diskusiandroid.com/membuat-auto-complete-t209.html

6. Lalu deklarasikan AutoCompleteTextView dan ArrayAdapter. Code: Select all


ArrayAdapter<String> aa = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, data); AutoCompleteTextView actv = (AutoCompleteTextView) findViewById(R.id.auto);

7. Panggil variabel yang kita gunakan untuk memanggil AutoCompleteTextView, tambahkan setAdapter(ArrayAdapter). Gunakan setThreshold untuk membatasi berapa karakter agar string yang dimaksud keluar (misal,, kita input ay ..... akan secara auto tampil ayam dan lainnya). Code: Select all
actv.setAdapter(aa); actv.setThreshold(2);

Project :
Hidden is OFF

Ziddu Mediafire

Ok selesai,, jalankan... Selamat Mencoba Image

BluRay Android Developer Progress to next rank: 59.5% Posts: 419 Joined: March 8th, 2011, 3:23 pm Location: Aishiteru

Reputation point: 34

Private message Top

0 new messages Last visit was: May 23rd, 2012, 10:06 am

3 of 7

5/23/2012 12:05 PM

Membuat Auto Complete | Diskusi Android

http://diskusiandroid.com/membuat-auto-complete-t209.html

Share On
Facebook Report this post Reply with quote Twitter Digg MySpace Delicious Technorati

Re: Membuat Auto Complete


by bowwow_kecil June 8th, 2011, 1:16 am setelah di klik, bs ngga langsung masuk ke Class yang didalamnya ada string tersebut.?? bowwow_kecil Anak Magang Progress to next rank: 10% Posts: 1 Joined: May 27th, 2011, 11:51 pm Reputation point: 0

Private message Top Report this post Reply with quote

Re: Membuat Auto Complete


by l0neman June 8th, 2011, 8:45 am bowwow_kecil wrote:setelah di klik, bs ngga langsung masuk ke Class yang didalamnya ada string tersebut.??

mksdny gmna om ?.. yg ad di String ?.. kl pindah ke class yg ingin dituju bisa,, tinggal di dalam itemSelectListener ny di atur if( variable==array[1]){ Intent class aja om .. }

23rd, 2012, 10:06 am

4 of 7

5/23/2012 12:05 PM

Membuat Auto Complete | Diskusi Android

http://diskusiandroid.com/membuat-auto-complete-t209.html

l0neman Integer.parseInt Posts: 290 Joined: February 18th, 2011, 10:28 am

Reputation point: 3

Private message Website Top Report this post Reply with quote

Re: Membuat Auto Complete


by mr_ael June 8th, 2011, 5:53 pm kenapa pas di ketik ca kn emank nongol dropdownny, tp warnany putih.. si tulisan juga putih.. jadi gk keliatan sama sekali.. cara mw gnti warna tulisan pas nongol dropdownlist ny gmn yak? gk jadi.. tinggal ganti tipe dari dropdownlistnya aje.. tp tetep penasaran, kenapa yg simple_list_item putih yah?? mr_ael Frozen Yoghurt Addicted Progress to next rank: 56% Posts: 118 Joined: March 10th, 2011, 11:08 am Reputation point: 0

Private message Top Report this post Reply with quote 0 new messages Last visit was: May 23rd, 2012, 10:06 am

5 of 7

5/23/2012 12:05 PM

Membuat Auto Complete | Diskusi Android

http://diskusiandroid.com/membuat-auto-complete-t209.html

Re: Membuat Auto Complete


by bulanratu June 14th, 2011, 1:28 pm l0neman wrote: bowwow_kecil wrote:setelah di klik, bs ngga langsung masuk ke Class yang didalamnya ada string tersebut.??

mksdny gmna om ?.. yg ad di String ?.. kl pindah ke class yg ingin dituju bisa,, tinggal di dalam itemSelectListener ny di atur if( variable==array[1]){ Intent class aja om .. }

pengen bikin yang kaya gini juga,jadi pas dipilih langsung masuk ke class yang dituju..cara gimana ya?? koding lengkapnya masksudnya.. bulanratu Anak Magang Progress to next rank: 10% Posts: 1 Joined: June 10th, 2011, 12:18 pm Reputation point: 0

Private message Top Next Display posts from previous: Post a reply 14 posts Page 1 of 3 1, 2, 3 Return to Basic Android Jump to: 0 new messages Last visit was: May 23rd, 2012, 10:06 am
In total there are 7 users online :: 4 registered, 0 hidden and 3 guests

Sort by

6 of 7

5/23/2012 12:05 PM

Membuat Auto Complete | Diskusi Android

http://diskusiandroid.com/membuat-auto-complete-t209.html

Board index Subscribe topic Bookmark topic The team Delete all board cookies All times are UTC + 7 hours

Indonesian Android Developer Powered by phpBB

0 new messages Last visit was: May 23rd, 2012, 10:06 am

7 of 7

5/23/2012 12:05 PM