package cao.org.android.phonelistview;
import android.app.ListActivity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;
public class Phone_ListActivity extends ListActivity {
@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
Intent intent=new Intent();
Uri uri;
String data;
switch (position) {
case 0:
data="content://contacts/people/1";
uri=Uri.parse(data);
intent.setAction(Intent.ACTION_VIEW);
intent.setData(uri);
startActivity(intent);
break;
case 1:
data="content://contacts/people/1"; //此处运行时无法跳转编辑运行,哪里错了??
uri=Uri.parse(data);
intent.setAction(Intent.ACTION_EDIT);
intent.setData(uri);
startActivity(intent);
break;
case 2:
data="tel:13800138000";
uri=Uri.parse(data);
intent.setAction(Intent.ACTION_DIAL);
intent.setData(uri);
startActivity(intent);
break;
case 3:
data="tel:13800138000";
uri=Uri.parse(data);
intent.setAction(Intent.ACTION_CALL);
intent.setData(uri);
startActivity(intent);
break;
default:
break;
}
}
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
String []menus={"查看电话信息","编辑电话信息","显示拨打电话信息","直接打电话"};
setListAdapter(new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1,menus));
getListView().setTextFilterEnabled(true);
}
}
错误信息:
03-19 05:16:06.286: ERROR/AndroidRuntime(5104): java.lang.RuntimeException: An error occured while executing doInBackground()
03-19 05:16:06.286: ERROR/AndroidRuntime(5104): Caused by: android.database.sqlite.SQLiteException: no such column: raw_contact_id: , while compiling: SELECT data_version, contact_id, version, data12, data11, data10, mimetype, res_package, _id, data15, data14, data13, name_verified, is_restricted, is_super_primary, data_sync1, dirty, data_sync3, data_sync2, data_sync4, account_type, data1, sync4, sync3, data4, sync2, data5, sync1, data2, data3, data8, data9, deleted, group_sourceid, data6, data7, account_name, data_id, starred, sourceid, is_primary FROM contact_entities_view WHERE (1) AND (raw_contact_id=1)
当点击编辑电话信息的时候,页面无法跳转,为什么,知道的帮帮忙谢谢了。。
就是运行case 1:是无法运行
------解决方案--------------------
去verycd上下 从零开始 的视屏里面有一集讲的这个 去看看 我记得有这块 讲的很清晰