Office Hours — Today, October 13

Wednesday, October 7

Mark M.
has entered the room
Mark M.
turned on guest access
RP
has entered the room
Mark M.
hello, RP~
er, RP!
IpiRon
has entered the room
Mark M.
how can I help you today?
IpiRon
View paste (27 more lines)


The problem: the 'values' folder has a red X in it and I can't figure out why or how to clear it. I've cleaned 

and rebuilt. I've checked views: errors, problems, markers but can seem to find what the issue is.

My current project has the following 'res/values...' folders with content:

values
	color.xml
	dimens.xml
	strings.xml

values-land
	dimens.xml
...
RP
Hi Mark
MyWay
has entered the room
Mark M.
(IpiRon -- RP beat you by a few seconds, so I'll take a question from him first)
RP
I have a quick quesiton about ActionBar
MyWay
Hello (today I'm here just reading :P)
Mark M.
(MyWay: OK -- let me know if you come up with a question)
RP: go ahead
RP
I'm fairly new to Android programming and am trying to customize the action bar - also looked at your sample...
Oct 13
4:00 PM
RP
However I'm getting a null object when I use getActionBar(). Cannot see why this should be happening. Any ideas on what I should be looking at.
Mark M.
are you inheriting from Activity, AppCompatActivity, or something else?
RP
I'm calling it in my main activity - very similar to how it is done in your sample.
Mark M.
is your Java class inheriting from Activity, AppCompatActivity, or something else?
RP
No - could that be the issue?
Mark M.
then your code cannot even compile
RP
OKay then maybe that's not the case. Here is the code snippet......
Mark M.
and I have no means of helping you
RP
View paste (2 more lines)
public class SuperHeatCalc extends ActionBarActivity {

    public float iwb;
    public float odb;
    public float tsh;
    public boolean units;
    public Editable input_vals;
    public Double iwb_f;
    public Double odb_f;
    public Double tsh_f;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
...
Mark M.
if you look at the first line of what you pasted in, you will see that SuperHeatCalc extends ActionBarActivity
4:05 PM
RP
Yes sorry I got confused there
Mark M.
OK
replace getActionBar() with getSupportActionBar()
you are using the appcompat-v7 action bar backport
and so you use getSupportActionBar(), as getActionBar() will return null
RP
Okay I will try that. So it is to do with the library I'm using.
Mark M.
if "the library" is appcompat-v7, then yes
let me take IpiRon's question, then I'll be back with you in a bit
RP
Okay great I will try that.
ok
Mark M.
IpiRon: from your paste, one of your three files in res/values/ should also have a red X on it -- which one is it?
IpiRon
just the res/values has the red x
only the folder has it, no files in it have a red x
Mark M.
if you use your OS' file explorer to look in res/values/, are there any files other than the three that you listed in there?
IpiRon
no, only those files are in there
Mark M.
then I have no explanation to offer you for your problem
I do not recall seeing that behavior when I last used Eclipse
IpiRon
okay, I'll play with it a bit more and stay on the line here
Mark M.
and that was over a year ago
4:10 PM
Mark M.
you might check the, um, Errors(?) window, or whatever it was called in Eclipse, to see if there are messages there of possible relevance
if you are set up to do command-line builds, try one of those, and see if you get better error information
and if you are not set up to do command-line builds, grab Gradle and use it to build your project (you don't need to change the project structure to do this, though you'll need to craft a build.gradle that handles the Eclipse-style project structure)
IpiRon
Errors shows nothing. I even tried LINT but nothing there...
Mark M.
let me take a question from RP, and I'll swing back to you in a bit
IpiRon
okay
Mark M.
RP: your turn! do you have another question?
RP
No that's all and what you suggested works so thanks for your help today.
Mark M.
OK, glad to hear that you got it going!
RP
thanks
Mark M.
you'll find more about appcompat-v7, and its differences from the native action bar, in the book's chapter on AppCompat
if you come up with another question, let me know, so I can switch over to you
IpiRon: back to you! do you have another question?
RP
OKay I will check it out. I really like your book but there is so much content to cover
IpiRon
Not at present, I'll hop off and reconnect if I do.
Mark M.
OK
IpiRon
has left the room
Mark M.
if anyone comes up with a question, chime in!
RP
Okay since I'm here maybe I'll ask another one
Mark M.
go right ahead!
RP
SO after the changes I just made I was expecting to see the app icon in the action bar but it's not there. Any ideas why?
4:15 PM
Mark M.
appcompat-v7 gives you a backport not only of the action bar, but of the "Material Design" aesthetic
under Material Design, there is no app icon in the action bar
you will get the same thing if you used the native Theme.Material on Android 5.0+
RP
SO is there a way to achieve this. DO I need to change the theme. Not really got to that section yet in your book
Mark M.
if by "achieve this", you mean put the icon in the action bar, you really can't do that with AppCompat
(there's a way, but the icon comes out the wrong size, and it looks *awful*)
(and it's not really supported anyway)
you're welcome to switch over to the native action bar
if you are using Theme.Holo (and child themes), you will get an icon in the actoin bar
er, action bar
however, you'll still lose the icon on Android 5.0, if you use the native theme for that version of Android (Theme.Material)
RP
Yes that's what I meant. Thanks for clarifying. I guess more reading to get a better understanding of what's going on.
Mark M.
you could say that you are going to use Theme.Holo for Android 5.0+ too, though your app will look somewhat out of place
the biggest limitation of switching off of AppCompat is backwards compatibility
the native action bar only showed up with API Level 11
if you are trying to support Android 2.x devices, you won't have an action bar unless you use AppCompat
4:20 PM
Mark M.
though, since Android 2.x is below 10% market share on the Play Store, most new development is dropping support for those devices anyway
RP
I'm not planning on supporting 2.x and below. The app has been undergoing alpha testing on play and so far no complaints.
Mark M.
if you are that far along, I would just not worry about the icon, then
RP
Yes I just thought it would look nice - not a major hurdle for getting the app released.
4:25 PM
RP
Okay thanks Mark - I guess that wraps it up for me.
Mark M.
OK
RP
has left the room
IpiRon
has entered the room
IpiRon
(hello again)
Mark M.
hi!
if you have a question, go right ahead!
IpiRon
okay..
The problem with my red X on the values folder was some sort of SVN conflict. I restored from SVN and the X went away!
Mark M.
OK -- I never tried SVN integration with Eclipse, let alone on an Android project, so I don't have much explanation there
IpiRon
Just in case you run into this... Thanks for the 'ear'
4:30 PM
IpiRon
No problem. I'm signing off!
Mark M.
thanks for the info!
IpiRon
has left the room
4:35 PM
MyWay
do you know anything about Kotlin, Mark?
Mark M.
I don't even quite know how to pronounce "Kotlin"
though I'm guessing its a short "o"
MyWay
I have no idea
Mark M.
:-)
MyWay
eheh
Mark M.
beyond that, not really
MyWay
it seems interesting
Mark M.
yes, every 2-3 years, somebody comes along and says that X is the new language to do stuff on the JVM
Scala, Clojure, JRuby, etc.
MyWay
ahah
that's true, too
Mark M.
they all gain some niche uses, but fail to gain widespread traction
4:40 PM
Mark M.
so, while there's nothing wrong with Kotlin in all likelihood, I'm not exactly racing out to spend time on it
MyWay
yes
this seems reasonable
4:50 PM
MyWay
have a nice day Mark, thank you :)
Mark M.
um, you're welcome, for whatever I did :-)
5:00 PM
Mark M.
that's a wrap for today's chat
the transcript will be posted to https://commonsware.com/office-hours/ shortly
the next chat is Thursday at 9am US Eastern
have a pleasant day!
MyWay
has left the room
Mark M.
turned off guest access

Wednesday, October 7

 

Office Hours

People in this transcript

  • IpiRon
  • Mark Murphy
  • MyWay
  • RP