I am developing android app and app having action bar contain refresh button and overflow menu and below action bar having two stacked tab. when i click on refresh button individual tab will be refreshed for that task i want to call inner class from outer class using intent so i can refresh the inner class from server.
when i try to call inner class from outer class using intent i encountered exception like ActivityNotfound exception but i already mention inner class in manifest after solved . i tried lot of way but didn't worked.
following is the my class structure
public class Fragment extends SherlockFragmentActivity {
ActionBar actionBar = getSupportActionBar();
actionBar.setDisplayHomeAsUpEnabled(false);
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
Tab tab = actionBar.newTab().
setText("Tab1").
setTabListener(new Tab1())
;
actionBar.addTab(tab);
tab = actionBar.newTab().
setText("Tab2").
setTabListener(new Tab2())
;
actionBar.addTab(tab);
//I am tried number ways to refesh the particlar tab but not achieve my goal
public void Refresh() {
/* I am also write Refresh method on individual tab and call from
onOptionsItemSelected but not working*/
Intent href = new Intent(Fragment.this,
Tab1.class);
startActivity(href);
finish();
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.menu_refresh:
Refresh();
return true;
default:
break;
}
}
//inner class for tab first
public class Tab1 extends SherlockListFragment implements ActionBar.TabListener{
// here implementating the TabListener method
//here I am loading the list from server
private class LoadProjects extends AsyncTask<String, String, String> {
//call webservice
}
}
// inner class for tab second
public class Tab2 extends SherlockListFragment implements ActionBar.TabListener{
// here implementating the TabListener method
//here I am loading the list from server
private class LoadProjects extends AsyncTask<String, String, String> {
//call webservice
}
}
}
androidmanifest.xml
<application>
<activity
android:name="com.ojaswitech.bookingscape.Fragment"
android:configChanges="orientation|keyboardHidden"
android:label=""
android:logo="@drawable/action_bar_logo"
android:theme="@style/Theme.New_theme_bs" >
</activity>
<activity
android:name="com.ojaswitech.bookingscape.Fragment$Tab1"
android:configChanges="orientation|keyboardHidden" >
</activity>
<activity
android:name="com.ojaswitech.bookingscape.Fragment$Tab2"
android:configChanges="orientation|keyboardHidden" />
</application>
Please anybody help me how to do above task. Thanks in advance