Hi i setup a CheckedTextView but I can t get the onClick event functioning. I put the onClick code in the onCreate of the main.layout but I get a nullpointer at line 101, which is chkBox.setOnClickListener(new View.OnClickListener(). The Listview is created in the onPostExecute of a AsyncTask. Can someone please help?
MyeckedTextView:
<CheckedTextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/listCheckboxview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1" android:gravity="left"
android:textColor="#0075AB" android:textStyle="bold" android:textSize="14dip"
android:checkMark="?android:attr/listChoiceIndicatorMultiple"
android:clickable="true"
android:focusable="true"
android:text=""
/>
我的Click活动:
CheckedTextView chkBox = (CheckedTextView) findViewById(R.id.listCheckboxview);
chkBox.setOnClickListener(new View.OnClickListener() {
public void onClick(View v)
{
((CheckedTextView) v).toggle();
}
});