I am trying to add action button , but they do not showing in action bar, they are display at button when click on hardware menu button . And the up button is also not working .
i am sharing my code , tell me where i am wrong
this is my manifest file :
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="#string/app_name"
>
<!-- Parent activity meta-data to support API level 7+ -->
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".secindActivity"
android:label="Items"
android:parentActivityName=".MainActivity" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".MainActivity" />
</activity>
</application>
I am adding the up button in second activity ,. it is showing but not working .
And also trying to add action bar buttons in secondActivity . Menu file is as below :
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:Digicare="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="#+id/item_back"
android:icon="#drawable/home2"
Digicare:showAsAction="ifRoom"
android:title="Home">
</item>
</menu>
this is my java file of secondActivity :
it never comes in the if statement .
i put log in it , so i get it that it never comes in if statement
#Override
public boolean onOptionsItemSelected(MenuItem item) {
if ( item.getItemId() == R.id.home){
Log.w("asdfasdfasdf","asdfasdf");
Intent upIntent = NavUtils.getParentActivityIntent(this);
NavUtils.navigateUpTo(this, upIntent);
}
return super.onOptionsItemSelected(item);
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater Mymenu = getMenuInflater();
Mymenu.inflate(R.menu.item_menu,menu);
return super.onCreateOptionsMenu(menu);
}
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.items);
ActionBar actionBar = getActionBar();
actionBar.setDisplayHomeAsUpEnabled(true);
}
These are problems .
how to done this ????
First issue
This is a duplicate of this question. I think that it doesn't show up because you have an options button on your device.
See this post about modifying this behavior in reflection (however, I'm not sure I would recommend it, as people have expectations about their device's behavior).
Second issue
If I followed your code correctly, then the item id is item_back and not R.id.home...
Related
Hi to android stack overflow communities,
I want to remove the action bar which contain the title and the three dots. I have tried some of the solutions such as android:theme="#android:style/Theme.NoTitleBar" but, the app went crash.
Is there any possible other solution? Thanks
This is the nuclear option.
Replace
public class MainActivity extends ActionBarActivity
with
public class MainActivity extends Activity
in all the Activitys where you don't want ActionBar.
And to remove the three-dots button, add
#Override
public boolean onPrepareOptionsMenu(Menu menu) {
return false;
}
to your Activity.
Try this. This will work.
You have to use Activity not ActionBarActivity. So extends your javaclass from Activity. For removing the three dots remove onCreateOptionsMenu method from your Activity.
Create Your code like this
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="#string/app_name"
android:screenOrientation="portrait"
android:theme="#android:style/Theme.Black.NoTitleBar" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
Enter this line android:theme="#android:style/Theme.Black.NoTitleBar" in Activity
You just need to call function
getActionBar().hide();
Tthis will hide action bar for you simply.
I have MainActivity and SecondActivity.
AndroidManifest.xml
<activity
android:name=".MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".SecondActivity"
android:label="#string/title_activity_second_activitity"
android:parentActivityName=".MainActivity" >
</activity>
While I hit the back icon of SecondActivity, it's more likely that MainActivity is pushed on SecondActivity. Instead, physical back button will make SecondActivity pops up and back to MainActivity.
How can I make the back arrow icon to behave the same as physical back button?
Physical back button and icon back button aren't supposed to work in the same way according to the google's guidelines. But if you want to change it's behavior then you need to override it's functionality by doing the next:
On your SecondActivity override onOptionsItemSelected
#Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == android.R.id.home) {
onBackPressed(); //Call the back button's method
return true;
}
return super.onOptionsItemSelected(item);
}
Also you need to remove android:parentActivityName=".MainActivity" from your manifest but to avoid the back icon to be removed you need to set it enabled:
#Override
public boolean onCreate(Bundle savedInstanceState) {
...
ActionBar actionBar = getActionBar(); //Make sure you are extending ActionBarActivity
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setHomeButtonEnabled(true);
//It's also possible to use getSupportActionBar()
}
Carlos' answer works. There is also another way which I think is more straight forward: just add a click listener directly to the back icon.
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
finish();
}
});
To achieve this behaviour, you can define the launchMode of your MainActivity as a singleTop activity. This is easely done in your Manifest by adding following line:
<activity
android:name=".MainActivity"
android:label="#string/app_name"
android:launchMode="singleTop" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".SecondActivity"
android:label="#string/title_activity_second_activitity"
android:parentActivityName=".MainActivity" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".MainActivity" />
</activity>
If you want to support API 15 and lower, I would recommend adding the meta-data element inside your SecondActivity as well, as you can see above.
You'll need to add 3 things to define what activity you want to go on back pressed, not push that activity onto the stack and to make back button behave same as physical back button.
1. Define the activity you want to go in when back button is pressed.
In your manifest file's activity tag include
<activity
android:name=".SecondActivity"
android:parentActivityName=".MainActivity" >
<meta-data //Use meta-data if you are using support library
android:name="android.support.PARENT_ACTIVITY"
android:value=".MainActivity" />
2. Override onBackPressed method inside your SecondActivity.class file so as not to push MainActivity onto the stack when back button is pressed.
#Override
public void onBackPressed(){
Intent i = new Intent(getApplicationContext(), MainActivity.class);
startActivity(i);
finish();
}
3. Use showHomeAsUpEnabled() to set back button in actionBar.
ActionBar().setDisplayHomeAsUpEnabled(true); or getSupportActionBar().setDisplayHomeAsUpEnabled(true); if you are using support library.
#Override
public void onBackPressed() {
int mCount = pager.getCurrentItem();
if(mCount>0){
pager.setCurrentItem(0,false);
firsticon.setBackgroundColor(Color.parseColor("#2B8C57"));
secondicon.setBackgroundColor(Color.TRANSPARENT);
thirdicon.setBackgroundColor(Color.TRANSPARENT);
fourthicon.setBackgroundColor(Color.TRANSPARENT);
fifthicon.setBackgroundColor(Color.TRANSPARENT);
}else{
this.finish();
}
}
Search activity not being launched when pressing enter.The search view is shown nicely on the action bar. But when i type the search query and press enter
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.punit.rateit"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme"
>
<activity
android:name="com.punit.rateit.MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:theme="#style/Theme.AppCompat.Light"
android:name=".SearchPageActivity">
<meta-data android:name="android.app.default_searchable" android:value=".SearchResultsActivity" />
<intent-filter>
<action android:name="android.intent.action.SearchPage" />
</intent-filter>
</activity>
<activity android:name="com.punit.rateit.SearchResultsActivity" android:launchMode="singleTop" >
<intent-filter>
<action android:name="android.intent.action.SEARCH" />
<meta-data android:name="android.app.searchable"
android:resource="#xml/searchable"/>
</intent-filter>
</activity>
</application>
</manifest>
Here is the Menu.xml
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:com.punit.rateit="http://schemas.android.com/apk/res-auto" >
<!-- Search, should appear as action button -->
<item android:id="#+id/search"
android:icon="#drawable/ic_search"
android:title="#string/action_search"
com.punit.rateit:actionViewClass="android.widget.SearchView"
com.punit.rateit:showAsAction="ifRoom"
/>
</menu>
The activity which shows action bar.
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.menu,menu);
SearchManager searchManager =
(SearchManager) getSystemService(Context.SEARCH_SERVICE);
SearchView searchView =
(SearchView) menu.findItem(R.id.search).getActionView();
searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
searchView.setIconifiedByDefault(false);
searchView.setSubmitButtonEnabled (true);
return super.onCreateOptionsMenu(menu);
}
The SearchResult activity which should be the activity called when search submit button is pressed
public class SearchResultsActivity extends Activity {
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Log.d("search", "search triggered");
setContentView(R.layout.searchpage);
handleIntent(getIntent());
}
#Override
protected void onNewIntent(Intent intent) {
Log.d("search", "search triggered");
setIntent(intent);
handleIntent(intent);
}
private void handleIntent(Intent intent)
{
if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
String query = intent.getStringExtra(SearchManager.QUERY);
Log.d("search", query);
}
}
#Override
public boolean onSearchRequested() {
Log.d("search", "search triggered");
return false; // don't go ahead and show the search box
}
After a long Research i have Analyse something
searchView.setSearchableInfo( searchManager.getSearchableInfo(new
ComponentName(this,SearchResultsActivity.class)));
Here the activity.class is the name of the searchable activity where you want to pass the search query.
I had the same problem, and my search for an answer took me here, so here is what worked for me...
Make sure your searchables.xml file is in the correct location (i.e,
in your res/xml/ folder) and that the same file does not contain any
errors - otherwise you will find that
(SearchManager)getSystemService(Context.SEARCH_SERVICE).getSearchableInfo(componentName)
will return null, breaking your search functionality.
(Also, ensure you set componentName in the appropriate manner,
because the example shown in the Android guide is for only when you
are making searches and displaying searches in the same Activity.)
...am sharing in the hope it may save someone else a wasted 4 hours! :/
Solved the problem. The tag
was needed to be for application .Removing it from activity and putting it under application did the trick.
Here is the latest application tag in manifest.xml
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme"
>
<meta-data android:name="android.app.default_searchable" android:value=".SearchResultsActivity"/>
<activity
android:name="com.punit.rateit.MainActivity"
android:label="#string/app_name" >
<meta-data android:name="android.app.default_searchable"
android:value="com.punit.rateit.SearchResultsActivity" />
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Creating a ComponentName object with the name of the Search Result activity class worked for me. Like this:
searchView.setSearchableInfo(searchManager.getSearchableInfo(new ComponentName(this, SearchStoreActivity.class)));
I was not using the strings within searchable.xml.
You MUST set it up that way or you will get null. I had just put in text instead of using #string.
<?xml version="1.0" encoding="utf-8"?>
<searchable xmlns:android="http://schemas.android.com/apk/res/android"
android:label="#string/app_label"
android:hint="#string/search_hint" >
</searchable>
I struggled with the problem for a day or two, it's not very clearly mentioned in the documentation.
searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
In the above the getComponentName function returns the name of the
current component, which is good if your current component is
handling/showing the search results, but if you have a different
activity then you need to put the component name of that activity for
search view to redirect searches to that activity.
searchView.setSearchableInfo(searchManager.getSearchableInfo(new ComponentName(this, SearchResultActivity.class)));
Also make sure to have no errors in searchable.xml file in res/xml folder.
I am trying to create menu option in my test application.
I am able to see the menu when I set the theme in manifest to just default (The menu shows up in the top). If I set the theme in manifest to NoTitleBar. I can't see the menu option?
I want to get the menu when I set theme "NoTitleBar" in manifest.
How to fix it?
Below are things that I have used in my test application:
with Manifest:
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#android:style/Theme.NoTitleBar" >
<activity
android:name="com.ssn.menuoptions.MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
And
Menu.xml
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="#+id/menu_preferences"
android:title="Preferences" />
</menu>
Java file:
#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, menu);
return true;
}
Is it possible to get something like this:
How do I make menu to show up down?
Thanks!
Add following code below Activity.setContentView();
setContentView(R.layout.activity_detail);
// set option menu if has no hardware menu key
boolean hasMenu = ViewConfiguration.get(this).hasPermanentMenuKey();
if(!hasMenu){
//getWindow().setFlags(0x08000000, 0x08000000);
try {
getWindow().addFlags(WindowManager.LayoutParams.class.getField("FLAG_NEEDS_MENU_KEY").getInt(null));
}
catch (NoSuchFieldException e) {
// Ignore since this field won't exist in most versions of Android
}
catch (IllegalAccessException e) {
Log.w("Optionmenus", "Could not access FLAG_NEEDS_MENU_KEY in addLegacyOverflowButton()", e);
}
}
If you don't want an action bar in your app, then you can just set up a button with this handler:
myButton.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View arg0) { openOptionsMenu(); }
});
Now myButton works like the menu key. This is an easy way to migrate a fullscreen app to 4.x, though longer term a more elegant solution should be sought.
Using the notitlebar theme removes the actionbar where the menu button is. You'd probably have to make a custom theme to have your menu in it.
If you're not doing anything about it, you can always at least use this attribute: android:showAsAction="Never" so that users with phones that have a menu button can pop up the menu with their button.
Add in Android Manifest android:targetSdkVersion="10"
<uses-sdk
android:targetSdkVersion="10" />
I have need to make two action bars , I am using actionBarSherlock by the way . So what I need exactly is to put a "Welcome screen" toggle on the normal action bar up , and add two normal ActionBar Action options . Similar to what I need are Gmail and Maps like here : http://cdn.androidcommunity.com/wp-content/uploads/2012/03/Screenshot_2012-03-28-12-58-16.png (They didn't allow me to post an image for reputation is low , see the link please)
This Maps app has an upper and bottom action bar , exactly what I need , because once I reach the point where I can add the second actionbar I know where to start ...
I have searched for about a week about this topic and I have found a few similar questions , but however I have understood non of the answers ; the answers were about a custom view which I am not (at all) familiar with and I can't understand a thing , but yes I tried to make a "custom view" from whatever I thought is right and I got crrassshheesss which I didn't find any solution for ... If you may plz show me as an example this Maps app how is it using those two action bars ?? (I don't want to navigate like in maps and gmail , but only the two actionbars)
Here is some of my code :
//Part of my MainActivity.class
public boolean onCreateOptionsMenu(com.actionbarsherlock.view.Menu menu) {
MenuInflater inf = getSupportMenuInflater();
inf.inflate(R.menu.upper_navbar, menu);
final String name = "welcome";
final SharedPreferences pref = getSharedPreferences(name, 0);
final Editor edit = pref.edit();
boolean oldState = pref.getBoolean("w", true);
ToggleButton tog = (ToggleButton) menu.findItem(R.id.welcome_screen).getActionView();
if(oldState){
tog.setChecked(true);
}else{
tog.setChecked(false);
}
tog.setOnCheckedChangeListener(new OnCheckedChangeListener() {
#Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if(isChecked){
edit.putBoolean("w", true);
edit.apply();
}else{
edit.putBoolean("w", false);
edit.apply();
}
}
});
return true;
}
#Override
public boolean onOptionsItemSelected(MenuItem item) {
return super.onOptionsItemSelected(item);
}
My Manifest :
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="seaskyways.editpad"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="9"
android:targetSdkVersion="16" />
<application
android:allowBackup="true"
android:name="android.app.Application"
android:icon="#drawable/ic_launcher"
android:uiOptions="splitActionBarWhenNarrow"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="seaskyways.editpad.MainActivity"
android:label="MainActivity" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="seaskyways.editpad.Splash"
android:theme="#style/Theme.Sherlock.Dialog.NoActionBar"
android:label="Splash" >
<intent-filter>
<action android:name="android.intent.action.SPLASH" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
</manifest>
And my menus which I intend to put them in my action bars ...
menu\activity_main.xml
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:id="#+id/bottom_copy" android:title="Copy" android:orderInCategory="3" android:showAsAction="ifRoom|withText" />
<item android:id="#+id/bottom_paste" android:title="Paste" android:orderInCategory="2" android:showAsAction="ifRoom|withText" />
</menu>
menu\upper_navbar.xml (Should have named it upper_actionbar but its just a thinking mistake , its a name afterall , :/ plz proceed )
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:id="#+id/welcome_screen"
android:orderInCategory="1"
android:showAsAction="ifRoom|withText"
android:title="Welcome Screen"
android:actionLayout="#layout/toggle"
/>
</menu>
If you need anymore info please tell me , I will tell , its for me and everyone else afterall !
EDIT !!! : I found a much near example to my question , the wifi settings (http://omgdroid.com/wp-content/uploads/2012/07/Screenshot_2012-07-06-01-34-29-576x1024.png) It uses a switch in the normal actionbar and a normal split actionbar down ! Exactly what I need !
EDIT 2 !!!! : Here is a screenshot from my Galaxy nexus using a custom ROM based over aosp , This is exactly what I need and mean :
Settings-Wifi: https://lh4.googleusercontent.com/-aeL_sHjIcQQ/UPVptGQiuqI/AAAAAAAAAGE/UGc-CuLP4Qw/s512/Screenshot_2013-01-15-16-36-32.png
Settings-Bluetooth: lh3*googleusercontent.com/-4j6ca1Nm1VI/UPVqAiDn_PI/AAAAAAAAAGM/LLB2ILWVjQY/s512/Screenshot_2013-01-15-16-38-14.png
EDIT 3 !!! : Big progress in my investigation in the Bluetooth and Wifi , and as I said and asked , they were true actionbars ! see what I got in Settings-Bluetooth:
BluetoothSettings.class/onCreateOptionsMenu :
#Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
if (mLocalAdapter == null) return;
boolean bluetoothIsEnabled = mLocalAdapter.getBluetoothState() == BluetoothAdapter.STATE_ON;
boolean isDiscovering = mLocalAdapter.isDiscovering();
int textId = isDiscovering ? R.string.bluetooth_searching_for_devices :
R.string.bluetooth_search_for_devices;
menu.add(Menu.NONE, MENU_ID_SCAN, 0, textId)
.setEnabled(bluetoothIsEnabled && !isDiscovering)
.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
menu.add(Menu.NONE, MENU_ID_RENAME_DEVICE, 0, R.string.bluetooth_rename_device)
.setEnabled(bluetoothIsEnabled)
.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
menu.add(Menu.NONE, MENU_ID_VISIBILITY_TIMEOUT, 0, R.string.bluetooth_visibility_timeout)
.setEnabled(bluetoothIsEnabled)
.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
menu.add(Menu.NONE, MENU_ID_SHOW_RECEIVED, 0, R.string.bluetooth_show_received_files)
.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
super.onCreateOptionsMenu(menu, inflater);
}
These can be options are clearly shown in the splitActionBarDown with the exact properties up ...
now :
BluetoothSettings.class/addPreferencesForActivity :
#Override
void addPreferencesForActivity() {
addPreferencesFromResource(R.xml.bluetooth_settings);
Activity activity = getActivity();
Switch actionBarSwitch = new Switch(activity);
if (activity instanceof PreferenceActivity) {
PreferenceActivity preferenceActivity = (PreferenceActivity) activity;
if (preferenceActivity.onIsHidingHeaders() || !preferenceActivity.onIsMultiPane()) {
final int padding = activity.getResources().getDimensionPixelSize(
R.dimen.action_bar_switch_padding);
actionBarSwitch.setPadding(0, 0, padding, 0);
activity.getActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM,
ActionBar.DISPLAY_SHOW_CUSTOM);
activity.getActionBar().setCustomView(actionBarSwitch, new ActionBar.LayoutParams(
ActionBar.LayoutParams.WRAP_CONTENT,
ActionBar.LayoutParams.WRAP_CONTENT,
Gravity.CENTER_VERTICAL | Gravity.END));
}
}
mBluetoothEnabler = new BluetoothEnabler(activity, actionBarSwitch);
setHasOptionsMenu(true);
}
Noting that this class isn't extending Activity , it extends DeviceListPreferenceFragment ...
Now that we know it's possible to have two actionbars(split and normal) in the same time , we need a way to simplify that , maybe by a class or library ??
That is a split action bar. It is available for handset devices with a screen width of 400dp<
To enable split action bar, simply add uiOptions="splitActionBarWhenNarrow" to your or manifest element.
Edit:
The second image is indeed not a split action bar. These are just buttons with the buttonBarButtonStyle attribute. Look into this here.
Edit:
splitActionBarWhenNarrow has been deprecated.
I have need to make two action bars
Then you are on your own. This is not supported in Android or ActionBarSherlock, other than the split action bar, which you dismissed.
Similar to what I need are Gmail and Maps like here
That is a split action bar, specifically one using overlays. This sample project demonstrates this technique.
This Maps app has an upper and bottom action bar , exactly what I need
Then use the split action bar, via android:uiOptions="splitActionBarWhenNarrow" in your <activity> element, the way that Maps does. The main Maps activity uses android:uiOptions="splitActionBarWhenNarrow".
If you may plz show me as an example this Maps app how is it using those two action bars ?
As noted above, this sample project demonstrates this technique.
I know how to make one action bar (split and normal)
Maps is using a split action bar.
but what I need is making them both at a time so I can have two actionbars !
In your screenshot, you will notice that Maps has a split action bar, and they are both on the screen at the same time. This is the way split action bars work, in narrow situations. The same Maps app does not show the split action bar when the screen is not presently narrow.
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="18" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme"
//this is main line for that
android:uiOptions="splitActionBarWhenNarrow"
>
<activity
android:name="com.example.androidactionbarbottam.MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
This is main line for bottam side
android:uiOptions="splitActionBarWhenNarrow"