Android Question Issue with webview

microbox

Active Member
Licensed User
Longtime User
Hello everyone...I'm having an issue displaying web content using webview. I'm using the following code
B4X:
If Position = 11 Then ' Hazard map
        Log(Position)
        vPosition = Position
        playMedia
        strDialog = "Provides motorists and passengers of the traffic situation around the city."
        Dim sf As Object = DetailsDialog.ShowAsync(items(Position ), "", "Cancel", "", LoadBitmap(File.DirAssets,images(Position ) & ".png"), False)
        DetailsDialog.SetSize(100%x, ht)
        Wait For (sf) Dialog_Ready(pnl As Panel)
        pnl.LoadLayout("detailsDialog2") ' Webpage
        WebView1.LoadUrl("http://www.hazardmap.tacloban.gov.ph")
        cv5.Initialize("",0,Array As Int(Colors.Gray,Colors.LightGray,Colors.LightGray, Colors.Gray))
        pnl.AddView(cv5,50%x-55dip,40%y,50dip,50dip)
        AnimateIt(pnl)
        cv5.Visible = True
    End If

And in the manifest
B4X:
AddManifestText(
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="28"/>

I noticed after compiling that the trouble only occur when I change android:targetSdkVersion="26" to android:targetSdkVersion="28". Using sdk 26 has no problem at all but I need to use sdk 28, is there a way to resolve this?

Best regards,
microbox
 

DonManfred

Expert
Licensed User
Longtime User
android.jar / targetSdkVersion / minSdkVersion

check SDK 28-Items...

especially
- 28 - Non-ssl (non-https) communication is not permitted by default. It can be enabled in B4A v9+ by adding this line to the manifest editor:
Code:
CreateResourceFromFile(Macro, Core.NetworkClearText)
 
Upvote 0

microbox

Active Member
Licensed User
Longtime User
@DonManfred I tried your suggestion but the app crash and starts with this error message
B4X:
java.lang.RuntimeException: Unable to start activity ComponentInfo{rescue9.com/rescue9.com.main}: java.lang.NullPointerException

But when I removed CreateResourceFromFile(Macro, Core.NetworkClearText) from the manifest and just remain the the following line
B4X:
AddManifestText(
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="28"/>
<supports-screens android:largeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true"
    android:anyDensity="true"/>)

The web content displays fine now.
 
Upvote 0
Top