The following code works fine on Motorola Atrix, but gives an error on Motorola Droid:
String afterSubmitActionFinal = "file:///sdcard/end_wk.html";
Uri uri = Uri.parse(afterSubmitActionFinal);
startActivity(new Intent(Intent.ACTION_VIEW, uri));
I know that the file exists in the Droid. In fact if I enter the exact same string, "file:///sdcard/end_wk.html", in the browser address bar the file shows up.
Not sure what is going on. Here is the Logcat:
05-23 16:38:18.441: ERROR/AndroidRuntime(4803): FATAL EXCEPTION: main
05-23 16:38:18.441: ERROR/AndroidRuntime(4803): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=file:///sdcard/end_wk.html }
05-23 16:38:18.441: ERROR/AndroidRuntime(4803): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1408)
05-23 16:38:18.441: ERROR/AndroidRuntime(4803): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1378)
05-23 16:38:18.441: ERROR/AndroidRuntime(4803): at android.app.Activity.startActivityForResult(Activity.java:2817)
05-23 16:38:18.441: ERROR/AndroidRuntime(4803): at android.app.Activity.startActivity(Activity.java:2923)
05-23 16:38:18.441: ERROR/AndroidRuntime(4803): at com.my.IdentificationScreen$9.onAnimationEnd(IdentificationScreen.java:612)
05-23 16:38:18.441: ERROR/AndroidRuntime(4803): at android.view.animation.AnimationSet.getTransformation(AnimationSet.java:331)
05-23 16:38:18.441: ERROR/AndroidRuntime(4803): at android.view.ViewGroup.drawChild(ViewGroup.java:1505)
05-23 16:38:18.441: ERROR/AndroidRuntime(4803): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367)
05-23 16:38:18.441: ERROR/AndroidRuntime(4803): at android.view.View.draw(View.java:6743)
05-23 16:38:18.441: ERROR/AndroidRuntime(4803): at android.widget.FrameLayout.draw(FrameLayout.java:352)
05-23 16:38:18.441: ERROR/AndroidRuntime(4803): at android.view.ViewGroup.drawChild(ViewGroup.java:1640)
05-23 16:38:18.441: ERROR/AndroidRuntime(4803): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367)
05-23 16:38:18.441: ERROR/AndroidRuntime(4803): at android.view.ViewGroup.drawChild(ViewGroup.java:1638)
05-23 16:38:18.441: ERROR/AndroidRuntime(4803): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367)
05-23 16:38:18.441: ERROR/AndroidRuntime(4803): at android.view.View.draw(View.java:6743)
05-23 16:38:18.441: ERROR/AndroidRuntime(4803): at android.widget.FrameLayout.draw(FrameLayout.java:352)
05-23 16:38:18.441: ERROR/AndroidRuntime(4803): at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:1842)
05-23 16:38:18.441: ERROR/AndroidRuntim开发者_Go百科e(4803): at android.view.ViewRoot.draw(ViewRoot.java:1407)
05-23 16:38:18.441: ERROR/AndroidRuntime(4803): at android.view.ViewRoot.performTraversals(ViewRoot.java:1163)
05-23 16:38:18.441: ERROR/AndroidRuntime(4803): at android.view.ViewRoot.handleMessage(ViewRoot.java:1727)
05-23 16:38:18.441: ERROR/AndroidRuntime(4803): at android.os.Handler.dispatchMessage(Handler.java:99)
05-23 16:38:18.441: ERROR/AndroidRuntime(4803): at android.os.Looper.loop(Looper.java:123)
05-23 16:38:18.441: ERROR/AndroidRuntime(4803): at android.app.ActivityThread.main(ActivityThread.java:4627)
05-23 16:38:18.441: ERROR/AndroidRuntime(4803): at java.lang.reflect.Method.invokeNative(Native Method)
05-23 16:38:18.441: ERROR/AndroidRuntime(4803): at java.lang.reflect.Method.invoke(Method.java:521)
05-23 16:38:18.441: ERROR/AndroidRuntime(4803): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
05-23 16:38:18.441: ERROR/AndroidRuntime(4803): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
05-23 16:38:18.441: ERROR/AndroidRuntime(4803): at dalvik.system.NativeStart.main(Native Method)strong text
EDIT: On suggestion from a poster, I checked out the browsers as listed in technical specs on both phones:
Motorola Droid has 'Android HTML Webkit'Motorola Atrix also has 'Android HTML Webkit'
Both phones have version 2.2.2
This is really mysterious.
There are 2 possibilities for me.
1) One phone doesn't have regular android browser (like the galaxy tab) And one of the default browser doesn't support this type of intent.
2) All phone have a mounted sdcard ?
精彩评论