Reputation: 63
I have an application which loads data via Activity --> onStart() --> new LoadTask through AsyncTask --> onPosExecute() --> ListView --> listView.setOnItemClickListener() --> onItemClick() -->Creates Webview
After clicking on the listView, the WebView is invoked to show further details but when you click to go back from the WebView to the listView instead the application exits. Any help would be greatly appreciated on this.
Upvotes: 1
Views: 289
Reputation: 1543
A hacky way around this admittedly odd behaviour would be overwriting the back button. It's generally not accepted when making the app perform not-as-the-user-expects-it-to, but in your case it might be of some help.
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
startActivity(new Intent(myClass.this, ListViewClass.class));
return true;
}
return super.onKeyDown(keyCode, event);
}
Upvotes: 0
Reputation: 3818
I think you use this code in onItemClick()
finish()
to finish your activity Remove this(finish();
) code when you call the Intent to open the webView
Upvotes: 1