1

I have been really confused on this. I want to be able to have a lot of people use my app, but as of this post, this seems difficult unless you set your minimum API down to 16-17 or so.

Even if I am setting my API to this level, is there any point to me using things like AppCompatActivity / the Support Library?

If I want to use a Material theme, do I either have to set minimum API to 21 or use AppCompat?

Are "ActionBars" still a thing, or are they deprecated? I'm trying to find something that will allow me to display the bar on all preference screens (including nested screens). I'm also trying to include icons in both the bar and the preference items.

So I am unsure what API I need to use / what libraries to use.

The 29th Saltshaker
  • 671
  • 1
  • 6
  • 16

1 Answers1

1

Your question is similar to this previously asked question Should I use AppCompat v7 if minsdk is 14

AppCompat libraries allow you to provide features and capabilities that are in later releases of Android to earlier releases that dont have them in their SDK versions. Theme features and capabilities are part of this, but certainly not limited to that. Example that you already stated is the material design one. If you want widgets and views that are introduced in SDK 21+ supported in say API 15 (ICS) then you would use AppCompat 21+. However, features that are in AppCompat +7 (example AnimatedVectorDrawable) would not be needed since Api 15 would already support that.

So effectively it depends on the feature you want to support and the minimum SDK you are targeting.

Hope that helps!

Community
  • 1
  • 1
Bernard
  • 56
  • 1
  • 4
  • I should add - AppCompat library gets updated with each new release of Android and effectively gets some new features in that new OS to allow 'backporting' of that feature to older release versions. – Bernard Apr 10 '16 at 20:12
  • All I know is that I follow the tutorials and stuff breaks / won't compile. For example http://android-developers.blogspot.com/2014/10/appcompat-v21-material-design-for-pre.html I am trying to find a definitive source that explains how to set things up without everything breaking – The 29th Saltshaker Apr 10 '16 at 20:14
  • Can you share some of the compilation errors you are seeing? – Bernard Apr 10 '16 at 20:16
  • "java.lang.IllegalStateException: This Activity already has an action bar supplied by the window decor. Do not request Window.FEATURE_SUPPORT_ACTION_BAR and set windowActionBar to false in your theme to use a Toolbar instead" – The 29th Saltshaker Apr 10 '16 at 20:16
  • Using style " – The 29th Saltshaker Apr 10 '16 at 20:17
  • Ok looks like you want to use a particular theme but at the same time you are adding a support Toolbar. I ran into a similar problem with a support Toolbar, the solution is here: http://stackoverflow.com/questions/30923403/do-not-request-window-feature-action-bar-issue Use the theme: Theme.AppCompat.Light.NoActionBar. in your parent section and it should work. For your first problem see this: http://stackoverflow.com/questions/26515058/this-activity-already-has-an-action-bar-supplied-by-the-window-decor This theming stuff can be mighty confusing for sure. – Bernard Apr 10 '16 at 20:38
  • That solution works, but now all the colors are light/grey/green and somewhat less visually appealing. I'm trying to make everything look dark/sleek like Material Dark – The 29th Saltshaker Apr 10 '16 at 20:43
  • You can modify the theme by using a styles.xml selector. I've used this reference before to get the color scheme that I want: https://guides.codepath.com/android/Using-the-App-ToolBar – Bernard Apr 10 '16 at 20:50
  • All of this seems like a great place to start. Accepted answer. Do you happen to know about displaying the Toolbar in nested Preference Screens, or adding custom icons to the preferences/the toolbar? – The 29th Saltshaker Apr 10 '16 at 20:54
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/108765/discussion-between-user2830100-and-user54089). – Bernard Apr 10 '16 at 21:06