Try this:
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.google.com")); startActivity(browserIntent);
That works fine for me.
As for the missing “http://” I’d just do something like this:
if (!url.startsWith("http://") && !url.startsWith("https://")) url = "http://" + url;
I would also probably pre-populate your EditText that the user is typing a URL in with “http://”.
Related Posts:
- Android – Adding at least one Activity with an ACTION-VIEW intent-filter after Updating SDK version 23
- How to use putExtra() and getExtra() for string data
- How do I get the dialer to open with phone number displayed?
- Parcelable encountered IOException writing serializable object getactivity()
- Sending an Intent to browser to open specific URL
- Android : When do we use getIntent()?
- Android Intent Cannot resolve constructor
- setOnClickListener error – cannot resolve symbol
- What is the meaning of android.intent.action.MAIN?
- How do I get the currently displayed fragment?
- Android Overriding onBackPressed()
- Android: No Activity found to handle Intent error? How it will resolve
- Emulator: ERROR: x86 emulation currently requires hardware acceleration
- Emulator: ERROR: x86 emulation currently requires hardware acceleration
- How to use navigateUp to close the application
- “unable to locate adb” using Android Studio [duplicate]
- Install an apk file from command prompt?
- My users get “net::err_name_not_resolved”
- Error: No toolchains found in the NDK toolchains folder for ABI with prefix: llvm
- Solving “adb server version doesn’t match this client” error [duplicate]
- Can’t create handler inside thread that has not called Looper.prepare()
- This adb server’s $ADB_VENDOR_KEYS is not set
- E: unable to locate package pip
- What are the possible reasons for NFC Service to become dead after some time?
- Simple Android RecyclerView example
- What is ‘Context’ on Android?
- android image button
- What causes signal ‘SIGILL’?
- Change project name on Android Studio
- Execution failed for task ‘:app:processDebugResources’ even with latest build tools
- Set adb vendor keys
- react-native: command not found
- Is there an equivalent to iOS’s Keychain for user credentials on Android?
- How to: Install Plugin in Android Studio
- No matching client found for package name (Google Analytics) – multiple productFlavors & buildTypes
- What’s LazyList?
- No Network Security Config specified, using platform default – Android Log
- getBluetoothService called with no BluetoothManagerCallback
- java.lang.RuntimeException: Unable to instantiate activity ComponentInfo
- What is Dalvik and dalvik-cache?
- How to pause / sleep thread or process in Android?
- Android auth firebase error: Local module descriptor class for com.google.firebase.auth not found
- com.android.ide.common.process.ProcessException: Failed to execute aapt! What can I do?
- Could not find com.android.tools.build:gradle:3.0.1
- Execution failed for task ‘:app:compileDebugJavaWithJavac’ Android Studio 3.1 Update
- Could not find com.android.tools.build:gradle:3.0.1
- Error message ‘java.net.SocketException: socket failed: EACCES (Permission denied)’
- How to use su command over adb shell?
- Picasso v/s Imageloader v/s Fresco vs Glide vs Coil
- Save bitmap to location
- onActivityResult() not called
- How to resolve the “ADB server didn’t ACK” error?
- Custom Adapter for List View
- findViewByID returns null
- Android Studio 1.2.1.1 – Failed to find style ‘textViewStyle’
- First run of Android Studio. Unable to access Android SDK add-on list
- Java syntax explanation – getMenuInflater()
- Get Value of a Edit Text field
- Android Studio doesn’t see device
- Static way to get ‘Context’ in Android?
- What are the differences between LinearLayout, RelativeLayout, and AbsoluteLayout?
- How to install Google Play Services in a Genymotion VM (with no drag and drop support)?
- Running Node.Js on Android
- Android Device not recognized by adb
- How do you change text to bold in Android?
- Android ADB doesn’t see device
- Android Facebook integration with invalid key hash
- Android dismiss keyboard
- How to decompile an android app from the google play store
- How do I center text horizontally and vertically in a TextView?
- What exactly does fitsSystemWindows do?
- What can com.sec.android.app.launcher be used for?
- Android: How can I Convert String to Date?
- How to create custom button in Android using XML Styles
- Your content must have a ListView whose id attribute is ‘android.R.id.list’
- Android SDK path not specified
- Failed to connect to camera service
- the item you requested is not available for purchase
- How to create a file in Android?
- Can I underline text in an Android layout?
- This Activity already has an action bar supplied by the window decor
- getResources().getColor() is deprecated
- What’s the console.log() of java?
- USB Debugging option greyed out
- Get JSON Data from URL Using Android?
- Android Drawing Separator/Divider Line in Layout?
- Re-enable “component tree” in Android Studio
- XML has empty body?
- “Gradle Version 2.10 is required.” Error
- Singleton in Android
- Android getResources().getDrawable() deprecated API 22
- How to hide popping up Google Play’s unlocked achievement programatically?
- Error during installing HAXM, VT-X not working
- Error: fix the version conflict (google-services plugin)
- User Operation is waiting for “Building Workspace”
- Android Studio – ADB Error – “…device unauthorized. Please check the confirmation dialog on your device.”
- What is android:ems attribute in Edit Text? [duplicate]
- Android scale animation on view
- How can I give access to WordPress site using an Android application ?
- Viewing statistics on self hosted site from Android WordPress app