Office Hours — Today, September 3

Tuesday, September 1

Sep 3
8:50 AM
Mark M.
has entered the room
Mark M.
turned on guest access
9:20 AM
Jacek
has entered the room
9:20 AM
Jacek
Hello
Mark M.
hello, Jacek!
how can I help you today?
Jacek
I have a question regarding Cursor and RecyclerView. Is there anything against the idea to use them together?
Mark M.
no
in my RecyclerView chapter, I have an example of creating a RecyclerView.Adapter that uses a Cursor as a data model
there's nothing "built in" for cursors, as an equivalent of CursorAdapter, but it's not too tough to write
the only tricky thing is that a Cursor has internal state of what row the Cursor is "pointing" at
so you need to make sure that you always move the cursor to the proper row before trying to read stuff from it
Jacek
Okay, thanks for answear. Actually I've already written it, and it works quite well
My next question is about design patterns
9:25 AM
Mark M.
go ahead, though I may or may not be able to help with it
Jacek
In toolbar I have Spinner which shows some options and has influence on Fragment's content
But Toolbar belongs to Activity
How can I keep loose coupling in such situations?
Should toolbar be modified by fragment or activity?
Mark M.
off the cuff, knowing nothing more than what you have written here, I would say that the activity is the one that literally manages the Toolbar, but the fragment is the one driving the work
where you have an API between the fragment and the activity for this coordination
so, the fragment calls some setAvailableOptions() method it calls on the activity
today, the activity happens to populate this Spinner
but, perhaps in the future, you do something else (e.g., put those options in a nav drawer)
the fragment provides high-level abstractions of the requirement ("the user should be able to choose among these things"), and the activity implements it
9:30 AM
Mark M.
the activity would sink the selection events from the Spinner and let the fragment know about them
Jacek
So activity should implement some interface probably to fulfil fragment requirements
Mark M.
if there's a chance that more than one activity might host the fragment, definitely
it's less critical when there's only one possible hosting activity, though you might prefer the interfaces for cleanliness
Jacek
Thanks for explanation, unfortunately those design overthinking usually kills my work :)
So thanks for your time and have a nice day
Mark M.
you are very welcome
Jacek
has left the room
9:45 AM
Bryan
has entered the room
Bryan
Hello
Mark M.
hello, Bryan!
how can I help you today?
Bryan
I have 3 questions (probably more)
Mark M.
hopefully they're short -- we don't have a lot of time left in the chat
but, fire away!
Bryan
1) I just found out that you can decompile APK's fairly easily and see a lot of the code. I looked through your book but I didn't see anything about how to keep sensitive data (like api keys, etc) secure
any pointers?
Mark M.
don't put them on the device
by definition, if your code can use the data, somebody can get the data
Bryan
so if you need your app to get information from your server without or before a user authenticates, how do you do that?
Mark M.
however you would normally do it
bearing in mind that the API key may be compromised
this is no different than hitting a Web server using an API key from JavaScript in the browser
you can use stuff like DexGuard to make it more difficult to get the API key
Bryan
wow, ok. In a tutorial online about in app purchases, they give the key you need to use but tell you to create it from different strings to help "secure" it
do you know what they mean?
and how it helps?
Mark M.
squirrel the API key in a few pieces in various spots in your app, then use string concatenation or similar algorithms to combine them
9:50 AM
Mark M.
akin to DexGuard, it adds a small amount of challenge to the API key retrieval process
9:50 AM
Bryan
Ok
Mark M.
it won't stop a determined attacker
Bryan
very interesting, ok, thank you!
2) To create a "lock screen" app, are those basically apps that put an activity on top of all other screens and have their own "unlock" features
Mark M.
I have no idea
I avoid the topic like the plague
Bryan
lol, can you tell me why?
that will help inform my report
Mark M.
as far as I am concerned, they are all malware
at best, they weaken security
Bryan
cool, thanks
3) What is an SDK vs a Library
in terms of developing one
Mark M.
whether marketing got involved in the naming process
Bryan
ha
Mark M.
usually, an SDK *is* a library
though there may be accompanying tools or something
Bryan
I saw one difference is that an SDK has example code, etc in it as opposed to a library
true?
Mark M.
no
Bryan
ah, ok, can you give me an example of what an accompanying tool would look like?
Mark M.
like all the ones in the Android SDK
Bryan
ok, cool
9:55 AM
Bryan
lastly, are you going to be at the Big Android BBQ?
Mark M.
no (either Austin or the Netherlands)
Bryan
What is the Austin one?
Mark M.
that's the original BBQ
they extended to Europe this year
Bryan
very cooll, are they having one in Austin this year too?
Mark M.
though, now that I think about it, more recently the Texas one has been in the Dallas area
it started in Austin IIRC
Bryan
Yeah, it is in Hurst this hyear
ahhh
Mark M.
yeah, it's been in Hurst for ~3 years
sorry, short on sleep
Bryan
no problem. So you are not going to be there in Oct?
just curuious
and curious
Mark M.
no
I attended the first Hurst one, 3(?) years ago
Bryan
ahh well, thanks for the answers! Have a great day
Mark M.
you are very welcome
Bryan
oh, I had one more, have you tried Project Fi?
Mark M.
no
Bryan
Alright, thanks again!!
10:00 AM
Mark M.
and that's a wrap for today's chat
the transcript will be posted to https://commonsware.com/office-hours/ shortly
have a pleasant day!
Bryan
has left the room
Mark M.
turned off guest access

Tuesday, September 1

 

Office Hours

People in this transcript

  • Bryan
  • Jacek
  • Mark Murphy