I have an Activity
that also has a ListView
in it. I load some EditText
boxes, buttons, etc. In ListView
in my getView
method.
if(position==0) { ((TextView)convertView.findViewById(R.id.textview_settings)).setText("User Information"); } else if(position==1 || position==2 || position==5 || position==6 || position==7 || position==10 || position==13) { ((LinearLayout)convertView.findViewById(R.id.linear_settings)).setVisibility(View.VISIBLE); ((RelativeLayout)convertView.findViewById(R.id.Relative_home)).setVisibility(View.GONE); if(position==1 || position==5 || position==5) ((EditText)convertView.findViewById(R.id.edittext_settings)).setBackgroundResource(R.drawable.f_t_1_iphone); else if(position==7 || position==2) ((EditText)convertView.findViewById(R.id.edittext_settings)).setBackgroundResource(R.drawable.f_t_3_iphone); else if(position==6) ((EditText)convertView.findViewById(R.id.edittext_settings)).setBackgroundResource(R.drawable.f_t_2_repeat_iphone); else if(position==13 || position==10) ((EditText)convertView.findViewById(R.id.edittext_settings)).setBackgroundResource(R.drawable.f_t_4_iphone); }
And in multiple instances, I also add Button
to the same List
. Basically, I just load a specific layout file into a specific row based on the index of the ListView
row. The button has the identifier button_title
- defined in my xml below.
convertView = mInflater.inflate(R.layout.next, null); *
Contents next.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="fill_parent" android:id="@+id/linear"> <FrameLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/frame_settings"> <RelativeLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/Relative_home" android:orientation="horizontal" > <TextView android:id="@+id/textview_settings" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center|left" android:layout_margin="5dp" android:text="" android:textSize="15dp" android:textStyle="bold" android:typeface="sans" android:layout_alignParentLeft="true"/> <ImageButton android:id="@+id/Button_title" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="left" android:layout_marginRight="10dp" android:background="@drawable/edit_button_pressed" android:layout_alignParentRight="true"/> </RelativeLayout> <LinearLayout android:id="@+id/linear_settings" android:layout_width="fill_parent" android:layout_height="wrap_content"> <EditText android:id="@+id/edittext_settings" android:layout_width="fill_parent" android:layout_height="wrap_content" android:textSize="12dp" android:textStyle="bold" android:typeface="sans" android:layout_alignParentLeft="true"/> </LinearLayout> </FrameLayout> </LinearLayout>
Now, since I have several instances of the same button in this action, I cannot assign unique identifiers to each of these buttons. All buttons technically now contain the same identifier.
Is there a way I can assign different identifiers to each of these buttons? Program?
source share