I got ListActivity, each item has 2 textviews image and CheckedTextView. I am trying to implement simple multichoiselist...
I have two problems:
1.
#Override
protected void onListItemClick(android.widget.ListView l, View v,
int position, long id)
{
...
}
doesnt respond at all I have tried it with the debugger and when I press on any list item it doesnt stop there. and I have tried all kind of things (like focusable:false)
two:.
I cant toggle the CheckedTextView anyhow.
here is my xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="100sp"
android:focusable="false" android:focusableInTouchMode="false">
android:padding="6dip">
<ImageView android:layout_width="wrap_content"
android:layout_height="fill_parent" android:src="#drawable/icon"
android:id="#drawable/icon" android:layout_marginLeft="6dip"
android:focusable="false" android:focusableInTouchMode="false">
</ImageView>
<LinearLayout android:id="#+id/LinearLayout01"
android:orientation="vertical" android:layout_width="1sp"
android:layout_height="fill_parent" android:layout_weight="1"
android:focusable="false" android:focusableInTouchMode="false">
<TextView android:id="#+id/toptext" android:layout_weight="1"
android:gravity="center_vertical" android:text="OrderNum"
android:singleLine="true" android:layout_height="0dp"
android:layout_width="wrap_content" android:focusable="false"
android:focusableInTouchMode="false">
</TextView>
<TextView android:id="#+id/bottomtext" android:layout_height="wrap_content"
android:layout_width="wrap_content" android:focusable="false"
android:focusableInTouchMode="false" android:text="TweetMsg">
</TextView>
<TextView android:id="#+id/twittLocation"
android:layout_weight="1" android:text="location" android:singleLine="true"
android:layout_width="fill_parent" android:layout_height="0dip"
android:focusable="false" android:focusableInTouchMode="false">
</TextView>
<TextView android:layout_weight="1" android:id="#+id/twittLocationlink"
android:text="locationlink" android:gravity="fill_horizontal"
android:layout_width="fill_parent" android:layout_height="0dip"
android:focusable="false" android:focusableInTouchMode="false">
</TextView>
</LinearLayout>
<CheckedTextView android:id="#android:id/text1" android:text="Delete"
android:layout_width="wrap_content" android:layout_marginRight="2dp"
android:layout_height="fill_parent"
android:checkMark="?android:attr/listChoiceIndicatorMultiple"
android:focusable="false"></CheckedTextView>
</LinearLayout>
any idea what's the problem?
thanks.
In your ListView set android:descendantFocusability="beforeDescendants". This might help.
Try this code:
public class Sample extends ListFragment implements OnItemClickListener{
ListView list;
list.setOnItemClickListener(new android.widget.AdapterView.OnItemClickListener() {
#Override
public void onItemClick(AdapterView<?> arg0, View arg1,
int arg2, long arg3) {
}
});
}
Sample code
Related
I got a custom listview:
trainingsplan_item.xml:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="270dp"
android:layout_height="match_parent"
android:id="#+id/planinfolinearlayout"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:id="#+id/plannametv"
android:textColor="#color/darkPrimary"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:id="#+id/trainingszieltv"
android:layout_below="#+id/plannametv"
android:textColor="#color/white"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:id="#+id/phasendauerbereichtv"
android:layout_below="#+id/trainingszieltv"
android:textColor="#color/white"/>
</LinearLayout>
<ImageButton
android:layout_width="70dp"
android:layout_height="wrap_content"
android:id="#+id/imageButtonInfo"
android:src="#drawable/informationsmall"
android:scaleType="fitCenter"
android:adjustViewBounds="true"
android:layout_toRightOf="#+id/planinfolinearlayout"
android:background="#color/darkSecondary"
android:layout_marginTop="5dp"
android:focusable="false"
/>
</RelativeLayout>
The fragment:
final ListView planView = (ListView) getActivity().findViewById(R.id.listViewtrainingsplan);
planView.setItemsCanFocus(false);
PlanAdapter adapter = new PlanAdapter(getActivity(),R.layout.trainingsplan_item, arrayOfPlans);
planView.setAdapter(adapter);planView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
#Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
changeFocus(planView, position);
}
});
However, it does not call the method changeFocus when I try to debug.
I tried several solutions shown here on this website but none has worked for me, any ideas? Thanks in advance!
remove
planView.setItemsCanFocus(false);
I have a list view and want to perform clickable event on it. I did it before. but now its not working. I have added my XML as well. I just need to move from one actvity to other on click in list view.
CustomFinalSubmit_ItemDetail item = new CustomFinalSubmit_ItemDetail(Final_Submit.this , R.layout.customview_finalsubmit_itemdetails, itemInfo);
itemList.setAdapter(item);
itemList.setOnItemClickListener(new OnItemClickListener() {
#Override
public void onItemClick(AdapterView<?> arg0, View arg1, int position,
long arg3) {
FinalSubmitItem pos = itemInfo.get(position);
String itemType = pos.getItemType();
String itemCountry = pos.getItemCountry();
String itemSerial = pos.getItemNo();
pos.setChecked(true);
Intent inn = new Intent(getApplicationContext(), FinalSubmitDetails.class);
inn.putExtra("itemType", itemType);
inn.putExtra("itemCountry", itemCountry);
inn.putExtra("itemSerial", itemSerial);
startActivity(inn);
}
});
Here is my main Xml:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="#color/green">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="fill"
android:layout_marginTop="10dip"
android:orientation="vertical"
android:background="#0B3B0B">
<ListView
android:id="#+id/CustomerDetailList"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/yellow"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dip"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="3"
android:id="#+id/Itemtype"
android:paddingTop="5dp"
android:background="#color/green"
android:textColor="#color/yellow"
android:layout_marginLeft="5dip"
android:text="Item Type"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="3"
android:paddingTop="5dp"
android:id="#+id/txtcountry"
android:background="#color/green"
android:textColor="#color/yellow"
android:text="Country"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="3"
android:paddingTop="5dp"
android:id="#+id/txtItemNumber"
android:background="#color/green"
android:textColor="#color/yellow"
android:text="Item No."/>
<CheckBox
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="4"
android:id="#+id/itemChck"
android:button="#drawable/custom_checkbox"
android:paddingTop="5dp"
android:padding="5dp"/>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_margin="5dp"
android:layout_height="1dp"
android:background="#color/white"/>
<ListView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/itemList"
android:background="#088A08"
android:divider="#color/white"
android:dividerHeight="1dp"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
I did it this way:
convertView.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
your code
}});
Just add this much code to my customview
Recently I had the same problem after adding a ToggleButton to my list items. The solution for me was to add android:descendantFocusability="blocksDescendants" to the layout of the item.
Here is the whole XML:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:padding="5dp"
android:paddingLeft="15dp"
android:descendantFocusability="blocksDescendants" >
<TextView
android:id="#+id/watch_roadName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:text="Addresse"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textStyle="bold" />
<ToggleButton
android:id="#+id/watch_button_arrived"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/watch_roadName"
android:layout_alignParentRight="true"
android:textOn="#string/arrived"
android:textOff="#string/arrived"
android:text="#string/arrived" />
</RelativeLayout>
Similar answers to the same issue can be found here:
How to fire onListItemClick in Listactivity with buttons in list?
and here
Android custom ListView with ImageButton is not getting focus
in the widgets(Textview or button whatever it is) of your inflator layout just add:
android:focusable="false"
android:focusableInTouchMode="false"
and in parent layout of your inflator add:
android:descendantFocusability="blocksDescendants"
I have a listview. And i need do click in each element inside listview. But the onItemClickListener don't work. I try put each textView with focusable="false" and put android:descendantFocusability="blocksDescendants" but nothing works and i don't know where is my error.
Here is my code
xml of each element inside listview
**xml_item_list**
<TableRow xmlns:android="http://schemas.android.com/apk/res/android"
android:paddingTop="5dip"
android:paddingBottom="8dip"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?android:attr/listPreferredItemHeight"
android:background="#android:drawable/list_selector_background"
android:clickable="true"
android:longClickable="true"
android:descendantFocusability="blocksDescendants">
<TextView
android:id="#+id/lDate"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:layout_marginRight="3dp"
android:background="#drawable/et_style"
android:gravity="center"
android:textColor="#c2c2c2"
android:textAppearance="?android:attr/textAppearanceMedium"
android:focusable="false" />
<TextView
android:id="#+id/lDescription"
android:layout_width="50dp"
android:layout_height="wrap_content"
android:layout_marginLeft="3dp"
android:layout_marginRight="3dp"
android:layout_weight="1"
android:gravity="center"
android:background="#drawable/et_style"
android:textColor="#c2c2c2"
android:textAppearance="?android:attr/textAppearanceMedium"
android:focusable="false"/>
<TextView
android:id="#+id/lMissValue"
android:layout_width="300dp"
android:layout_height="wrap_content"
android:layout_marginLeft="3dp"
android:gravity="center_horizontal|center"
android:layout_gravity="center"
android:textColor="#DDCC2EFA"
android:textAppearance="?android:attr/textAppearanceMedium"
android:focusable="false"/>
</TableRow>
**main_xml_list**
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/background_tile"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginBottom="50dp">
<ImageView
android:id="#+id/bankTransaction"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:focusable="false"/>
<TextView
android:id="#+id/contextLabel"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/et_style"
android:textSize="28dp"
android:layout_gravity="bottom" />
</LinearLayout>
<ListView
android:id="#android:id/list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:descendantFocusability="blocksDescendants">
</ListView>
</LinearLayout>
Code inside onCreate() function of activity
onCreate()
listView = getListView();
listView.setClickable(true);
listView.setOnItemClickListener(
new OnItemClickListener()
{
#Override
public void onItemClick(AdapterView<?> arg0, View view,int position, long id) {
Log.w(TransactionView.class.getName(), "Item click listener");
Toast.makeText(TransactionView.this, "Item clicado", Toast.LENGTH_LONG).show();
}
}
);
Anyone can help me?
Thanks for yout time.
try like this
lvlList = (ListView)findViewById(R.id.lvlList);
lvlList.setOnItemClickListener(new OnItemClickListener()
{
#Override
public void onItemClick(AdapterView<?> a, View v,int position, long id)
{
Toast.makeText(getBaseContext(), "Click", Toast.LENGTH_LONG).show();
}
});
First of all,check that you have added this line or not in your code.
public class MyActivity extends Activity implements OnItemClickListener
Then add this code in your onCreate() of activity ...
ListView listView = (ListView) findViewById(R.id.lisview);
listView.setOnItemClickListener(this);
#Override
public boolean onItemClick(AdapterView<?> parent, View v, int pos,long id)
{
System.out.println("~~~~~~Item Clicked");
return false;
}
change this ::
android:id="#+id/list"
Hope this helps :)
My Solution.....
public class TransactionView extends ListActivity implements **AdapterView.OnItemClickListener**{}
**onCreate()**{
adapter = new SimpleCursorAdapter(
this,
R.layout.transaction_item_view,
c,
new String[]{MySQLiteHelper.C_TRANSACTION_DUE, MySQLiteHelper.C_TRANSACTION_DESCRIPTION, MySQLiteHelper.C_TRANSACTION_VALUE, MySQLiteHelper.C_TRANSACTION_COVERVALUE, MySQLiteHelper.C_TRANSACTION_STATE, MySQLiteHelper.C_TRANSACTION_SOURCE},
new int[]{ R.id.lDate, R.id.lDescription, R.id.lMissValue},SimpleCursorAdapter.IGNORE_ITEM_VIEW_TYPE);
}
setListAdapter(adapter);
listView = getListView();
listView.setOnItemClickListener(new AdapterView.OnItemClickListener()
{
#Override
public void onItemClick(AdapterView<?> arg0, View view,int position, long id) {
Log.w(TransactionView.class.getName(), "Item click listener");
Toast.makeText(TransactionView.this, "Item clicado", Toast.LENGTH_LONG).show();
}
}
);
**item_list_row**
<TableRow xmlns:android="http://schemas.android.com/apk/res/android"
android:paddingTop="5dip"
android:paddingBottom="8dip"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?android:attr/listPreferredItemHeight"
android:background="#android:drawable/list_selector_background"
>
<TextView
android:id="#+id/lDate"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:layout_marginRight="3dp"
android:background="#drawable/et_style"
android:gravity="center"
android:textColor="#c2c2c2"
android:textAppearance="?android:attr/textAppearanceMedium"
/>
<TextView
android:id="#+id/lDescription"
android:layout_width="50dp"
android:layout_height="wrap_content"
android:layout_marginLeft="3dp"
android:layout_marginRight="3dp"
android:layout_weight="1"
android:gravity="center"
android:background="#drawable/et_style"
android:textColor="#c2c2c2"
android:textAppearance="?android:attr/textAppearanceMedium"
/>
<TextView
android:id="#+id/lMissValue"
android:layout_width="300dp"
android:layout_height="wrap_content"
android:layout_marginLeft="3dp"
android:gravity="center_horizontal|center"
android:layout_gravity="center"
android:textColor="#DDCC2EFA"
android:textAppearance="?android:attr/textAppearanceMedium"
/>
**main_xml_list**
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/background_tile"
android:orientation="vertical" >
<ListView
android:id="#android:id/list"
android:layout_width="match_parent"
android:layout_height="wrap_content">
</ListView>
</LinearLayout>
I have an activity with a ListView. ListView with custom views. I add OnItemClickLIstener to the ListView. and when i click on item, in result i see nothing.
Activity with ListView:
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android"
android:background="#color/silver_conv">
<FrameLayout
android:layout_width="fill_parent"
android:layout_height="40dp" android:layout_alignParentTop="true" android:id="#+id/topcontainer"
android:background="#color/black">
</FrameLayout>
<ListView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/chat_list" android:layout_below="#+id/topcontainer"
android:layout_above="#+id/last_action"
android:cacheColorHint="#00000000"
android:layout_marginRight="2dp" android:clickable="true"/>
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content"
android:text="last action was at time" android:id="#+id/last_action"
android:longClickable="false"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="false" android:layout_above="#+id/action_container"
android:layout_marginBottom="5dp" android:layout_alignParentLeft="false" android:layout_marginLeft="5dp"/>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="43dp" android:layout_alignParentBottom="true" android:id="#+id/action_container"
android:background="#drawable/conv_botom_action_gradient">
<Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="#string/send"
android:id="#+id/send_message_btn" android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:background="#drawable/blue_button_selector" android:textColor="#color/white"
android:layout_marginLeft="3dp" android:layout_marginTop="3dp"/>
<Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="#+id/add_attach_btn"
android:layout_alignParentLeft="true" android:layout_alignParentBottom="true"
android:background="#drawable/add_attach_button_selector"
android:layout_marginRight="2dp" android:layout_marginBottom="3dp" android:layout_marginTop="3dp"/>
<EditText android:layout_width="40dp" android:layout_height="wrap_content" android:id="#+id/message_et"
android:layout_toRightOf="#+id/add_attach_btn" android:layout_toLeftOf="#+id/send_message_btn"
android:singleLine="true" android:layout_alignParentBottom="true" android:hint="Type message here"
android:background="#drawable/message_input" android:layout_marginBottom="3dp"
android:gravity="center_vertical" android:layout_marginTop="3dp"/>
</RelativeLayout>
View item:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content" android:gravity="center_vertical|left" android:focusable="false">
<LinearLayout
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:background="#drawable/incoming_message"
android:id="#+id/container" android:layout_marginTop="5dp" android:layout_marginBottom="5dp"
android:focusable="false">
<FrameLayout android:layout_width="wrap_content" android:layout_height="wrap_content"
android:focusableInTouchMode="true" android:id="#+id/attach_container" android:focusable="false"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="saa"
android:id="#+id/message_text" android:textSize="17sp" android:textColor="#color/black"
android:focusable="false"/>
</LinearLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Text"
android:id="#+id/date" android:textColor="#color/black" android:singleLine="true" android:lines="1"
android:maxLines="1" android:ellipsize="none" android:layout_marginLeft="5dp" android:focusable="false"/>
And finally clickListener:
private AdapterView.OnItemClickListener clickLister = new AdapterView.OnItemClickListener() {
#Override
public void onItemClick(AdapterView<?> adapterView, View view, int pos, long l) {
try {
LinearLayout container = (LinearLayout)view.findViewById(R.id.container);
TextView message = (TextView)container.findViewById(R.id.message_text);
message.setTextColor(mContext.getResources().getColor(R.color.white));
Log.e("My item is", "" + pos);
}catch (Exception e){
e.printStackTrace();
}
}
};
And here is Initialization of ListView:
mConvListView = (ListView)findViewById(R.id.chat_list);
mConvListView.setDivider(null);
mConvListView.setDividerHeight(0);
mConvListView.setItemsCanFocus(false);
mConvListView.setOnItemClickListener(clickLister);
mConvListView.setTranscriptMode(ListView.TRANSCRIPT_MODE_ALWAYS_SCROLL);
mConvListView.setStackFromBottom(true);
P.s. Sorry for a lot code. But I can't find any suggestion a second day.
By setting focusable objects in your row layout, you are preventing the ListView from getting the touch event.
This FrameLayout is consuming the touch event:
<FrameLayout
android:id="#+id/attach_container"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:focusableInTouchMode="true"
android:focusable="false"/>
Remove the focusable settings so it looks like this:
<FrameLayout
android:id="#+id/attach_container"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
(You really should organize your XML so that is is readable, in Eclipse use Ctrl+Shift+F.)
Make Focus for all components as follows :
android:focusable="false"
android:focusableInTouchMode="false"
I guess you are not getting the item the right way. Try this:
int position = (int) adapterView.getSelectedItemId();
Log.i("Position:", Integer.toString(position));
Edit
Try this piece of code.
ListView lv = (ListView)findViewById(R.id.chat_list);
lv.setOnItemClickListener(new OnItemClickListener(){
#Override
public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
int position = (int) parent.getSelectedItemId();
Log.i("Position:", Integer.toString(position));
}
});
I have a listview with a white background. I already set black as its text color. The problem is, you can only read the text in the list view if you click on it but as soon as you relase the hold on it it'll be plain white again
here's the xml:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#FFFFFF">
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:background="#F7EFE8">
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:text="SETTINGS"
android:textStyle="bold"
android:textColor="#android:color/black"
android:paddingTop="10dp"
android:paddingBottom="10dp"/>
</LinearLayout>
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textColor="#android:color/black">
<TextView
android:id="#+id/selection"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textColor="#android:color/black"/>
<ListView
android:id="#+android:id/list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:drawSelectorOnTop="false"
android:textColor="#android:color/black"/>
</LinearLayout>
</LinearLayout>
and here's the java:
public class SettingsActivity extends ListActivity {
TextView selection;
String[] items={"Change Password", "Save Credentials" };
#Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.settingsactivity);
setListAdapter(new `ArrayAdapter<String>(this,android.R.layout.simple_list_item_multiple_choice,items));`
selection =(TextView)findViewById(R.id.selection);
}
public void onListItemClick(ListView parent, View v, int position, long id) {
selection.setText(items[position]);
}
}