Dec 17 | 8:55 AM |
Mark M. | has entered the room |
Mark M. | turned on guest access |
Jonatan R. | has entered the room |
Mark M. |
hello, Jonatan!
|
Mark M. |
how can I help you today?
|
Jonatan R. |
Hey Mark
|
Drasko | has entered the room |
Drasko |
hi!
|
Mark M. |
(BTW, hello, Drasko -- I will be with you shortly!)
|
Mark M. |
Jonatan: do you have a question?
|
Dec 17 | 9:00 AM |
Jonatan R. |
I'm having problems saving a bitmap to a file. Do you have an example somewhere I could look at? I've been searching the book but couldn't find anything.
|
Mark M. |
hmmm... the closest thing that I have that I can think of is writing a bitmap to an OutputStream, as part of the andprojector sample in the media projection APIs chapter
|
Mark M. |
saving a bitmap to a file should just be a call to compress() on the Bitmap
|
Mark M. |
passing in a FileOutputStream
|
Jonatan R. |
ok thanks, I'll have a look
|
Mark M. |
let me take a question from Drasko, and I'll be back with you in a bit
|
Mark M. |
Drasko: your turn! do you have a question?
|
Drasko |
View paste
|
Mark M. |
personally, I'd drop the contract and move on to another gig
|
Chandra S. | has entered the room |
Mark M. |
that being said, DrawerLayout does not imply any sort of specific content for the drawer, so that should still be usable for the drawer part
|
Mark M. |
however, AFAIK, unless they are building their own custom ROM, you can't float stuff over the status bar
|
Mark M. |
(BTW, hello, Chandra -- I will be with you shortly!)
|
Dec 17 | 9:05 AM |
Chandra S. |
OK Mark thanks
|
Drasko |
But when I tried to implement DrawerLayout AS asked for menu resources.
|
Mark M. |
it doesn't when I use it
|
Mark M. |
https://github.com/commonsguy/cw-omnibus/tree/m... has a pair of projects demonstrating DrawerLayout
|
Drasko |
hm... I need to check that out.
|
Mark M. | |
Mark M. |
the only thing in there about menus is the context menu, standard for all Views
|
Mark M. |
now, the Design Support Library has some nav drawer stuff in it, and that requires menu resources IIRC
|
Drasko |
yes, I used nav drawer from Design Support Library
|
Mark M. |
specifically, NavigationView
|
Mark M. |
NavigationView goes *in* a DrawerLayout
|
Mark M. |
and NavigationView implements a typical menu-style system
|
Mark M. |
since you don't want that, don't use NavigationView; just use DrawerLayout
|
Drasko |
ok, thanks a lot!
|
Mark M. |
let me take questions from the others, and I'll be back with you in a bit
|
Mark M. |
Chandra: your turn! do you have a question?
|
Dec 17 | 9:10 AM |
Mark M. |
Chandra: if you come up with a question, let me know, so I can give you some time, but in the meanwhile, I will take questions from the others
|
Mark M. |
Jonatan: your turn! do you have a question?
|
Hyrodrik | has entered the room |
Jonatan R. |
Not right now, thanks
|
Mark M. |
OK
|
Mark M. |
Hyrodrik: hi! everyone else has had a chance to ask a question, so it's your turn -- do you have a question?
|
Hyrodrik |
Hi everyone
|
Mark M. |
Hyrodrik: do you have a question?
|
Hyrodrik |
Thanks Mr Mark. Yes I have : with your book I was able to make an app which has a navigation drawer and fragment
|
Drasko |
May I ask a question?
|
Drasko |
sorry, didn't see .. Had a lag
|
Mark M. |
(Drasko: I'll be back with you in a bit, after Hyrodrik)
|
Hyrodrik |
The users of the app will enter their username and password
|
Hyrodrik |
I have already build the database on a hosting server
|
Dec 17 | 9:15 AM |
Hyrodrik |
But I have trouble connecting the database and my app
|
Hyrodrik |
I test the connection on a local server and it works
|
Chandra S. | has left the room |
Hyrodrik |
For that I use some php code
|
Mark M. |
Hyrodrik: I am sorry, but I have no means of helping you with this
|
Mark M. |
do you have a *specific* question?
|
Dec 17 | 9:20 AM |
Mark M. |
Hyrodrik: let me take questions from the others, and I will come back to you in a bit, and perhaps we can get to your specific concern
|
Mark M. |
Drasko: your turn! do you have a question?
|
Drasko |
Have you tried Realm database and if you have, would you use it in your future development?
|
Mark M. |
I have seen a presentation on Realm but have not used it personally
|
Hyrodrik |
For now no
|
Mark M. |
it's somewhat intriguing, though I'd go with other NoSQL alternatives over Realm (notably, Couchbase)
|
Drasko |
Did you tried it yet?
|
Drasko |
I mean Couchbase.
|
Hyrodrik |
I will give it a try
|
Mark M. |
it meaning Couchbase? I played with the original Couchbase Lite (the one that used SQLite as a backing store), but I have not had a chance to circle back and try the revamped engine
|
Drasko |
OK. :) I am just curious about these NoSQL technologies on mobile devices.
|
Mark M. |
my rationale for Couchbase over Realm is partially the longer track record and partially its ability to handle synchronization with a server
|
Mark M. |
Realm, AFAIK, is purely a local store; you're on your own for synchronization with a server, just as you would be with SQLite
|
Dec 17 | 9:25 AM |
Mark M. |
neither offers an encryption option AFAIK, so neither is high on my list at the moment
|
Drasko |
They pushed encryption recently.
|
Mark M. |
OK, at this point, until somebody else joins the chat, it's an open session -- if anyone has a specific question, go ahead and ask!
|
Mark M. |
Drasko: which one is "they"?
|
Drasko |
Realm. Sorry. :)
|
Mark M. |
ah, that's right -- the Realm issue was licensing
|
Drasko |
Isn't it free to use on commercial projects?
|
Mark M. |
yes, it is, but it contains binary blobs; it is not pure open source
|
Mark M. |
leastways, that's how I interpret https://github.com/realm/realm-java#license and the linked-to clause
|
Dec 17 | 9:30 AM |
Hyrodrik |
Sorry my phone crashed
|
Mark M. |
Hyrodrik: that doesn't sound good
|
Drasko |
another question. when I tried to use that very handy feature, called setError(String error) on TextView and of course EditText, I have a problem
|
Mark M. |
Hyrodrik: anyway, right now, it is an open session -- if anyone has a specific question, go ahead and ask
|
Drasko |
WHen EditText got his focus, the error message change its position above and doesn't point to that little exclamation mark.
|
Hyrodrik |
Ok
|
Drasko |
Do you know how can I solve that?
|
Mark M. |
not off the top of my head, sorry
|
Drasko |
it looks something like this: https://cloud.githubusercontent.com/assets/2921...
|
Drasko |
error message position is wrong
|
Mark M. |
I have avoided setError() entirely, as I don't trust device manufacturers not to screw it up
|
Dec 17 | 9:35 AM |
Mark M. |
device manufacturers have a long track record of messing around with the behavior of EditText
|
Drasko |
So, what is your favourite UX you use to show validation errors?
|
Drasko |
Especially for EditText.
|
Mark M. |
the same basic UX, but I'll roll it myself
|
Hyrodrik |
I was also asking to build a "chat session" inside the app, so every user can exchange with each other. I really don't know where to start. What do you suggest me
|
Drasko |
I didn't understand you, what do you mean by that? You create the same UX like setError() was supposed to do?
|
Mark M. |
Drasko: more or less -- the exclamation point is just a drawable associated with the EditText
|
Mark M. |
Hyrodrik: that is a rather broad question, one that is not really suitable for chats, Stack Overflow, etc.
|
Dec 17 | 9:40 AM |
Mark M. |
you'll need to settle on a chat server implementation, whether it's something you're rolling your own or using something off-the-shelf (e.g., XMPP server)
|
Mark M. |
that in turn will drive your protocol that you will have to implement on the client
|
Hyrodrik |
Stack overflow? I don't know it but I will search. Your book is my only reference for Android development
|
Mark M. |
then, and only then, are you in position to worry about UI (though I recall some libraries on the Android Arsenal that might help with a chat-style bubble UI()
|
Mark M. |
95% of your problem has little to do with Android
|
Mark M. |
and so you won't see anything in my book related to it
|
Hyrodrik |
Ok ok I understand
|
Hyrodrik |
For the navigation drawer, it is possible possible to configure it, so that if the user is left or right handed, the gravity of the drawer will change according to the user choice
|
Mark M. |
Android itself does not know whether the user is right- or left-handed
|
Hyrodrik |
The user will click a button to tell if he is left or right handed
|
Mark M. |
however, if you get that information yourself from the user, you should be able to change the gravity at runtime
|
Dec 17 | 9:45 AM |
Mark M. |
you would have to retrieve the LayoutParams for the content of the nav drawer (e.g., the ListView, the RecyclerView, the NavigationView) and adjust its gravity
|
Mark M. |
then call setLayoutParams() on that same content to have it take into account the revised gravity
|
Mark M. |
that being said, it's entirely possible that the DrawerLayout developers did not take a dynamic gravity change into account
|
Hyrodrik |
Ok ok
|
Mark M. |
if that turns out to be the case, you could always have two layouts, one each for right- and left-handed users, and load the proper layout as needed
|
Mark M. |
that makes the point of the initial switch from right- to left-handed a pain, but in the future it's just an if statement when calling setContentView() for the activity
|
Hyrodrik |
Great
|
Hyrodrik |
I will work on that
|
Mark M. |
Drasko: if you are using appcompat-v7, you might look at TextInputLayout and see if its error-message handling behaves better for you
|
Drasko |
yes, you are right. only downright is that it occupies a lot of vertical space, but it sounds good.
|
Drasko |
just remembered, I have one question.
|
Dec 17 | 9:50 AM |
Mark M. |
Drasko: go ahead
|
Hyrodrik |
I have another question
|
Drasko |
I have a form on activity which on smaller devices is bigger than the screen. So, I used NestedScrollView and inside of it LinearLayout, and everything is great for smaller screens, but it is scrollable on bigger screens. How can I set it to be scrollable on smaller screens, but be *static*(can't find poper word) otherwise?
|
Mark M. |
Hyrodrik: go ahead
|
Mark M. |
Drasko: is there a reason you needed NestedScrollView, instead of ScrollView?
|
Mark M. |
I haven't played with NestedScrollView; IMHO having scrollable things inside of other scrollable things is a UX problem in its own right
|
Mark M. |
with ScrollView, if there is enough room for its entire content, there is no scrolling
|
Mark M. |
perhaps NestedScrollView behaves differently
|
Dec 17 | 9:55 AM |
Drasko |
Ok, thanks. I'll try ScrollView instead.
|
Mark M. |
Hyrodrik: we only have a couple of minutes left, so if you have another question, go ahead
|
Hyrodrik |
The users can be notified on their phone through SMS (Short Message Service). It means if an info was leaked out, this info will be sent to them via their respective carrier.
|
Mark M. |
Hyrodrik: that is not really a question
|
Hyrodrik |
We are already teaming with one carrier to test it out, but I don't know how to implement this email
|
Dec 17 | 10:00 AM |
Mark M. |
I am sorry, but I do not know what "email" you are referring to
|
Mark M. |
your first chat item refers to SMS
|
Mark M. |
you can send SMS with SmsManager
|
Hyrodrik |
Sorry # email# is an error
|
Mark M. |
and in this case, I would imagine that the user should be getting the SMS in their regular SMS client
|
Mark M. |
so there should be nothing for you to do on the receiving side
|
Mark M. |
and we are out of time for today's chat
|
Mark M. |
the transcript of this chat will be posted to https://commonsware.com/office-hours/ shortly
|
Drasko |
Good bye and thanks!
|
Mark M. |
the next chat is not until 28 December, at 9am US Eastern
|
Mark M. |
have a pleasant day!
|
Hyrodrik |
In fact the user will post an info in the app, the the app send it to the webserver and then the server will send it via sms
|
Jonatan R. | has left the room |
Drasko | has left the room |
Hyrodrik | has left the room |
Mark M. | turned off guest access |