2017-01-10 108 views
0

我使用WordPress的webview應用程序。在評論區我有上傳按鈕,訪問者可以上傳照片或視頻。WebView上傳按鈕

enter image description here

當我打開應用程序,並按下選擇文件沒有任何反應。

這裏是我的MainActivity

package totalonlinesrl.noiinbucatarie; 
 

 
import android.content.Intent; 
 
import android.net.Uri; 
 
import android.support.v7.app.AppCompatActivity; 
 
import android.os.Bundle; 
 
import android.view.KeyEvent; 
 
import android.view.Window; 
 
import android.view.WindowManager; 
 
import android.webkit.URLUtil; 
 
import android.webkit.WebChromeClient; 
 
import android.webkit.WebSettings; 
 
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); 
 

 
     this.requestWindowFeature(Window.FEATURE_NO_TITLE); 
 
     this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); 
 

 
     setContentView(R.layout.activity_main); 
 

 
     webView = (WebView) findViewById(R.id.webView); 
 
     WebSettings webSettings = webView.getSettings(); 
 
     webSettings.setJavaScriptEnabled(true); 
 
     webSettings.setRenderPriority(WebSettings.RenderPriority.HIGH); 
 
     webView.loadUrl("http://website.ro"); 
 
     webView.setWebChromeClient(new WebChromeClient()); 
 
     webView.setWebViewClient(new WebViewClient() { 
 
      @Override 
 
      public boolean shouldOverrideUrlLoading(WebView view, String url) { 
 
       if(URLUtil.isNetworkUrl(url)) { 
 
        return false; 
 
       } 
 

 
       Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); 
 
       startActivity(intent); 
 
       return true; 
 
      } 
 

 
     }); 
 
    } 
 

 
    @Override 
 
    public boolean onKeyDown(int keyCode, KeyEvent event) { 
 
     if (event.getAction() == KeyEvent.ACTION_DOWN) { 
 
      switch (keyCode) { 
 
       case KeyEvent.KEYCODE_BACK: 
 
        if (webView.canGoBack()) { 
 
         webView.goBack(); 
 
        } else { 
 
         finish(); 
 
        } 
 
       case KeyEvent.KEYCODE_MENU: 
 
        webView.loadUrl("javascript:open_menu()"); 
 
        return true; 
 
      } 
 

 
     } 
 
     return super.onKeyDown(keyCode, event); 
 
    } 
 

 

 
}

,這裏是我的AndroidManifest XML

<?xml version="1.0" encoding="utf-8"?> 
 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
 
    package="totalonlinesrl.noiinbucatarie"> 
 
    android:versionCode="1" 
 
    android:versionName="1.0" > 
 

 
    <uses-sdk 
 
     android:minSdkVersion="8" 
 
     android:targetSdkVersion="23" /> 
 

 
    <uses-permission android:name="android.permission.INTERNET" /> 
 
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> 
 

 

 
    <application 
 
     android:allowBackup="true" 
 
     android:icon="@mipmap/logo" 
 
     android:label="@string/app_name" 
 
     android:supportsRtl="true" 
 
     android:theme="@style/AppTheme"> 
 
     <!-- SplashActivity --> 
 
     <activity 
 
      android:name="totalonlinesrl.noiinbucatarie.SplashActivity" 
 
      android:label="@string/app_name" 
 
      android:screenOrientation="portrait" 
 
      android:theme="@android:style/Theme.Black.NoTitleBar" > 
 
      <intent-filter> 
 
       <action android:name="android.intent.action.MAIN" /> 
 

 
       <category android:name="android.intent.category.LAUNCHER" /> 
 
      </intent-filter> 
 
     </activity> 
 

 
     <activity android:name=".MainActivity" 
 
      android:screenOrientation="portrait"> 
 
     </activity> 
 

 
     <service android:name=".MyFirebaseInstanceIdService"> 
 
      <intent-filter> 
 
       <action android:name="com.google.firebase.INSTANCE_ID_EVENT" /> 
 
      </intent-filter> 
 
     </service> 
 
     <service android:name=".MyFirebaseMessagingService"> 
 
      <intent-filter> 
 
       <action android:name="com.google.firebase.MESSAGING_EVENT" /> 
 
      </intent-filter> 
 
     </service> 
 

 
    </application> 
 

 
</manifest>

任何IDEEA?

回答