FAQ Database Discussion Community


Android onOptionsItemSelected method of Fragment doesn't get called

java,android,android-fragments,android-actionbaractivity
there are many questions about the topic but i can't figure out my problem. I have a menu declared in my MainActivity(ActionBarActivity). Now i want to work with MenuItem in onOptionsItemSelected of a Fragment class. Here is my MainActivity methods @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.menu_main, menu); return super.onCreateOptionsMenu(menu);...

Android Studio: ActionBarActivity becomes deprecated when adding a dependency?

android,dependencies,deprecated,android-actionbaractivity,floating-action-button
I'm somewhat of a newbie so do excuse me if this is really basic. Anyway, in an attempt to add a Floating Action Button (FAB) to my layout, I decided to add a dependency to a library, like this: dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.android.support:appcompat-v7:22.1.1' compile 'com.oguzdev:CircularFloatingActionMenu:1.0.2...

does getSupportActionBar().hide() surport android 4.0 and below?

android,android-activity,android-actionbar,android-actionbaractivity
I hid my actionbar in my android app with the following code ActionBar actionBar = getSupportActionBar(); actionBar.hide(); I wish to know if this will hide the action bar for android phones with android 4.0 and below. Thanks...

How to Resolve Action Bar Activity?

android,google-maps,android-studio,android-actionbaractivity
I am developing an app in Android Studio version 1.2.1.1. In which I use minsdk 15 and I what to use GoogleMap but When i am adding compile 'com.google.android.gms:play-services:7.3.0' or compile 'com.android.support:appcompat-v7:22.1.1' in build.gradle. Then ActionBarActivity shows an error android.support.v7.app.actionbaractivity is deprecated. I searched and found some suggestions to use...

setTitle method of ActionBarActivity not working after app recreation

android,android-activity,android-actionbar,android-actionbaractivity
My class extends ActionBarActivity from the android.support.v7.app package. I witnessed the following effect: The setTitle() method works fine all the time. But when the app was put in the background, removed from the processes (tested with developer settings -> restrict background processes) and recreated, the Activity is recreated fine but...

Button in ActionBar setting visibility?

android,android-fragments,android-actionbaractivity
I have 3 Fragments, and in Fragment3 I want display an icon in my ActionBar, this is works fine but when I do back to other fragments like Fragment1 and Fragment2 the icon stay visible(true) I tried add item.setVisible(false) in onPause of Fragment, but doesn't works and the icon stay...

Compatibility Issues? ActionBarActivity deprecated in favor of the new AppCompatActivity

java,android,android-actionbaractivity
Will older devices have issues with the new AppCompatActivity? What is the minimum API Level supported by the new AppCompatActivity?...

Android: Button in Actionbar is not showing

android,android-fragments,android-actionbar,android-actionbaractivity
I am extending the ActionBarActivity and use fragments in this activity. But the actionbar does not show any button. Here is my code (inside the fragment): @Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { // TODO Auto-generated method stub inflater.inflate(R.menu.menu_for_edit_fragments, menu); super.onCreateOptionsMenu(menu, inflater); } And here is the menu_for_edit_fragments.xml: <?xml...

update listView from ActionBarActivity

android,listview,android-actionbaractivity
My MainActivity, which extends ActionBarActivity, has a ListView, which I want to reload using notifyDataSetChanged(), but I do not know how to do this. My code so far: public class MainActivity extends ActionBarActivity { private JournalEntryDataSource datasource; private ListView listView = null; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main);...

Adding toolbar to activity causes NoClassDefFoundError

android,android-actionbar,android-support-library,android-toolbar,android-actionbaractivity
I'm Trying to add a toolbar to an activity. But I'm getting this error: java.lang.NoClassDefFoundError: android.support.v7.app.ActionBarActivityDelegateBase$2 at android.support.v7.app.ActionBarActivityDelegateBase.ensureSubDecor(ActionBarActivityDelegateBase.java:304) at android.support.v7.app.ActionBarActivityDelegateBase.setContentView(ActionBarActivityDelegateBase.java:225) at android.support.v7.app.ActionBarActivity.setContentView(ActionBarActivity.java:102) at...

Fragment code not being run when fragment is displayed on screen

android,android-fragments,android-actionbaractivity
I have started creating fragments in my app which are inflated using a side menu. The problem is none of the fragments, 1 of which is as it was when it was automatically generated using the android studio template, appear to be executing any code. This is probably a case...

I can't use ListView when I am extending my class to ActionBarActivity. I can only access ListView when I extend to ListActivity. Any

android,listview,android-listview,android-actionbar,android-actionbaractivity
My activity: it is showing me two errors "Required: android.widget.ListView" I imported the ListView widget already to my Activity so I dont understand what's the issue. package com.example.test.test; import android.content.Intent; import android.support.v7.app.ActionBarActivity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.widget.ListView; import com.parse.FindCallback; import com.parse.Parse; import com.parse.ParseException; import com.parse.ParseObject; import com.parse.ParseQuery;...

Action bar buttons only showing in the overflow

android,android-actionbar,android-actionbaractivity
I tried to add buttons with icons to the Action Bar so I followed the info on the android developer page. However despite having assigned icons, the buttons will only be displayed in the overflow and not on the bar itself. I want the buttons to appear on the bar...

Back navigation with Fragments / Toolbar

android,fragment,android-toolbar,android-actionbaractivity,fragment-backstack
I'm scratching my head with this one now.... I have an ActionBarActivity that loads an initial Fragment - the original menu is inflated within the activity. Now, I have a navigation bar that, when an item is selected, loads a different fragment and adds this to the backstack. When I...

Hide tittle bar in ActionBarActivity using java code [duplicate]

java,android,android-actionbaractivity
This question already has an answer here: android.util.AndroidRuntimeException: requestFeature() must be called before adding content 5 answers how to hide title bar from Android ActionBarActivity I have tried everything but did not get success. getting that Exception : java.lang.RuntimeException: Unable to start activity ComponentInfo{com.dan.msdashboard/com.dan.msdashboard.FirstActivity}: android.util.AndroidRuntimeException: requestFeature() must be called...

I keep getting an error in android studio

android,android-actionbaractivity
The error is android.support.v7.ActionBarActivity is deprecated. Does anyone know if it affects my game or how to fix it? Thank in advance.

Add image to left side of action bar ?

android,android-actionbar,android-actionbaractivity
I need add a image in between navigation button and drop-down in action-bar.How can I do this? ...

Remove title from action bar activity

android,android-actionbaractivity
I know how to remove the title in action bar activity from the code, but is it possible to remove the title from the xml file?

How add a single menu item left to the toolbar in android?

android,toolbar,menuitem,android-toolbar,android-actionbaractivity
I simply want a back button in left side of toolbar.But when i added with following code ,appear in right side of toolbar.how can i change to it to left side? my code <menu 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" tools:context="com.me.myapp.activities.Timer"> <item android:id="@+id/backButton" android:title="Back Button" android:icon="@mipmap/back_icon" app:showAsAction="ifRoom"></item> </menu> ...

onListItemClick is not being called. I am not sure why

android,listview,android-actionbar,android-actionbaractivity
Here is my Activity:I am trying to call "onListItemClicked" But it is only supported by ListActivity? I want to use ActionBarActivity because I want a bar with "Logout" and "Update". With ListActivity it won't show. Any idea of what I'm doing wrong? package com.example.test.test; import android.content.Intent; import android.support.v7.app.ActionBarActivity; import android.os.Bundle;...