60
❘
ChAPter 2
using Views to design the user interFAce
loading from a string
Besides
loading the content of the
WebView
from the web, you can also load it from a string, like this:
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
WebView webView = (WebView) findViewById(R.id.WebView01);
webView.setWebViewClient(new Callback());
WebSettings webSettings = webView.getSettings();
webSettings.setBuiltInZoomControls(true);
//---Part 1---
//webView.loadUrl(
"http://www.android.com/images/whatsnew/jb-new-logo.png");
final String mimeType = "text/html";
final String encoding = "UTF-8";
String html =
"" +
"
The quick brown fox jumps over the lazy dog
The quick brown fox jumps over the lazy dog
market_icon.png" />
" +
"
The quick brown fox jumps over the lazy dogDo'stlaringiz bilan baham: