Archives





Bingung

Sabtu, 05 November 2011

MultiAutoCompleteTextView


package com.android.vyta;

import android.app.Activity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.LinearLayout;
import android.widget.MultiAutoCompleteTextView;
import android.widget.TextView;

public class MACTextViewVytaActivity extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        LinearLayout ly=new LinearLayout(this);
        TextView txt=new TextView(this);
        txt.setText("Nama kota di Indonesia : ");
        ly.addView(txt);
  MultiAutoCompleteTextView mactv = new MultiAutoCompleteTextView(this);
        ArrayAdapter aa2 = new ArrayAdapter(this,
        android.R.layout.simple_dropdown_item_1line,new String[] {"Bukittinggi", "Jakarta", "Surabaya", "Bali", "Semarang","Balikpapan"});
        mactv.setAdapter(aa2);
        mactv.setTokenizer(new MultiAutoCompleteTextView.CommaTokenizer());
        mactv.setWidth(500);
        mactv.setHeight(50);
        ly.addView(mactv);
        setContentView(ly);

    }
}

0 komentar:

Posting Komentar

Mohon tinggalkan komentar anda karena komentar anda adalah

Sumber Ilmu buat saya...terimakasih..!!!

Twitter Delicious Facebook Digg Stumbleupon Favorites More