<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<ImageView
android:src="@drawable/icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="invisible"
/>
<LinearLayout
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minWidth="30px"
>
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minWidth="30px"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Name: "
android:id="@+id/name"
android:textColor="#2E6100"
android:textStyle="bold"
/>
<TextView android:id="@+id/contact_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#2E6100"
android:textStyle="bold"/>
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minWidth="30px">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Phone: "
android:clickable="true"
android:id="@+id/phone"
android:textColor="#2E6100"/>
<TextView android:id="@+id/phone_number"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#2E6100"/>
</LinearLayout>
</LinearLayout>
<ImageView
android:src="@drawable/icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/call"
android:clickable="true"
/>
</LinearLayout>
class managecontact.java
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
mDbHelper = new database(this);
mDbHelper.open();
/* ImageView call=(ImageView)this.findViewById(R.id.call);
call.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
//TODO Auto-generated method stub
call();
}
});*/
registerForContextMenu(getListView());
}
private void fillData() {
Cursor currentCursor = mDbHelper.fetchAllNotes();
startManagingCursor(currentCursor);
// Create an array to specify the fields we want to display in the list (only TITLE)
String[] from = new String[]{database.KEY_TITLE};
// and an array of the fields we want to bind those fields to (in this case just text1)
int[] to = new int[]{ R.id.contact_name};
// Now create a simple cursor adapter and set it to display
CustomSqlCursorAdapter adapter = new CustomSqlCursorAdapter(this, R.layout.single_item,currentCursor, from, to);
setListAdapter(adapter);
}
private void call() {
Intent callIntent = new Intent(Intent.ACTION_CALL);
callIntent.setData(Uri.parse("tel:123456789"));
startActivity(callIntent);
}
我想在点击图片图标时拨打电话。请告诉我如何更正
答案 0 :(得分:1)
希望它会帮助你............