views:

71

answers:

1

I'm trying to make test-program that opens a website by pushing a button. I have made a listener and everything, my problem is just that, the url-opening-script makes an error and tells me "Uri cannot be resolved". Here's the script I use to open up an webpage:

Intent browserIntent = new Intent("android.intent.action.VIEW",Uri.parse("http://www.google.com"));  
startActivity(browserIntent);

I have the import android.app.Activity;, import android.content.Intent; and import android.content.ContentUris; (maybe the last one isn't needed) so I can't find out what's wrong...

I hope someone knows what I've done wrong, or forgot to import...

P.S. I've used this pages to get to where I am:

http://stackoverflow.com/questions/2201917/android-open-url-from-code
http://stackoverflow.com/questions/3004515/android-sending-an-intent-to-browser-to-open-specific-url

A: 

Import the Uri class. If you are using Eclipse you can hit ctrl-shift-o to add needed imports, and remove unused ones.

BrennaSoft
Thanks to BrennaSoft and bhups! You guys are the best! ;)
Robin Lilfelt