android - setTabListener error when applying action bar navigation -
i following tutorial android action bar tabs swipe views.
i have error on below code
(string tab_name : tabs) { actionbar.addtab(actionbar.newtab().settext(tab_name).settablistener(this)); }
in question mentioned solution did it.
this code
private tabspageradapter madapter; private android.app.actionbar actionbar; // tab titles private string[] tabs = { "top rated", "games", "movies" }; protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.search); viewpager viewpager = (viewpager) findviewbyid(r.id.pager); actionbar = getactionbar(); madapter = new tabspageradapter(getsupportfragmentmanager()); viewpager.setadapter(madapter); actionbar.sethomebuttonenabled(false); actionbar.setnavigationmode(actionbar.navigation_mode_tabs); (string tab_name : tabs) { actionbar.addtab(actionbar.newtab().settext(tab_name).settablistener((tablistener) this)); } }
Comments
Post a Comment