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"));

    }

}

댓글 없음:

댓글 쓰기

eclipse rcp dialog resize

  Dialog 안에 메소드를 만든다. private void autoResize(){     getShell().layout( true, true);     final Point newSize = getShell().computeSize...