I'm trying to implement a swipable tab view in android, following the developer guide here , butI am getting a compile error rejecting my custom TabListener:
[javac] /home/brad/Other/code/Prayson/Prayson/src/net/bradmont/prayson/Main.java:73: error: Main.HomeTabListener is not abstract and does not override abstract method onTabReselected(Tab,FragmentTransaction) in TabListener
[javac] private class HomeTabListener implements ActionBar.TabListener {
However, I am overriding onTabReselected, here is the class definition:
private class HomeTabListener implements ActionBar.TabListener {
public void onTabReselected (ActionBar.Tab tab, FragmentTransaction ft) {
return; // I added this thinking a non-empty function would do something
}
public void onTabSelected(ActionBar.Tab tab, FragmentTransaction ft) {
mPager.setCurrentItem(tab.getPosition());
}
public void onTabUnselected(ActionBar.Tab tab, FragmentTransaction ft) {
}
}
I've tried copying & pasting the function definition from the API docs, I've tried using an inline definition (new ActionBar.TabListener { ..). I'm sure this has to be something simple, but I haven't a clue.
Any ideas? Thanks!
As @Tanis.7x suggested, I was mixing FragmentTransaction from support.v4 and ActionBar.Tab from native. Switching to android.app.FragmentTransaction fixed the problem.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.