正常に機能するリスナー付きのリストビューがありますが、row.xmlの1つのテキストビューにandroid:autoLink: "web"プロパティを追加すると、リストリスナーが機能しません。なぜそうなのか?これがrow.xmlです
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/relativeLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginTop="10dp"
>
<TextView
android:id="@+id/ID"
android:layout_width="80dp"
android:layout_height="wrap_content"
android:text="First" />
<TextView
android:id="@+id/Name"
android:layout_width="80dp"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="56dp"
android:text="Second" />
<TextView
android:autoLink="web"
android:id="@+id/Link"
android:layout_width="80dp"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_below="@+id/ID"
android:layout_marginTop="18dp"
android:text="Third" />
</RelativeLayout>
これがlistview.xmlです
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="4dp"
android:orientation="vertical" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="Favourtes"
android:textSize="25sp"
android:textStyle="bold" >
</TextView>
<ListView
android:id="@+id/listforplace"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scrollbars="vertical" >
</ListView>
</LinearLayout>
ここで.javaクラス:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.bookmark);
// loadSharedPreferencesforplacelist();
list = (ListView) findViewById(R.id.listforplace);
myAdapter = new DbManager(this);
cursor = myAdapter.getAllfav();
// updateList();
String[] from = new String[] {/* DbManager.PlaceID, */DbManager.ID,
DbManager.name, DbManager.referance };
int[] to = new int[] { R.id.ID, R.id.Name, R.id.Link };
cursorAdapter = new SimpleCursorAdapter(this, R.layout.bookmark_row,
cursor, from, to);
list.setAdapter(cursorAdapter);
// cursorAdapter.setViewBinder(new ScoreHistoryBinder());
list.setOnItemClickListener(listOnItemClickListener);
}
public ListView.OnItemClickListener listOnItemClickListener = new ListView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position,
long id) {
Cursor cursor = (Cursor) parent.getItemAtPosition(position);
/* final int */placeidfordelete = cursor.getInt(cursor
.getColumnIndex(DbManager.ID));
// int placename =
// cursor.getString(cursor.getColumnIndex(DbManager.ID));
placelongi = cursor
.getString(cursor.getColumnIndex(DbManager.name));
placelati = cursor.getString(cursor
.getColumnIndex(DbManager.referance));
placealti = cursor.getString(cursor.getColumnIndex(DbManager.des));
AlertDialog.Builder builder = new AlertDialog.Builder(viewmark.this);
builder.setTitle("Delete");
builder.setIcon(android.R.drawable.ic_dialog_info);
builder.setMessage("Delete marks");
builder.setPositiveButton("Delete",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface arg0, int arg1) {
myAdapter.delete_byID_place(placeidfordelete);
updateList();
}
});
builder.setNegativeButton("All delete",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface arg0, int arg1) {
}
});
AlertDialog diag = builder.create();
diag.show();
}
};
@Override
protected void onDestroy() { // TODO Auto-generated method stub
super.onDestroy();
cursor.close();
myAdapter.close();
}
@SuppressWarnings({ "deprecation" })
private void updateList() {
cursor.requery();
cursor.close();
// //emptyFormFields();
}
}