0
我無法讓ACTION_WEB_SEARCH正常工作,這是否需要對AndriodManifest.xml有任何權限?android ACTION_WEB_search不起作用
其他行動工作(電子郵件,電話,短信)。還有如何進行地圖搜索? 有什麼行動使用是否有任何action_searchmap? 以下是錯誤我得到的時候儘量去一個URL
12-30 15:34:33.798: E/AndroidRuntime(4972): FATAL EXCEPTION: main
12-30 15:34:33.798: E/AndroidRuntime(4972): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=url:http://www.google.com }
12-30 15:34:33.798: E/AndroidRuntime(4972): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1408)
12-30 15:34:33.798: E/AndroidRuntime(4972): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1378)
12-30 15:34:33.798: E/AndroidRuntime(4972): at android.app.Activity.startActivityForResult(Activity.java:2817)
12-30 15:34:33.798: E/AndroidRuntime(4972): at android.app.Activity.startActivity(Activity.java:2923)
12-30 15:34:33.798: E/AndroidRuntime(4972): at org.example.dbcontactconsole.Detalii.onListItemClick(Detalii.java:91)
12-30 15:34:33.798: E/AndroidRuntime(4972): at android.app.ListActivity$2.onItemClick(ListActivity.java:321)
12-30 15:34:33.798: E/AndroidRuntime(4972): at android.widget.AdapterView.performItemClick(AdapterView.java:284)
12-30 15:34:33.798: E/AndroidRuntime(4972): at android.widget.ListView.performItemClick(ListView.java:3382)
12-30 15:34:33.798: E/AndroidRuntime(4972): at android.widget.AbsListView$PerformClick.run(AbsListView.java:1696)
12-30 15:34:33.798: E/AndroidRuntime(4972): at android.os.Handler.handleCallback(Handler.java:587)
12-30 15:34:33.798: E/AndroidRuntime(4972): at android.os.Handler.dispatchMessage(Handler.java:92)
12-30 15:34:33.798: E/AndroidRuntime(4972): at android.os.Looper.loop(Looper.java:123)
12-30 15:34:33.798: E/AndroidRuntime(4972): at android.app.ActivityThread.main(ActivityThread.java:4627)
12-30 15:34:33.798: E/AndroidRuntime(4972): at java.lang.reflect.Method.invokeNative(Native Method)
12-30 15:34:33.798: E/AndroidRuntime(4972): at java.lang.reflect.Method.invoke(Method.java:521)
12-30 15:34:33.798: E/AndroidRuntime(4972): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
12-30 15:34:33.798: E/AndroidRuntime(4972): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
12-30 15:34:33.798: E/AndroidRuntime(4972): at dalvik.system.NativeStart.main(Native Method)
我的Java代碼: ` 如果(cursor.getCount()== 1){ cursor.moveToFirst();
actiune= new ArrayList<Actiune>();
String phoneString=cursor.getString(cursor.getColumnIndex("phone"));
if (phoneString!=null)
{
actiune.add(new Actiune("Suna la numar",phoneString,Actiune.ACTION_CALL));
actiune.add(new Actiune("SMS",phoneString,Actiune.ACTION_SMS));
}
String stringemail = cursor.getString(cursor.getColumnIndex("email"));
if (stringemail != null) {
actiune.add(new Actiune("Email", stringemail,Actiune.ACTION_EMAIL));
}
adapter = new ActiuneAdapter();
setListAdapter(adapter);
String stringurl = cursor.getString(cursor.getColumnIndex("url"));
if (stringurl != null) {
actiune.add(new Actiune("ADRESA URL", stringurl,Actiune.ACTION_VIEW));
}
adapter = new ActiuneAdapter();
setListAdapter(adapter);
}
}
public void onListItemClick(ListView parent, View view, int position, long id) {
Actiune action = actiune.get(position);
Intent intent;
switch (action.getType()) {
case Actiune.ACTION_CALL:
Uri callUri = Uri.parse("tel:" + action.getData());
intent = new Intent(Intent.ACTION_CALL, callUri);
startActivity(intent);
break;
case Actiune.ACTION_EMAIL:
intent = new Intent(Intent.ACTION_SEND);
intent.setType("plain/text");
intent.putExtra(Intent.EXTRA_EMAIL, new String[]{action.getData()});
startActivity(intent);
break;
case Actiune.ACTION_SMS:
Uri smsUri = Uri.parse("sms:" + action.getData());
intent = new Intent(Intent.ACTION_VIEW, smsUri);
startActivity(intent);
break;
case Actiune.ACTION_VIEW:
Uri adressuri=Uri.parse("url:"+action.getData());
intent = new Intent(Intent.ACTION_VIEW,adressuri);
startActivity(intent);
}
}
`
感謝其工作,在地圖搜索,我應該用什麼? – jonny 2011-12-30 14:35:03
您可以將uri更改爲「http://maps.google.com/maps?q= restaurant」(將您的查詢替換爲餐廳) – chiuki 2011-12-30 14:41:10