So i'm new to android programming
im going to add two action bar , but when i add the second action bar , it fills the old one , not making a new one .
i already use the holo light theme .
this is my manifest file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.orionpreneur"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="21" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme"
android:uiOptions="splitActionBarWhenNarrow">
<!-- Splash Screen Activity -->
<activity
android:name=".SplashScreen"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.Holo.Light.NoActionBar.Fullscreen" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!-- Login Activity -->
<activity
android:name=".LoginActivity"
android:label="@string/app_name" >
</activity>
<activity
android:name=".SecondActivity"
android:label="@string/about_us"
android:parentActivityName=".LoginActivity" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.example.orionpreneur.MainActivity" />
</activity>
<activity
android:name=".About"
android:label="@string/title_activity_about"
android:parentActivityName=".LoginActivity" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.example.orionpreneur.MainActivity" />
</activity>
</application>
</manifest>
this is my main_activity_menu.xml code
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<!-- Search, should appear as action button -->
<item android:id="@+id/action_search"
android:icon="@drawable/ic_action_search"
android:title="@string/action_search"
android:showAsAction="always" />
<!-- Settings, should always be in the overflow -->
<item android:id="@+id/about"
android:title="@string/about"
android:showAsAction="always"/>
</menu>
this is my MainActivity.java code
package com.example.orionpreneur;
import android.app.ActionBar;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.Toast;
public class LoginActivity extends ActionBarActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main_activity_menu, menu);
return super.onCreateOptionsMenu(menu);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
switch (item.getItemId()) {
case R.id.action_search:
Toast.makeText(this, "you've pressed the search button !", Toast.LENGTH_SHORT).show();
return true;
case R.id.about:
Intent in = new Intent(this, About.class );
startActivity(in);
return true;
default:
return super.onOptionsItemSelected(item);
}
}
}
i wanted the search button to be added in separated bar like this
https://developer.android.com/images/training/basics/actionbar-actions.png
i'm desperate , sorry if my question is already asked .
thanks :)))