When comment actionBar.setTitle("title");
, the App runs normally.
What is causing my crash?
Here is a snippet of my AppCompatActivity
:
public class ActionBar2 extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_action_bar);
android.app.ActionBar actionBar = getActionBar();
actionBar.setTitle("title");
}
}
Here is the content of AndroidManifest.xml
:
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".ActionBar"></activity>
<activity android:name=".ActionBar2">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
I just wonder if it is something wrong with my android studio ,or something else?Thandks a lot!