android内容activitynotfoundexception没有找到处理意图的活动 - 当试图去url时

Ken*_*Ken 5 android android-intent

我正在尝试编写一个应用程序,您可以在其中键入地址,然后重定向到谷歌地图.(我想这被称为隐含意图)

- 我已经创建了一个启动主要活动的意图,这是我应用中唯一的活动.Main活动包含一些文本,一个editfield和一个按钮.

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>
Run Code Online (Sandbox Code Playgroud)

这是按钮的代码:

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

    }

}
Run Code Online (Sandbox Code Playgroud)

Ero*_*rol 5

如果您在模拟器中对此进行测试,则情况与设备中的情况不同.

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

看看这个.

在此输入图像描述