Hi,
I created a very simple webview app in Android Studio (I'm a website developer so not really an app developer).
The site is a standard html5 css3 site that allows skiers to sell and buy used ski gear, so it uses auction technology.
Part of the listing process involves clicking an 'Add Images' button which allows users to navigate to images on the devices/cloud storage, but, on the Android webview app all I see is a button that says 'Choose Files' (NOT 'Add Images', which is weird), but when I click it nothing happens, which means that the app is essentially useless as is.
I obviously need to tweek the code (I use Android Studio 3.5.1), but I don't know what code to tweek.
Can you help?
Code below
Activity.main.xml
MainActivity.java
AndroidManifest.xml
I created a very simple webview app in Android Studio (I'm a website developer so not really an app developer).
The site is a standard html5 css3 site that allows skiers to sell and buy used ski gear, so it uses auction technology.
Part of the listing process involves clicking an 'Add Images' button which allows users to navigate to images on the devices/cloud storage, but, on the Android webview app all I see is a button that says 'Choose Files' (NOT 'Add Images', which is weird), but when I click it nothing happens, which means that the app is essentially useless as is.
I obviously need to tweek the code (I use Android Studio 3.5.1), but I don't know what code to tweek.
Can you help?
Code below
Activity.main.xml
Code:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<WebView
android:id="@+id/wb"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</RelativeLayout>
MainActivity.java
Java:
package com.shnohdotcom.shnoh;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.webkit.WebView;
import android.webkit.WebViewClient;
public class MainActivity extends AppCompatActivity {
private WebView webView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
webView= findViewById(R.id.wb);
webView.loadUrl("https://www.shnoh.com/");
webView.getSettings().setJavaScriptEnabled(true);
webView.setWebViewClient (new WebViewClient());
}
}
AndroidManifest.xml
Code:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.shnohdotcom.shnoh">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.AppCompat.NoActionBar">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>