I am trying to open a local kml file which is in my sdcard but i am getting error.In stackoverflow itself i have seen some questions related to this but they are not answered and some are not related to this.
android - how to open kml file in android
Android - How to open google maps with Intent and KML?
My code
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 Manifest file i have given this permission
<?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 Error :
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 }
Your help is greatly appreciated.Thank You