Thanks vijay. for helping me out. it worked Thanks Atik
On Jun 13, 4:01 pm, νιנαソkum@r <[email protected]> wrote: > ListView lv= (ListView) findViewById(R.id.listview); > > lv.setAdapter(new ArrayAdapter<String>(this, R.id.listview, > COUNTRIES)); > > android.R.layout.simple_list_item_1 > > remove* R.id.listiew* add this one* android.R.layout.simple_list_item_1* > > > > > > > > > > On Mon, Jun 13, 2011 at 4:24 PM, Atik <[email protected]> wrote: > > HI All, > > i m developing a list view and on top, it will have a auto complete > > textview, when user clicks on a certain item from the list, i want to > > display it in that auto complete text field. but i m getting some > > error..pls advice me..my codes are > > > right now i m unable to load the view..so i have just written the code > > for the click on list item.. > > > Thanks > > > **************package com.example; > > > import android.app.Activity; > > import android.os.Bundle; > > import android.view.View; > > import android.widget.AdapterView; > > import android.widget.ArrayAdapter; > > import android.widget.ListView; > > import android.widget.TextView; > > import android.widget.Toast; > > import android.widget.AdapterView.OnItemClickListener; > > > public class HelloListView extends Activity { > > /** Called when the activity is first created. */ > > @Override > > public void onCreate(Bundle savedInstanceState) { > > super.onCreate(savedInstanceState); > > setContentView(R.layout.main); > > > ListView lv= (ListView) findViewById(R.id.listview); > > > lv.setAdapter(new ArrayAdapter<String>(this, R.id.listview, > > COUNTRIES)); > > > lv.setOnItemClickListener(new OnItemClickListener() { > > public void onItemClick(AdapterView<?> parent, View view, > > int position, long id) { > > // When clicked, show a toast with the TextView text > > Toast.makeText(getApplicationContext(), ((TextView) > > view).getText(), > > Toast.LENGTH_SHORT).show(); > > } > > }); > > } > > static final String[] COUNTRIES = new String[] { > > "Afghanistan", "Albania", "Algeria", "American Samoa"}; > > } > > > ***********************xml file > > > <?xml version="1.0" encoding="utf-8"?> > > > <RelativeLayout android:id="@+id/main1" > > xmlns:android="http://schemas.android.com/apk/res/android" > > android:padding="4dip" android:layout_width="fill_parent" > > android:layout_height="fill_parent"> > > > <AutoCompleteTextView android:id="@+id/searchText" > > android:layout_width="fill_parent" > > android:layout_height="wrap_content" > > android:singleLine="true" android:textSize="16sp" > > android:autoText="false" > > android:capitalize="none" > > android:layout_alignParentLeft="true" > > android:scrollHorizontally="true"> > > > </AutoCompleteTextView> > > > <Button android:id="@+id/searchButton" > > android:layout_width="wrap_content" > > android:layout_height="wrap_content" android:text="" > > > android:layout_alignParentRight="true"> > > </Button> > > > <ListView android:id="@+id/listview" > > android:layout_width="fill_parent" > > android:layout_height="fill_parent" android:padding="10dp" > > android:textSize="16sp"> > > </ListView> > > </RelativeLayout> > > > -- > > You received this message because you are subscribed to the Google > > Groups "Android Developers" group. > > To post to this group, send email to [email protected] > > To unsubscribe from this group, send email to > > [email protected] > > For more options, visit this group at > >http://groups.google.com/group/android-developers?hl=en > > -- > > "Nobody can go back and start a new beginning, but anyone can start today > and make a new ending" > ----- > Thanks, > Regards, > νιנαソαkum@r M > BloG:http://iamvijayakumar.blogspot.com/ > Mob.No:09048382536(Kerala) > Mob.No:09751076707(TN) -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

