2016년 3월 15일 화요일

cordova webview posturl

cordova webview posturl

import android.webkit.WebView;

import org.apache.cordova.*;
import org.apache.http.util.EncodingUtils;


public class MainActivity extends CordovaActivity
{

  private static Dialog loginDialog;


    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        
        String TRAGET_URL = "http://example.com/login/login_verify";
        String POST_DATA = "login_id=test&login_pass=1111";
        postUrl(TRAGET_URL,POST_DATA);
    }

    /**
     * Load the url into the webview.
     */
    public void postUrl(String url,String data) {
        if (appView == null) {
            init();
        }

        // If keepRunning
        this.keepRunning = preferences.getBoolean("KeepRunning", true);

        //appView.lo
        WebView mWebView = (WebView) appView.getView();


        // WebView mWebView = (WebView) findViewById(R.id.mWebView); // WHERE R.id.mWebView is of course webview in your layout file.

        mWebView.postUrl(url,
                EncodingUtils.getBytes(data, "BASE64"));

    }

}

댓글 없음:

댓글 쓰기

3gb minning

비트코인 골드 -- 마이너 다운로드 :  https://www.bminercontent.com/releases/bminer-v6.0.0-d111154-amd64.zip -- vcruntime140.dll 다운로드  https://www.micr...