@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.getWindow().requestFeature(Window.FEATURE_PROGRESS);
setContentView(R.layout.main);
// Don t create another webview reference here,
// just use the one you declared at class level.
webview = (WebView) findViewById(R.id.webview);
webview.getSettings().setJavaScriptEnabled(true);
webview.loadUrl("http://www.example.com");
webview.setWebChromeClient(new WebChromeClient() {
public void onProgressChanged(WebView view, int progress)
{
activity.setTitle("Loading...");
activity.setProgress(progress * 100);
if(progress == 100)
activity.setTitle(R.string.app_name);
}
});
webview.setWebViewClient(new WebViewClient() {
@Override
public void onReceivedError(WebView view, int errorCode, String description, String failingUrl)
{
// Handle the error
}
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url)
{
if(url.startsWith("mailto:")){
MailTo mt = MailTo.parse(url);
Intent i = newEmailIntent(HelloWorld.this, mt.getBody(), mt.getSubject());
startActivity(i);
view.reload();
return true;
}
view.loadUrl(url);
return true;
}
});
}
public static Intent newEmailIntent(Context context, String body, String subject ) {
Intent intent = new Intent(Intent.ACTION_SEND);
intent.putExtra(Intent.EXTRA_EMAIL, new String[] {});
intent.putExtra(Intent.EXTRA_TEXT, body);
intent.putExtra(Intent.EXTRA_SUBJECT, subject);
intent.setType("rfc2368/html");
return intent;
}
}
• 设法在网上浏览申请中增加邮件。 当你管理申请并点击邮件,打开信使。 出于某种原因,“http://”和“?”正在被截断,没有被邮寄。 同一个邮件链接在装置正常浏览器中是完美的。 我需要获得的唯一领域是主题和机构。