App to open a website

endomorph

New Member
Hi all, new to the site and to Basic4Android.

I have been writing apps using the online providers such as Apps geyser but want to get into programming myself.

The main type of app I write is one which opens a specific website when the app is opened.

Could someone give me an example of code for this and is it possible to test on the trial version. I want to try things out before I purchase it. I have had a couple of attempts using snippets I found but when I compile it errors out saying about missing libraries.

Thanks
 
Last edited:

Ohanian

Active Member
Licensed User
Longtime User
Hi,

Here's a sample code :

B4X:
Dim intent1 As Intent
intent1.Initialize(intent1.ACTION_VIEW, "http://www.google.com")
StartActivity(intent1)

or within your app :

B4X:
Dim wvBrowser As WebView
wvBrowser.Initialize("")
Activity.AddView(wvBrowser, 0, 0, 100%x, 100%y)
wvBrowser.LoadUrl("http://www.google.com")
 
Upvote 0

endomorph

New Member
Thanks for that. The first piece worked for what I want but it opens the browser with a titled window.

I have edited the manifest to -

AddManifestText(
<uses-sdk android:minSdkVersion="4" />
<supports-screens android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
SetApplicationAttribute(android:theme, "@android:style/Theme.NoTitleBar.Fullscreen")

But it's still showing.

Any ideas ?
 
Upvote 0
Top