SD カードにあるローカル kml ファイルを開こうとしていますが、エラーが発生しています。
Android - Androidでkmlファイルを開く方法
Android - インテントとKMLでGoogleマップを開く方法は?
私のコード
public void openKMLFile(View v)
final Intent myIntent = new Intent(android.content.Intent.ACTION_VIEW,
Uri.parse("geo:0,0?q=file://" + Environment.getExternalStorageDirectory() + "/test.kml"));
startActivity(myIntent);
}
この許可を与えたAndroidマニフェストファイル
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.demo"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="16" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.example.demo.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Logcat エラー:
04-05 11:42:01.806: E/AndroidRuntime(833): FATAL EXCEPTION: main
04-05 11:42:01.806: E/AndroidRuntime(833): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.demo/com.example.demo.MainActivity}: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=geo:0,0?q=file:///mnt/sdcard/10.kml }
04-05 11:42:01.806: E/AndroidRuntime(833): Caused by: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=geo:0,0?q=file:///mnt/sdcard/10.kml }
どうぞよろしくお願いいたします。