android - I already set the actionbar but getSupportActionBar() returns null -


if go activity, crash , action bar null set why it's still null? can me?

my manifest code:

<uses-permission android:name="android.permission.internet" /> <uses-permission android:name="android.permission.access_network_state" />  <application     android:allowbackup="true"     android:icon="@mipmap/ic_launcher"     android:label="@string/app_name"     android:roundicon="@mipmap/ic_launcher_round"     android:supportsrtl="true"     android:theme="@style/apptheme">     <activity         android:name=".main"         android:label="@string/app_name"         android:theme="@style/apptheme.noactionbar"></activity>     <activity         android:name=".daftarmurid"         android:label="daftar murid" />     <activity         android:name=".settings"         android:label="@string/title_activity_settings"         android:parentactivityname=".main">         <meta-data             android:name="android.support.parent_activity"             android:value="arvin.a8c_smpbruder.main" />     </activity>     <activity         android:name=".jadwalpelajaran"         android:label="jadwal pelajaran" />     <activity         android:name=".uploadfoto"         android:label="upload foto" />     <activity         android:name=".galerifoto"         android:label="galeri" />     <activity         android:name=".about"         android:label="tentang" />     <activity         android:name=".contributors"         android:label="kontributor" />     <activity         android:name=".loadinghome"         android:theme="@style/apptheme.noactionbar">         <intent-filter>             <action android:name="android.intent.action.main" />              <category android:name="android.intent.category.launcher" />         </intent-filter>     </activity>     <activity         android:name=".tampilanakun"         android:label="akun" />     <activity android:name=".jadwalpiket"></activity> </application> 

my main activity code:

@override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     //signin.setonclicklistener(this);     setcontentview(r.layout.activity_main);     toolbar toolbar = (toolbar) findviewbyid(r.id.toolbar);     setsupportactionbar(toolbar); } 

i set actionbar on there, still null. can me ?

my main activity layout xml:

<?xml version="1.0" encoding="utf-8"?> <android.support.v4.widget.drawerlayout xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:app="http://schemas.android.com/apk/res-auto"     xmlns:tools="http://schemas.android.com/tools"     android:id="@+id/drawer_layout"     android:layout_width="match_parent"     android:layout_height="match_parent"     android:fitssystemwindows="true"     tools:opendrawer="start">      <include         layout="@layout/app_bar_main"         android:layout_width="match_parent"         android:layout_height="match_parent" />      <android.support.design.widget.navigationview         android:id="@+id/nav_view"         android:layout_width="wrap_content"         android:layout_height="match_parent"         android:layout_gravity="start"         android:fitssystemwindows="true"         app:headerlayout="@layout/nav_header_main"         app:menu="@menu/activity_main_drawer" />  </android.support.v4.widget.drawerlayout> 

my toolbar.xml:

<?xml version="1.0" encoding="utf-8"?> <android.support.design.widget.coordinatorlayout xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:app="http://schemas.android.com/apk/res-auto"     xmlns:tools="http://schemas.android.com/tools"     android:layout_width="match_parent"     android:layout_height="match_parent"     tools:context="arvin.a8c_smpbruder.main">      <android.support.design.widget.appbarlayout         android:layout_width="match_parent"         android:layout_height="wrap_content"         android:theme="@style/apptheme.appbaroverlay">          <android.support.v7.widget.toolbar             android:id="@+id/toolbar"             android:layout_width="match_parent"             android:layout_height="?attr/actionbarsize"             android:background="?attr/colorprimary"             app:popuptheme="@style/apptheme.popupoverlay" />      </android.support.design.widget.appbarlayout>      <include layout="@layout/content_main" />      <android.support.design.widget.floatingactionbutton         android:id="@+id/fab"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:layout_gravity="bottom|end"         android:layout_margin="@dimen/fab_margin"         app:srccompat="@android:drawable/ic_dialog_email" />  </android.support.design.widget.coordinatorlayout> 

check styles.xml if there current style support actionbar. or check activity going start support actionbar , try removing label tag in second activity.


Comments

Popular posts from this blog

neo4j - finding mutual friends in a cypher statement starting with three or more persons -

php - How to remove letter in front of the word laravel -

minify - Minimizing css files -