[英]android ACTION_WEB_search not working
I am not able to get the ACTION_WEB_SEARCH to work correctly, does this require any permissions on the AndriodManifest.xml? 我无法使ACTION_WEB_SEARCH正常工作,这是否需要AndriodManifest.xml的任何权限?
The other ACTIONS work(email,call,sms).Also how to make a map search ? 其他ACTIONS工作(电子邮件,电话,短信)。还如何进行地图搜索? what Action to use is there any action_searchmap?
使用什么动作,有没有action_searchmap? here is the error i get when try to go to an url
这是我尝试转到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)
my java code is: ` if (cursor.getCount() == 1) { cursor.moveToFirst(); 我的Java代码是:`if(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);
}
}
` `
如果是ACTION_VIEW
,请从uri中删除url:
::
Uri adressuri = Uri.parse(action.getData());
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.