【问题标题】:android content activitynotfoundexception no activity found to handle intent - when trying to go to urlandroid content activitynotfoundexception 未找到处理意图的活动 - 尝试转到 url 时
【发布时间】:2015-08-03 14:34:46
【问题描述】:

我正在尝试编写一个应用程序,您可以在其中输入地址,然后将您重定向到谷歌地图。 (我想这叫做隐式意图)

-我已经创建了启动主要活动的意图,这是我的应用程序中唯一的活动。 Main 活动由一些文本、一个编辑字段和一个按钮组成。

AndroidManifest.xml:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.where_do_you_live"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="15" />

<application
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name=".MainActivity"
        android:label="@string/title_activity_main" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>
<uses-permission android:name="android.permission.INTERNET" />

</manifest>

这是按钮的代码:

public void Button1Click(View view)
{       
    try
    {
        addressField=(EditText)findViewById(R.id.address);

        String address=addressField.getText().toString();
        address=address.replace(' ','+');
        Intent geoIntent=new Intent(android.content.Intent.ACTION_VIEW,
            Uri.parse("geo:0,0?q=" + address));
        startActivity(geoIntent);

    }

    catch(Exception e)
    {
        TextView tv=(TextView)findViewById(R.id.textView1);
        tv.setText(e.toString());
        //finding stuff

    }

}

【问题讨论】:

  • 您确定您的设备上安装了谷歌地图吗?
  • 设备是模拟器,我必须这样做吗?

标签: android android-intent


【解决方案1】:

如果您在模拟器中进行测试,情况与在设备中不同。

创建 Android 虚拟设备时,应选择 Google API 作为目标。如果您没有安装它们,您可以使用 SDK Manager 下载它。

看看this

【讨论】:

  • 当我在谷歌地图中显示点并按下谷歌按钮时,我在真实设备中遇到了这个问题
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2011-05-15
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-08-24
  • 1970-01-01
相关资源
最近更新 更多