Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialViraj Thakur
5,911 PointsNo ToolBar
i am building the app on android studio and the app works fine it navigates through the tabs and the tabs are also displayed but the ToolBar (the Activity name and the logout menu item) is not getting displayed i tried many ways but always get an error.
MUZ140837 Trust Mubaiwa
5,597 Pointsplease post the error, or fully document what you have tried.
1 Answer
Viraj Thakur
5,911 Pointsi have commented the line which cause error
public class MainActivity extends FragmentActivity
implements ActionBar.TabListener {
private SectionsPagerAdapter mSectionsPagerAdapter;
private ViewPager mViewPager;
public static final String TAG = MainActivity.class.getSimpleName();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ParseUser currentUser = ParseUser.getCurrentUser();
if (currentUser == null) {
navigateToLogin();
} else {
Log.i(TAG, currentUser.getUsername());
}
android.support.v7.widget.Toolbar toolbar = (android.support.v7.widget.Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar); // error cannot resolve symbol method setSupportActionBar()
getSupportActionBar().setDisplayHomeAsUpEnabled(true); // error cannot resolve symbol method setSupportActionBar()
mSectionsPagerAdapter = new SectionsPagerAdapter(this, getSupportFragmentManager());
mViewPager = (ViewPager) findViewById(R.id.container);
mViewPager.setAdapter(mSectionsPagerAdapter);
TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs);
tabLayout.setupWithViewPager(mViewPager);
}
}
Ben Deitch
Treehouse TeacherBen Deitch
Treehouse TeacherPlease post the error