Thanks Marina, you're right, it's working now with the "http://" prefix. What a stupid error!!
On Thursday, January 23, 2014 10:06:15 AM UTC-8, Marina Cuello wrote: > > Does it work if you add "http://" to your URL? > > It sounds like your device/emulator has no application to handle the > browsing (right word?) of that kind of data (an URI with no protocol > declared). > > Marina > > > On Thu, Jan 23, 2014 at 2:11 PM, Stanley Lei > <[email protected]<javascript:> > > wrote: > >> Hi all, >> >> I'm working on the APP to show multiple images with Fragment which >> contains an ImageView control. And I also set the onClickListener for the >> image view to open some URL with startActivity. But unfortunately, the App >> crashed with ActivityNotFoundException. Below is the code and the error >> messages, can anyone give me some suggestion about this issue? Thanks in >> advance. >> >> @Override >> public View onCreateView(LayoutInflater inflater, ViewGroup >> container, >> Bundle savedInstanceState) { >> View v = inflater.inflate(R.layout.ad_fragment_layout, container, >> false); >> imgView = (ImageView)v.findViewById(R.id.ad_image); >> if (!loadImageFromFile()) { >> imgView.setImageResource(mRes); >> } >> >> >> imgView .setOnClickListener(new OnClickListener() { >> >> @Override >> public void onClick(View v) { >> Intent i = new Intent(Intent.ACTION_VIEW); >> i.addCategory(Intent.CATEGORY_BROWSABLE); >> i.setData(Uri.parse("www.google.com")); >> getActivity().startActivity(i); >> }}); >> return v; >> } >> >> The error message: >> >> 01-23 08:23:37.439: E/AndroidRuntime(7032): FATAL EXCEPTION: main >> 01-23 08:23:37.439: E/AndroidRuntime(7032): Process: com.mppp, PID: 7032 >> 01-23 08:23:37.439: E/AndroidRuntime(7032): >> android.content.ActivityNotFoundException: No Activity found to handle >> Intent { act=android.intent.action.VIEW >> cat=[android.intent.category.BROWSABLE] dat=www.google.com } >> 01-23 08:23:37.439: E/AndroidRuntime(7032): at >> android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1723) >> 01-23 08:23:37.439: E/AndroidRuntime(7032): at >> android.app.Instrumentation.execStartActivity(Instrumentation.java:1491) >> 01-23 08:23:37.439: E/AndroidRuntime(7032): at >> android.app.Activity.startActivityForResult(Activity.java:3436) >> 01-23 08:23:37.439: E/AndroidRuntime(7032): at >> android.app.Activity.startActivityForResult(Activity.java:3393) >> 01-23 08:23:37.439: E/AndroidRuntime(7032): at >> android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:824) >> 01-23 08:23:37.439: E/AndroidRuntime(7032): at >> android.app.Activity.startActivity(Activity.java:3644) >> 01-23 08:23:37.439: E/AndroidRuntime(7032): at >> android.app.Activity.startActivity(Activity.java:3607) >> 01-23 08:23:37.439: E/AndroidRuntime(7032): at >> com.mppp.app.view.main.ADFragment$2.onClick(ADFragment.java:74) >> 01-23 08:23:37.439: E/AndroidRuntime(7032): at >> android.view.View.performClick(View.java:4456) >> 01-23 08:23:37.439: E/AndroidRuntime(7032): at >> android.view.View$PerformClick.run(View.java:18462) >> 01-23 08:23:37.439: E/AndroidRuntime(7032): at >> android.os.Handler.handleCallback(Handler.java:733) >> 01-23 08:23:37.439: E/AndroidRuntime(7032): at >> android.os.Handler.dispatchMessage(Handler.java:95) >> 01-23 08:23:37.439: E/AndroidRuntime(7032): at >> android.os.Looper.loop(Looper.java:136) >> 01-23 08:23:37.439: E/AndroidRuntime(7032): at >> android.app.ActivityThread.main(ActivityThread.java:5102) >> 01-23 08:23:37.439: E/AndroidRuntime(7032): at >> java.lang.reflect.Method.invokeNative(Native Method) >> 01-23 08:23:37.439: E/AndroidRuntime(7032): at >> java.lang.reflect.Method.invoke(Method.java:515) >> 01-23 08:23:37.439: E/AndroidRuntime(7032): at >> com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779) >> 01-23 08:23:37.439: E/AndroidRuntime(7032): at >> com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) >> 01-23 08:23:37.439: E/AndroidRuntime(7032): at >> dalvik.system.NativeStart.main(Native Method) >> >> -- >> You received this message because you are subscribed to the Google >> Groups "Android Developers" group. >> To post to this group, send email to >> [email protected]<javascript:> >> To unsubscribe from this group, send email to >> [email protected] <javascript:> >> For more options, visit this group at >> http://groups.google.com/group/android-developers?hl=en >> --- >> You received this message because you are subscribed to the Google Groups >> "Android Developers" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] <javascript:>. >> For more options, visit https://groups.google.com/groups/opt_out. >> > > -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en --- You received this message because you are subscribed to the Google Groups "Android Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.

