2017-01-10 7 views
0

私はwebviewアプリにwordpressを使用しています。コメントゾーンには、アップロードボタンがあり、訪問者は写真やビデオをアップロードできます。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あるのですか?

答えて

0
+0

私はWebViewの機能を使用すると、このメソッドは動作しないためにこれが役立つかもしれない。このリンクを参照してください!どうも –

関連する問題