0

So I have this under my Activity's onCreateView()

    ActionBar actionBar = getActionBar();
    actionBar.setDisplayShowHomeEnabled(false);
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
    actionBar.setDisplayOptions(0, ActionBar.DISPLAY_SHOW_TITLE);

And my manifest looks like this

    <activity
        android:name="com.example.nfcproducttracing.ProductTracer"
        android:label="@string/app_name" 
        android:theme="@android:style/Theme.Holo.Light"
        android:launchMode="singleTask">

What I have achieved is have my application with Tabs, but no TitleBar. However, during application launch I can briefly see the TitleBar before it disappears, and I do not want that.

What am I supposed to do? When I set my activity theme to anything related to NoTitle, getActionBar returns null and the app crashes.

hermann
  • 6,237
  • 11
  • 46
  • 66
  • How is this question different from [your previous question](http://stackoverflow.com/q/20612231/741249)? – THelper Dec 16 '13 at 22:23
  • I tried to implement the answer from my previous question and encountered the problem I am describing here. `getActionBar()` returns null. – hermann Dec 16 '13 at 22:25
  • Perhaps you should ask the original answerer for clarifications. And perhaps [this post](http://stackoverflow.com/q/6867076/741249) will help? – THelper Dec 16 '13 at 22:29
  • I am trying to solve a problem and I get -1'd instead. Nice. – hermann Dec 16 '13 at 22:42
  • @hermann, have you tried `getActionBar().setTitle("");`? As I answered below? – Mike Dec 18 '13 at 11:44

3 Answers3

0

If I understand correctly your questions, you can use the requestWindowFeature(Window.FEATURE_NO_TITLE) from your activity.

Flag for the "no title" feature, turning off the title at the top of the screen.

MikeL
  • 5,385
  • 42
  • 41
0

Not really sure but have you tried this:

getActionBar().setTitle("");

It will set a blank title for your ActionBar.

Mike
  • 1,000
  • 1
  • 10
  • 18
0

You can try using getSupportActionBar() instead. this is from android.support.v4.app.actionbar, not from android.app.actionbar!

ZygD
  • 22,092
  • 39
  • 79
  • 102