Solving this issue took me several days of investigation and research.
The structure of my app is the following:
Three tabs are set for this TabHost.
Each tab click opens proper ListView page.
OnClick action for ListView item opens proper Activity, which was done, by the following code:
Intent intent = new Intent(this, newActivity.class); this.startActivity(intent);
The problem was, that newActivity was opened in new Window, but I wanted to open it in the same window.
Asking for help on stackoverflow.com didn’t help.
And then suddenly I found the following solution Experience – Multiple Android Activities in a TabActivity
Now my code to run newActivity look as following:
TabGroupActivity parentActivity = (TabGroupActivity)getParent(); parentActivity.onBackPressed(); Intent newIntent = new Intent(getParent(), newActivity.class); parentActivity.startChildActivity("newActivity", newIntent);
Note: if you have any kind of Widget functionality, which pop-ups in your View, then make sure, that getParent() is used for Context.
hello, i need your help
as you said
OnClick action for ListView item opens proper Activity, which was done, by the following code:
1Intent intent = new Intent(this, newActivity.class);
2this.startActivity(intent);
i want the same thing in my app and i have been searching around for like 40 days , on stackoverflow, xda and all , what i want actually is it should be a simle listview displaying some items like apple,mango,orange
and when the user clicks an item, he will be taken to some other activity
so, the question is How do i implement onlistitem click listener ?
please help! , im stuck
please give me an example code
waiting for your reply…
Hi,
take a look on my code for SimpleList implementation.