I have been trying to program a simple app for taking notes on android. I want to have an "add" button showing in the actionbar of the main activity. However, it only shows up as an overflow. I tried
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/action_add"
android:icon="@drawable/ic_add"
android:title="@string/add"
android:showAsAction="always"></item>
</menu>
but I cannot run the app because android studio tells me
should use app:showAsAction with the appcompat library with xmlns:app="http://schemas.android.com/apk/res-auto"
Any ideas? I am not, to my knowledge, using appcompat
Edit: the java class:
public class NoteChoice extends Activity {
@Override
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.notechooser);
SQLiteDatabase db = openOrCreateDatabase("Notes", MODE_PRIVATE, null);
db.execSQL("CREATE TABLE IF NOT EXISTS Notes ( id INTEGER PRIMARY KEY AUTOINCREMENT, val VARCHAR )");
}
@Override
public boolean onCreateOptionsMenu(Menu menu){
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.notechooser_actions, menu);
return super.onCreateOptionsMenu(menu);
}
public boolean onOptionsItemSelected(MenuItem item){
switch(item.getItemId()){
case R.id.action_add:
onPause();
startActivity(new Intent("com.example.theorangeutan.notes.Create"));
return true;
default:
return super.onOptionsItemSelected(item);
}
}
}
The styles.xml file:
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="@android:style/Theme.Holo.Light">
<!-- Customize your theme here. -->
</style>
<style name="splash" parent="@android:style/Theme.Holo.Light.NoActionBar">
<!-- Customize your theme here. -->
</style>