Office Hours — Today, January 15

Tuesday, January 13

Jan 15
3:50 PM
Mark M.
has entered the room
Mark M.
turned on guest access
4:00 PM
Andrei
has entered the room
Andrei
Hello
Mark M.
hello, Andrei!
how can I help you today?
Andrei
First of all, best wishes for the New Year! (even if we are 2 weeks already into it)
Mark M.
either that, or you are 50 weeks early... :-)
4:05 PM
Andrei
:-) I have ported my project from Eclipse+ADT to Android Studio, now the app seems to work ok but I see a lot of errors in LogCat and I wonder if something goes wrong somewhere
This is the first line (out of 140), for example: 01-15 15:41:27.160 922-922/? E/logwrapper? executing /system/bin/e2fsck failed: No such file or directory
Mark M.
that
that's not coming from your process AFAIK
Andrei
they don't seem to be related to my process, but I was wondering why so many errors, and whether I should be worried about them
View paste
01-15 15:41:29.340      938-938/? E/SurfaceFlinger? hwcomposer module not found
01-15 15:41:31.450      941-941/? E/AudioFlinger? int android::load_audio_interface(const char*, audio_hw_device_t**) couldn't load audio hw module audio.r_submix (No such file or directory)
01-15 15:41:31.670    1198-1198/? E/logwrapper? executing /system/bin/ip failed: No such file or directory
Mark M.
is this on the emulator?
Andrei
yes
Mark M.
with respect to the logwrapper message: http://stackoverflow.com/questions/21926448/and...
Andrei
but as far as I remember they also appear when using a physical mobile phone
Mark M.
I'd be surprised if those specific messages showed up on a device
regardless, I am not aware of anything that is tied to your app for those messages
Andrei
I can check in 2 mins
Jesus
has entered the room
Jesus
Hi
Mark M.
(hello, Jesus -- I will be with you shortly!)
Andrei
should I be worried about them?
Mark M.
Andrei: I wouldn't be
Andrei
(Hi)
Mark M.
if they are not coming from your process, and you are not getting abnormal app behavior, I would not worry about them much
4:10 PM
Mark M.
particularly if they are just on the emulator
if they are on hardware as well, that gets a bit more interesting, enough to maybe spend a few minutes of a Google search on
but usually if you're doing something really wrong, there are stronger symptoms (poor app behavior, messages tied to your process, etc.)
Andrei
I saw that StackOverflow answer earlier, but it was from Feb. 2014 and they said there that " This issue has been corrected for future distributions." I am however working with the latest Android Studio...
Mark M.
again, I would not worry about messages from outside your process that appear solely on the emulator
there are lots of those
and it is unlikely that any are tied to your app, and they are more tied to the emulator being an emulator
Andrei
ok, though it's so unusual for me to casually ignore errors... :-)
Mark M.
let me take a question from Jesus, and I will be back with you shortly
Jesus: your turn! do you have a question?
Andrei
ok, in the meantime I'll try on a phone
Jesus
Yes
So currently I am working on getting values from a server using http post
I upgraded parts of my program as I used to have it on pre 11 and it asked me to move it off the main network thread.
Now on the doInBackground I have it calling http request in order to get data and I am testing for errors such as breakdown if there is no internet connection
4:15 PM
Jesus
Is there a way to timeout async task operations in the do background
4:15 PM
Mark M.
well, usually the timeout would be done in the socket operations
there is no built-in timeout facility in AsyncTask
Bill M.
has entered the room
Jesus
ok I figured so
So in the socket operation I have added a timeout and it tells me if that happens
Mark M.
correct
Jesus
But on the post execute I have it creating my gui operations such as a listview
now since the timeout occurs
it never gets to that point of creation
Mark M.
(BTW, howdy, Bill -- I will be with you shortly!)
Jesus
how can I catch that exception and still head to post execute portion
Mark M.
wrap your network I/O in a try/catch block
Jesus
hmm ok. I will try that
Mark M.
let me take questions from the others, and I will be back with you shortly
Bill: your turn! do you have a question?
Bill M.
Yep. Howdi Mark. Sorry I missed you on Tuesday.
4:20 PM
Bill M.
I have a GCM app. I am building from source and it is working. However, I have never added my debug.keystore to the Google Developer Console and I still receive push notifications. Is this to be expected?
Mark M.
I don't recall GCM requiring you to tie in signing keys the way the Maps V2 API does
but, then again, I haven't looked at GCM much recenly
er, recently
Bill M.
Hmmm ... maybe my data is dated. The source says: http://developer.android.com/google/gcm/gs.html
Mark M.
nothing in there refers to signing keys
you need a GCM API key
and that is tied to your server IP address
and you need a project number associated with that GCM API key, but that too has nothing to do with app signing keys
so, yes, what is working for you should be working :-)
4:25 PM
Mark M.
let me take questions from the others, and I will be back with you in a bit
Andrei: your turn! do you have another question?
Bill M.
I'll dig in. Thanks Mark.
Andrei
Yes. Just tested on my phone and this is a surprise for me: yesterday the app worked on my phone, now it doesn't - I get a popup window saying "Aplication XXX (process YYY) is waiting for the debugger to attach" (with the option to force close it). In the LogCat I get 115 error lines, with errors different than those for the emulator. It starts with:
View paste
01-11 02:29:11.775    3508-4059/? E/Watchdog? !@Sync 242
01-11 02:29:27.015  24207-24207/? E/MtpService? In MTPAPP onReceive:android.intent.action.BATTERY_CHANGED
01-11 02:29:27.015  24207-24207/? E/MtpService? battPlugged Type : 2
Mark M.
again, those are not tied to your app
Andrei
maybe, but the app is not working now, so I guess something is not right, somewhere
Mark M.
for example, MtpService AFAIK is the daemon that handles the Android side of the MTP connection (the protocol used for mounting external storage as a drive or volume on a desktop OS)
if you have a stack trace coming from your process, that's something you need to address
if you are stuck on the "waiting for the debugger", then I don't know what to tell you, other than you may have an overloaded developer machine
and if your app is not crashing but is just generally misbehaving... well, I can't really do a lot for you with regards to that :-)
Andrei
ok. I'll try again, you may reply to others in the meantime
Mark M.
OK
Jesus: your turn! do you have another question?
Jesus
Yes
View paste
System.out.println("extras.toString()" + extras.toString());
            try{
                mOrder = Order.getByID(extras.getLong(ORDER_ID));
                return true;
            }
            catch (Exception e)
            {
                System.out.println("returning false");
                return false;
            }
so I tried this
4:30 PM
Jesus
the getById is the network call
Mark M.
and your doInBackground() is returning a boolean?
Jesus
yes and it returns true from checking with my post execute
in the error log it shows me that the mOrder object is null
and that there was a timeout exception
Mark M.
then you are probably catching the exception in getByID(), or something that getByID() itself is doing
and that is logging the timeout exception
Jesus
yes so I think this might be it
I have a dialog box opening if it detects bad network connection
View paste
Process: com.foodtronix.mobile, PID: 19956
    android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application
it gives me this error
for dlgAlert.create().show();
Mark M.
you cannot readily pop a dialog from a background thread
Jesus
oh this is in the post execute
Mark M.
your timeout would have already occurred by then, as the timeout is happening in the doInBackground() processing
(specifically somewhere inside getByID())
Jesus
ok I will look into that
Thanks
Mark M.
now, as to why you are having a problem in onPostExecute() showing a dialog, that I cannot say, as I avoid dialogs as much as possible
Jesus
Oh why
Mark M.
modal dialogs are considered bad form in mobile design
use them very sparingly
4:35 PM
Mark M.
for error messages, use a crouton or something else inline in your UI, rather than blocking navigation
(where by "crouton" I mean something like https://github.com/keyboardsurfer/Crouton)
Jesus
Oh I remember that in the guidelines. Ok I can try that. Thanks again!
Mark M.
anyway, let me take questions from the others, and I will be back with you in a bit
Bill: your turn! do you have another question?
Bill: if you come up with a question, chime in and let me know
Andrei: do you have another question?
Andrei
I've relaunched Android Studio and now my app runs on the mobile phone, but I still get those errors.
I'm always baffled by the moods of Android Studio or Eclipse+ADT ...
Mark M.
Android, and device manufacturers, log lots of stuff, sometimes with inappropriate severities
I yell at them when I get the chance
4:40 PM
Andrei
but this is not only about the logged errors, it's about an app that now runs and two minutes later doesn't run (or viceversa), without me modifying anything in the source code
Mark M.
and there's little that I can tell you about that, as I do not know anything at all about your app, what it does, what it depends upon, etc.
that's just a question of debugging
and it is *very* unlikely to have anything to do with your choice of IDE
Andrei
Maybe, I just wish there were relevant messages in the Logcat, to point me what is wrong...
Thanks for your help in any case!
Mark M.
sorry I could not be of greater use
Jesus: do you have another question?
Jesus
Hmm. This is more related to stack overflow question I never got answered a long time go
I recently joined this so I was wondering if you could look into at some point I worked out what I could from previous related questions
4:45 PM
Mark M.
I am sorry, but I did not understand that last sentence
if you have a question on Stack Overflow that you would like me to look at, you are welcome to link to it here, or use the Stack Overflow Bump service that is available on the Warescription site
Jesus
alright let me find the link
Mark M.
ummm... hold on a moment
well, in principle, you should be able to call setChoiceMode() to toggle on and off MULTIPLE_MODAL behavior
Jesus
So I learned how to use isEnabled and areAllItemsEnabled in order to see disable specific items during the isActionMode. What I could not figure out was how to disable the MultiChoice behavior
Mark M.
in this sample, I toggle between CHOICE_MODE_NONE and CHOICE_MODE_MULTIPLE_MODAL: https://github.com/commonsguy/cw-omnibus/tree/m...
4:50 PM
Mark M.
that sample is covered in my chapter on action modes
there, I start in single-choice mode, and on a long-click move into multiple-choice-modal mode
and I switch back when I am done with the action mode
you should be able to do the same sort of thing, switching between single-choice and multiple-choice-modal modes
or, at least, it is worth a shot
Jesus
so I could possibly set listview item to only single click if it meets the criteria I set
Mark M.
right
Jesus
ok I will look at that thanks again
Mark M.
sure
Bill: do you have another question?
OK, does anyone have another question?
Andrei
not me
Jesus
I'm good for today
4:55 PM
Jesus
has left the room
Andrei
Good bye
Andrei
has left the room
5:00 PM
Mark M.
that's a wrap for today's chat
the transcript will be posted to http://commonsware.com/office-hours/ shortly
the next chat is Tuesday at 9am US Eastern
have a pleasant day!
Bill M.
has left the room
Mark M.
turned off guest access

Tuesday, January 13

 

Office Hours

People in this transcript

  • Andrei
  • Bill Mote
  • Jesus
  • Mark Murphy