Office Hours — Today, August 14

Yesterday, August 13

Aug 14
7:20 PM
Mark M.
has entered the room
Mark M.
turned on guest access
7:25 PM
Gaurav B.
has entered the room
Mark M.
hello, Guarav!
how can I help you today?
7:30 PM
Jeff
has entered the room
Mark M.
hello, Jeff!
Jeff
hi Mark
Mark M.
Jeff: do you have a question?
Jeff
both your suggestions yesterday worked well - Thanks. I'm getting ready to put my first app in the Play Store. I'm using Crittercism for crash tracking and I have beta users. any other advice on how to ensure stability once the code is in the store?
Mark M.
um, pray to the deity of your choice?
:-)
testing is key
Jeff
I realize it's a vague question but I wanted to see if you had any input
Mark M.
the more testing, the better, in general
Jeff
yes, I'm lining up some beta users to try things I wouldn't think of
Ok - Have a good night
Mark M.
in addition to what you can test locally, there are services like Apkudo that can test on a suite of devices
Guarav: do you have a question?
7:35 PM
Mark M.
if anyone has a question, chime in
7:40 PM
Ollie
has entered the room
Mark M.
hello, Ollie!
Ollie: do you have a question?
Ollie
Hello there
I don't have it all gathered up yet so I can wait a bit
Actually, it might be easy...
Can you point me at the best place to show me how to fragment correctly
I just feel I am using more classes than I should need to
Mark M.
I am afraid that I do not understand your question
um, can you give me an example?
Ollie
Lets say I have an app with three activites. When you click a button on one you go to another activity.
7:45 PM
Ollie
I should be able to utilize the same fragment to show the next one, instead I am using a new fragment simply because I am kinda screwed up with it lol
Mark M.
do you mean that you are using the same UI structure in both places?
Ollie
Yes sir
Mark M.
OK, then, you have two main options:
#1: stick with separate fragment classes, but use inheritance to reduce code duplication
#2: consolidate the two fragments into one, teaching it how to deal with data from both places
Ollie
Answer #2 is what I am looking for a good guide on
Mark M.
well, there really isn't a great "guide" for that, only because there's an infinite number of combinations
Ollie
Got ya
Mark M.
where is the data coming from, in each case?
Ollie
I am going to be pulling from a website via REST
Mark M.
and... each case uses a different URL?
Ollie
Correct
Mark M.
OK
if you use dynamic fragments (FragmentTransaction), you can create the fragment instances yourself, typically using a factory method (e.g., newInstance())
7:50 PM
Mark M.
in that case, you can pass into the factory method the URL for this specific *instance* of the fragment
Ollie
ok
Mark M.
the factory method would stuff that into the arguments Bundle, as I showed in the ViewPager samples
and the fragment instance would then retrieve that value to use when kicking off the AsyncTask (or whatever) for doing the REST call
using the arguments Bundle ensures that you have the data again after a configuration change
if the data structure retrieved from the REST call is the same (just with different values), use a single AsyncTask (or whatever), otherwise use two
Ollie
ok coolio, then I will be reviewing your ViewPager samples too
Much appreciated
Mark M.
no problem
Guarav & Jeff: do either of you have a question?
7:55 PM
Ollie
My goal would be to have the app sort of like a wordpress page. Where the "theme" is the same, and the data can quickly be updated via pulling info off the web.
Mark M.
that's a question of decoupling the view and controller logic (display and input events) from your model and how you retrieve your model
Chrystian
has entered the room
Mark M.
hello, Chrystian!
Chrystian
Hello
Mark M.
Chrystian: do you have a question? it's your turn
Chrystian
I have to develop an app for a customer. The app needs to start on 5 devices(same hardware) simultaneously, can I rely on android's time implementation? I think I could also use gps time, but that may not work inside buildings.
8:00 PM
Mark M.
if the devices are all using network time (e.g., NITZ from cell providers), they'll be decently accurate
Jeff
has left the room
Mark M.
how "simultaneous" do you need? Android isn't a RTOS
Chrystian
the devices will be gsm, but they will not have service.
within 100 ms
Mark M.
that's not going to be possible with each of them operating independently
maybe if they are all listening on open sockets to some server that can send a "go!" signal
Chrystian
yes, that is what I was thinking
can I implement NITZ if the device has no service?
Mark M.
not unless you are a billionaire and are going to set up your own mobile carrier :-)
I don't think apps can set the system time (e.g., run your own SNTP client), but that's at least worth investigating
Chrystian
haha, OK. No, they cant, I looked that up earlier
thank you.
Mark M.
yeah, then, some sort of synchronized signal (WiFi, Bluetooth, maybe USB) will be your best shot
8:05 PM
Chrystian
Ok, thanks.
Mark M.
Ollie & Guarav: do either of you have a question?
Ollie
Not at the moment
Eventually though I will be having questions about using the "new" location services
Mark M.
I have some material on LocationClient in the book, for basic location lookups
haven't gotten to geofencing yet
Ollie
When that happens I will be bugging you some more
Mark M.
OK
Chrystian: do you have another question?
Chrystian
no, that was it.
8:10 PM
Mark M.
OK, well, if anyone comes up with a question, chime in
Gaurav B.
has left the room
Yurii L.
has entered the room
Mark M.
hello, Yurii!
Yurii: do you have a question?
Yurii L.
Hi Mark, quick question, how doesn't Retrofit works with orientation changes?
*does
Mark M.
AFAIK, they're using AsyncTask under the covers
but I haven't really looked
8:15 PM
Yurii L.
Cool thanks, then I should evaluate RoboSpice.
Mark M.
I have not attempted to get a Retrofit call to span a configuration change, and so I do not know the precise behavior
if anyone has a question, chime in
Yurii L.
Sending multiple attachments from internal storage on Android 14+
to Gmail or other mail client
Mark M.
I haven't done it
I think there's ACTION_SEND_MULTIPLE for that scenario
though the attachments would have to be served by a ContentProvider or made world-readable
Yurii L.
but with FLAG_GRANT_URI_PERMISSION world readable setData takes only one Uri
Mark M.
presumably, the attachments would need to be world-readable via the ContentProvider as well
Yurii L.
world-readable not an option. have content provider
Mark M.
you could cook up some sort of one-time Uri approach to limit others' ability to read the data later
8:20 PM
Mark M.
but, again, it's not a scenario that I have investigated
Yurii L.
interesting idea, any links for one-time uri?
Mark M.
nope, just a brainstorm
basically, use random numbers (e.g., content://authority/one_time/NNNNNN)
have a HashMap tying number to underlying file
once the number is used, remove it from the HashMap
there could be hiccups with this approach, such as configuration changes in the other app causing it to want to re-read the Uri
so it might need to be more time-based than one-time-use
8:25 PM
Yurii L.
Thanks, have a good day
Mark M.
you too!
if anyone has a quick last question, go ahead
Ollie
I think I am good for the night
Mark M.
well, that's a wrap for today's chat
the transcript will appear on http://commonsware.com/office-hours/ shortly
the next chat is tomorrow, 10am Eastern
have a pleasant day, all!
Ollie
You too
8:30 PM
Ollie
has left the room
Chrystian
has left the room
Yurii L.
has left the room
Mark M.
turned off guest access

Yesterday, August 13

 

Office Hours

People in this transcript

  • Chrystian
  • Gaurav Bhatnagar
  • Jeff
  • Mark Murphy
  • Ollie
  • Yurii Laguta