Storing and retrieving url links
I have 300 url links that I want store, I plan to have 10 xml's, below is my code, how can I store the urls in a xml and retrieve them in this code?? I want to get the coordinates based on the users selection from a list view.
public class official extends Activity {
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if ((keyCode == KeyEvent.KEYCODE_BACK) && mWebView.canGoBack()) {
mWebView.goBack();
return true;
}
return super.onKeyDown(keyCode, event);
}
WebView mWebView;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.browser1);
mWebView = (WebView) findViewById(R.id.webview);
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.loadUrl("http://google.com");
mWebView.setWebViewClient(new HelloWebViewClient());
}
}
class HelloWebViewClient extends WebViewClient {
@Override
publi开发者_开发百科c boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return true;
}
}
If you're just storing a list of URLs, why don't you just store them as a plain text file, where each line is a new URL. Trying to put the URLs into a database or an XML file just adds extra effort (read: time, processing) when trying to read or write them.
精彩评论