vendredi 28 octobre 2016

App crashes, WebView

the app doesn't work I don't know what am I doing wrong please help me, there is code MainActivity.java:

import android.app.Activity;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Window;
import android.webkit.WebView;
import android.webkit.WebViewClient;

public class MainActivity extends Activity {
final WebView mWebView = (WebView) findViewById(R.id.webView);
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    this.requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.activity_main);
    String url = "http://ift.tt/2e6aUCI";
    mWebView.getSettings().setJavaScriptEnabled(true);
    mWebView.loadUrl(url);
    mWebView.setWebViewClient (new WebViewClient() {
        public void onPageFinished(WebView view, String url) {
            String user="u";
            String pwd="p";
            view.loadUrl("javascript:document.getElementById('UID0').value = '"+user+"';document.getElementById('PASS0').value='"+pwd+"';");
        }
    });
}

}

Thanks for your respond guys!




Aucun commentaire:

Enregistrer un commentaire