For post data to web-view using Android.
Use method postUrl in your java code. Refer below code for post data using web-view.
import org.apache.http.util.EncodingUtils;
public class Example extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
WebView webview = new WebView(this);
setContentView(webview);
String url = "http://www.example.com";
String postData = username=my_username&password=my_password";
webview.postUrl(url",EncodingUtils.getBytes(postData, "BASE64"));
}  
}
 
No comments:
Post a Comment