I have a listview with some items and each item points to a webpage. When I click items webpage opens in default browser without any problem. But when I'm done with webpage and press on device's back button, it quits the browser and goes straight into home screen. I want it to go back into application (listview) instead. How can I do it?
I tried different devices and the result is still the same. I even tried with my Samsung Note 10.1 tablet. This tablet has a widget called "Active applications" that shows all running applications in a window. Now, when I run my application and click on device's home button it goes on home screen and I see my application in "active applications" window. But when I click an Item on my listview I see home screen for a split of a second and then it opens default browser but if I click on home button while browser is open, I only see that browser in "active applications" window. My application is destroyed before it opens the browser.
My onItemClickListener method looks like this:
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
String[] urls = getResources().getStringArray(R.array.ticket_sale_url);
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(urls[position]));
startActivity(browserIntent);
}
});