Belajardengan.com merupakan domain blog lama dari delajardengan.blogspot.com. Mohon kritik dan sarannya untuk perkembangan blog ini.
email: blog.tkx.pnp@gmail.com

coba Belajar Adroid (3)

♠ Posted by Unknown in at 7:49 PM
import android.app.Activity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.AutoCompleteTextView;
import android.widget.LinearLayout;
import android.widget.TextView;

public class Tes2sanActivity extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        LinearLayout ly=new LinearLayout(this);
        TextView txt=new TextView(this);
        txt.setText("Nama kota di Indonesia : ");
        ly.addView(txt);
        AutoCompleteTextView actv = new AutoCompleteTextView(this);
        ArrayAdapter<String> aa = new ArrayAdapter<String>(this,
  android.R.layout.simple_dropdown_item_1line,new String[] {"Cimahi", "Bandung", "Jakarta", "Surabaya", "Bali", "Semarang","Balikpapan"});
        actv.setAdapter(aa);
        actv.setWidth(500);
        actv.setHeight(50);
        ly.addView(actv);
        setContentView(ly);

    }
}


0 komentar:

Post a Comment