Fix use of WebView.loadData() to avoid passing invalid encoding
No change in behavior, as invalid encodings have always been ignored. Bug: 5125738 Change-Id: Ice8ccc2b82e3c5d28169788321dfbbfadb29b392
This commit is contained in:
@@ -37,7 +37,7 @@ public class Focus1 extends Activity {
|
||||
WebView webView = (WebView) findViewById(R.id.rssWebView);
|
||||
webView.loadData(
|
||||
"<html><body>Can I focus?<br /><a href=\"#\">No I cannot!</a>.</body></html>",
|
||||
"text/html", "utf-8");
|
||||
"text/html", null);
|
||||
|
||||
ListView listView = (ListView) findViewById(R.id.rssListView);
|
||||
listView.setAdapter(new ArrayAdapter<String>(this,
|
||||
|
||||
@@ -35,38 +35,37 @@ public class WebView1 extends Activity {
|
||||
setContentView(R.layout.webview_1);
|
||||
|
||||
final String mimeType = "text/html";
|
||||
final String encoding = "utf-8";
|
||||
|
||||
WebView wv;
|
||||
|
||||
wv = (WebView) findViewById(R.id.wv1);
|
||||
wv.loadData("<a href='x'>Hello World! - 1</a>", mimeType, encoding);
|
||||
wv.loadData("<a href='x'>Hello World! - 1</a>", mimeType, null);
|
||||
|
||||
wv = (WebView) findViewById(R.id.wv2);
|
||||
wv.loadData("<a href='x'>Hello World! - 2</a>", mimeType, encoding);
|
||||
wv.loadData("<a href='x'>Hello World! - 2</a>", mimeType, null);
|
||||
|
||||
wv = (WebView) findViewById(R.id.wv3);
|
||||
wv.loadData("<a href='x'>Hello World! - 3</a>", mimeType, encoding);
|
||||
wv.loadData("<a href='x'>Hello World! - 3</a>", mimeType, null);
|
||||
|
||||
wv = (WebView) findViewById(R.id.wv4);
|
||||
wv.loadData("<a href='x'>Hello World! - 4</a>", mimeType, encoding);
|
||||
wv.loadData("<a href='x'>Hello World! - 4</a>", mimeType, null);
|
||||
|
||||
wv = (WebView) findViewById(R.id.wv5);
|
||||
wv.loadData("<a href='x'>Hello World! - 5</a>", mimeType, encoding);
|
||||
wv.loadData("<a href='x'>Hello World! - 5</a>", mimeType, null);
|
||||
|
||||
wv = (WebView) findViewById(R.id.wv6);
|
||||
wv.loadData("<a href='x'>Hello World! - 6</a>", mimeType, encoding);
|
||||
wv.loadData("<a href='x'>Hello World! - 6</a>", mimeType, null);
|
||||
|
||||
wv = (WebView) findViewById(R.id.wv7);
|
||||
wv.loadData("<a href='x'>Hello World! - 7</a>", mimeType, encoding);
|
||||
wv.loadData("<a href='x'>Hello World! - 7</a>", mimeType, null);
|
||||
|
||||
wv = (WebView) findViewById(R.id.wv8);
|
||||
wv.loadData("<a href='x'>Hello World! - 8</a>", mimeType, encoding);
|
||||
wv.loadData("<a href='x'>Hello World! - 8</a>", mimeType, null);
|
||||
|
||||
wv = (WebView) findViewById(R.id.wv9);
|
||||
wv.loadData("<a href='x'>Hello World! - 9</a>", mimeType, encoding);
|
||||
wv.loadData("<a href='x'>Hello World! - 9</a>", mimeType, null);
|
||||
|
||||
wv = (WebView) findViewById(R.id.wv10);
|
||||
wv.loadData("<a href='x'>Hello World! - 10</a>", mimeType, encoding);
|
||||
wv.loadData("<a href='x'>Hello World! - 10</a>", mimeType, null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,12 +95,12 @@ public class MyRssReader5 extends Activity implements OnItemSelectedListener {
|
||||
mLogger.warning("MyRssReader5.onItemSelected() couldn't get the content" +
|
||||
"from the cursor " + e.getMessage());
|
||||
}
|
||||
mWebView.loadData(content, "text/html", "utf-8");
|
||||
mWebView.loadData(content, "text/html", null);
|
||||
}
|
||||
//END_INCLUDE(5_4)
|
||||
|
||||
public void onNothingSelected(AdapterView parent){
|
||||
mWebView.loadData("<html><body><p>No selection chosen</p></body></html>", "text/html", "utf-8");
|
||||
mWebView.loadData("<html><body><p>No selection chosen</p></body></html>", "text/html", null);
|
||||
}
|
||||
|
||||
// Store our state before we are potentially bumped from memory.
|
||||
|
||||
Reference in New Issue
Block a user