android content activitynotfoundexception 没有找到处理 Intent 的 Activity - 当试图去 url

标签 android android-intent

我正在尝试编写一个应用程序,您可以在其中输入地址,然后您将被重定向到谷歌地图。 (我想这就是所谓的隐含 Intent )

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

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 虚拟设备时,您应该选择 Google API 作为目标。如果你没有安装它们,你可以使用 SDK Manager 下载它。

看看this .

enter image description here

关于android content activitynotfoundexception 没有找到处理 Intent 的 Activity - 当试图去 url,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11525666/

相关文章:

java - android.view.InflateException : Binary XML file line #6: Error inflating class com. google.android.gms.maps.MapView

java - Android Activity 在按下后退按钮之前没有响应

android - Activity 生命周期 - startActivity() 和 extras

java - 尝试打开文件时,不同 Android 版本的 URI 方案不同

android - 从非启动器应用程序选择并启动快捷方式

Android:尝试在浏览器中打开本地 HTML 文件时,在某些设备上找不到 Activity 异常

android - 带有 ImageView 的 AlertDialog 的大小太大

java - 尝试导航到上一个 Activity 时 Intent 崩溃

java - 电子邮件 Intent 电子邮件选择器

java - 在 Android 中的 AlertDialog 中按下 OK 时返回 MainActivity