Я думаю, что я попробовал все (сделал фокусируемый: ложь !!)
и я не могу захватить в любом случае выбранный флажок в моем элементе списка.
даже OnItemClickListener не отвечает ни на один щелчок.
как я могу получить отмеченные флажки в моем элементе списка?
мой элемент списка включает в себя: просмотр изображения, 4 просмотра текста и флажок
некоторый код:
это в моем классе ListActivity:
final String columns[] = new String[] { MyUsers.User._ID,
MyUsers.User.MSG, MyUsers.User.LOCATION };
int[] to = new int[] { R.id.toptext, R.id.bottomtext,R.id.ChkBox, R.id.Location};
Uri myUri = Uri.parse("content://com.idan.datastorageprovider/users");
Cursor cursor = getContentResolver().query(myUri, columns, null, null, null);
startManagingCursor(cursor);
ListCursorAdapter myCursorAdapter=new ListCursorAdapter(this,
R.layout.listitem, cursor, columns, to);
this.setListAdapter(myCursorAdapter);
и это мой класс адаптера Custom Cursor:
public class ListCursorAdapter extends SimpleCursorAdapter
{
private Context context;
private int layout;
public ListCursorAdapter(Context context, int layout, Cursor c,
String[] from, int[] to)
{
super(context, layout, c, from, to);
this.context = context;
this.layout = layout;
}
@Override
public View newView(Context context, Cursor cursor, ViewGroup parent)
{
Cursor c = getCursor();
final LayoutInflater inflater = LayoutInflater.from(context);
View v = inflater.inflate(layout, parent, false);
return v;
}
@Override
public void bindView(View v, Context context, Cursor c)
{
TextView topText = (TextView) v.findViewById(R.id.toptext);
if (topText != null)
{
topText.setText("");
}
int nameCol = c.getColumnIndex(MyUsers.User.MSG);
String name = c.getString(nameCol);
TextView buttomTxt = (TextView) v.findViewById(R.id.bottomtext);
if (buttomTxt != null)
{
buttomTxt.setText("Message: "+name);
}
nameCol = c.getColumnIndex(MyUsers.User.LOCATION);
name = c.getString(nameCol);
TextView location = (TextView) v.findViewById(R.id.Location);
if (locationLinkTxt != null)
{
locationLinkTxt.setText(name);
}
Буду признателен за любую помощь! это действительно удручает, я пробовал много способов. многие слушатели не могут понять, как захватить слушателя для моих флажков.
Данные, которые я связываю с элементами списка из базы данных, не рассматриваются относительно флажка ... только текстовые просмотры ... нет никакой связи между базой данных и флажком, который есть в элементе списка. 1015 *
Спасибо,
Идан.
<ImageView
android:id="@drawable/icon"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_marginLeft="6dip"
android:focusable="false"
android:focusableInTouchMode="false"
android:src="@drawable/icon" >
</ImageView>
<LinearLayout
android:id="@+id/LinearLayout01"
android:layout_width="1sp"
android:layout_height="fill_parent"
android:layout_weight="1"
android:focusable="false"
android:focusableInTouchMode="false"
android:orientation="vertical" >
<TextView
android:id="@+id/toptext"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="1"
android:focusable="false"
android:focusableInTouchMode="false"
android:gravity="center_vertical"
android:singleLine="true"
android:text="OrderNum" >
</TextView>
<TextView
android:id="@+id/bottomtext"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:focusable="false"
android:focusableInTouchMode="false"
android:text="TweetMsg" >
</TextView>
<TextView
android:id="@+id/twittLocation"
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="1"
android:focusable="false"
android:focusableInTouchMode="false"
android:singleLine="true"
android:text="location" >
</TextView>
<TextView
android:id="@+id/twittLocationlink"
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="1"
android:focusable="false"
android:focusableInTouchMode="false"
android:gravity="fill_horizontal"
android:text="locationlink" >
</TextView>
</LinearLayout>
<CheckBox
android:id="@+id/deleteTwittChkBox"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_marginRight="2dp"
android:checked="false"
android:focusable="false"
android:focusableInTouchMode="false"
android:text="Delete" >
</CheckBox>