I'm trying to open a xml file with default application on the phone when clicking a button of my app. after google i found and followed this: http://www.androidsnippets.com/open-file-with-default-application-using-intents , my code is just as:
Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(_file), "application/*");
startActivity(intent);
it works on my phone, but the logcat got some errors:
01-07 02:42:48.242: E/ActivityThread(11280): Activity com.android.internal.app.ChooserActivity has leaked IntentReceiver com.android.internal.app.ResolverActivity$1@417ffc78 that was originally registered here. Are you missing a call to unregisterReceiver()?
01-07 02:42:48.242: E/ActivityThread(11280): android.app.IntentReceiverLeaked: Activity com.android.internal.app.ChooserActivity has leaked IntentReceiver com.android.internal.app.ResolverActivity$1@417ffc78 that was originally registered here. Are you missing a call to unregisterReceiver()?
01-07 02:42:48.242: E/ActivityThread(11280): at android.app.LoadedApk$ReceiverDispatcher.<init>(LoadedApk.java:763)
01-07 02:42:48.242: E/ActivityThread(11280): at android.app.LoadedApk.getReceiverDispatcher(LoadedApk.java:567)
01-07 02:42:48.242: E/ActivityThread(11280): at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:1055)
01-07 02:42:48.242: E/ActivityThread(11280): at android.app.ContextImpl.registerReceiver(ContextImpl.java:1042)
01-07 02:42:48.242: E/ActivityThread(11280): at android.app.ContextImpl.registerReceiver(ContextImpl.java:1036)
01-07 02:42:48.242: E/ActivityThread(11280): at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:341)
01-07 02:42:48.242: E/ActivityThread(11280): at com.android.internal.content.PackageMonitor.register(PackageMonitor.java:65)
01-07 02:42:48.242: E/ActivityThread(11280): at com.android.internal.app.ResolverActivity.onCreate(ResolverActivity.java:99)
01-07 02:42:48.242: E/ActivityThread(11280): at com.android.internal.app.ChooserActivity.onCreate(ChooserActivity.java:53)
01-07 02:42:48.242: E/ActivityThread(11280): at android.app.Activity.performCreate(Activity.java:4467)
01-07 02:42:48.242: E/ActivityThread(11280): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
01-07 02:42:48.242: E/ActivityThread(11280): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1925)
01-07 02:42:48.242: E/ActivityThread(11280): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1986)
01-07 02:42:48.242: E/ActivityThread(11280): at android.app.ActivityThread.access$600(ActivityThread.java:128)
01-07 02:42:48.242: E/ActivityThread(11280): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1152)
01-07 02:42:48.242: E/ActivityThread(11280): at android.os.Handler.dispatchMessage(Handler.java:99)
01-07 02:42:48.242: E/ActivityThread(11280): at android.os.Looper.loop(Looper.java:137)
01-07 02:42:48.242: E/ActivityThread(11280): at android.app.ActivityThread.main(ActivityThread.java:4449)
01-07 02:42:48.242: E/ActivityThread(11280): at java.lang.reflect.Method.invokeNative(Native Method)
01-07 02:42:48.242: E/ActivityThread(11280): at java.lang.reflect.Method.invoke(Method.java:511)
01-07 02:42:48.242: E/ActivityThread(11280): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:787)
01-07 02:42:48.242: E/ActivityThread(11280): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:554)
01-07 02:42:48.242: E/ActivityThread(11280): at dalvik.system.NativeStart.main(Native Method)
I didn't register anything, and don't know how to fix that "Are you missing a call to unregisterReceiver()", how can i change my code?