Here's an overview of my program:
Android 2.2
- MainActivity (tabhost)
4 Tabs
- Search (uses SearchActivity) (default)
- Artists (uses ArtistsActivity)
- Albums (uses AlbumsActivity)
- Songs (uses SongsActivity)
The app loads up to the default Search tab and SearchActivity. I can type in a search string and click search (this stores data in a global variables class). Now when I manually click on the Artists tab, it loads ArtistsActivity and the appropriate view and it grabs data from this global variables class and does stuff.
I can manually click on all tabs and switch between the tabs just fine.
However, if I use any type of setCurrentTab command to automatically switch to the next tab for the user, the program crashes with a null pointer exception.
I've tried multiple different methods I found online and not a single one of them worked.
The apps works completely fine with manually clicking tabs as a user. But I need to program this ability to happen automatically.
Example for what needs to happen automatically: App Loads->SearchTab->User types in search string and clicks Search button->ArtistsTab
It doesn't make any sense. Why can't I program the ability to automatically switch to the next tab when I can manually switch to the next tab as a user by clicking on it? It already works just fine, I just need to replicate the action of clicking on these tabs within the code so the user doesn't have to manually click the next tab.
Anyone have any suggestions?