Office Hours — Today, July 3

Yesterday, July 2

Mark M.
has entered the room
Mark M.
turned on guest access
Jul 3
4:00 PM
EGHDK
has entered the room
Mark M.
hello EGHDK
how can I help you today?
EGHDK
Hey, three "quick" questions.
I'm having a lot of trouble with Dialogs/AlertDIalogs and Window and such. Why? Because I want to have an onClick method that triggers a full screen pop-up, but I'm not sure what the best way to implement it is. I want it to cover the action bar, and use a view that I already have.
Is there anything in your book that would help my perdicament?
Mark M.
since I don't know what "a lot of trouble" means, probably not
I definitely do not get into Window much, outside of the tapjacking chapter
I have a chapter on dialogs, whether it will help, though, I cannot say
EGHDK
Well, let's just say I have one MainActivity and a button. onClick I would like a popup. But I would like it to take the whole screen. Is a dialog the best way to handle that?
Mark M.
it's probably the simplest way to handle that
4:05 PM
EGHDK
Okay, because the code snippets on stack overflow seem ridiculously difficult.
Mark M.
a DialogFragment, in particular, is maybe a dozen lines of code, beyond setting up your UI
dialogs sans fragments can be a pain due to configuration changes
EGHDK
View paste
Yeah, like I basically have this code working, but I get a white screen. I can't figure out how to add my layout.

http://stackoverflow.com/questions/2306503/how-to-make-an-alert-dialog-fill-90-of-screen-size
Mark M.
um, which of the many answers did you try?
4:10 PM
Mark M.
that answer seems cleanest for use from onCreateView() of a DialogFragment
bear in mind that your use case (trying to fill most of the screen) is atypical, which is why it's not necessarily easy to set that up
EGHDK
Gotcha. That cheered me up a bit.
Mark M.
where in that answer koma calls setView() on a Dialog, you could return the properly-sized View from onCreateView() of a DialogFragment
EGHDK
Okay, next question. Have you had any experience with playing videos in Android? I'm trying to play a quicktime video, but it keeps saying it's unplayable. Don't worry if you don't have any experience with it. Just curious.
Mark M.
if by Quicktime you mean .mov, that's not a supported format
4:15 PM
EGHDK
Arg. Okay, just needed someone else to put the final nail in the coffin for me.
Mark M.
BTW, back on the previous question, you might take a peek at http://www.androidviews.net/2012/11/showcase-view/
while that's probably not the look you're aiming for, that sort of showcase is designed to float full-screen over top of an activity
and so you might see how they pulled that off
EGHDK
Last question actually deals with files (I've always had trouble with the whole File locations and sdcard stuff). I want to include a file in my app that has text that I want to read back every time I start the application. I add the file to my assests dir, and then do I have to manually specify where I want the file to go?
Because you can't read the file directly from assets... correct?
Mark M.
what do you mean by "manually specify where I want the file to go?"
you can access the asset via getAssets().open("/path/within/assets/directory.txt")
which will return an InputStream
EGHDK
Hmm... so I can retrieve text from a file that way.
Mark M.
correct
EGHDK
I thought I had to move it from my assets to another directory like /data/data or something.
Mark M.
only if you wish to modify the data
4:20 PM
Mark M.
or, if you need an actual File object for some API
EGHDK
Sweet nibblets. Thanks.
You don't happen to think that you will do a lesson on the Navigation Drawer in your book right? I've been involved in Android for a while, and I am still having trouble following them (the guys at google) on the "tutorial" for navigation drawer.
Mark M.
I am hoping to cover DrawerLayout in the next update, or the one after that
but it's not there presently
4:25 PM
EGHDK
Yeah. I get aggravated, because I feel like I know a decent amount of Android, but then it comes to doing something like that (following a tutorial) and I get lost. Maybe there's some basics I just never picked up on.
Mark M.
well, doing DrawerLayout *well* is not especially easy
part of the reason for the delay in covering it is cobbling together a library to help make it easier to populate the ListView in the nav area
EGHDK
Yeah, I think I'll come by to your next office hours with specific areas that I'm having trouble with.
Mark M.
if you're lucky, I'll even be able to answer your questions :-)
4:30 PM
Mark M.
BTW, do you have a second StackOverflow account?
EGHDK
Hahah. Nope, but I'll check it out.
Heh. Looks like the exact same question.
Mark M.
great minds think alike
EGHDK
Guess so.
4:35 PM
EGHDK
Yeah, so I have an .mp4 file video now that I'm trying to play, but it says video not supported when I try to play it in my app. If I email the same file to myself, it plays perfectly. Any educated guesses?
Md. N.
has entered the room
Md. N.
hi
Mark M.
EGHDK, let me take a question from Md. Nazrul Islam, and I'll be back with you in a moment
Md. Nazrul Islam: do you have a question?
Md. N.
yes
I'm currently working on ormlite
I need to insert bulk data
EGHDK
Yep, not a problem! I'll just leave the chat on, just give me your best guess. I'm going to go get some food. Thanks again for the help.
Md. N.
at a time like 100000 records
here is a stack-overflow question: http://stackoverflow.com/questions/17456321/how...
can you please check it .
Mark M.
yes, I already commented on it
Md. N.
okay
Mark M.
I have never used OrmLite, and so I do not have any hands-on experience with it
the big thing with bulk data insertion is that you need to use transactions
I have no idea if OrmLite maps its "savepoints" to SQLite transactions or actual SQLite savepoints
Md. N.
so what do you suggest otherthan ormlite
Mark M.
if savepoints are not transactions, switch to using transactions, as otherwise you are doing 100,000 individual disk I/O operations, which will be slow
I just work straight with SQLite myself, without an ORM later
er, layer
4:40 PM
Md. N.
okay ..
but you may give a shoot ..ormlite seems too handy
Mark M.
anyway, I recommend that you switch to using a transaction, if OrmLite treats that differently than it does a savepoint, and see if that helps
that being said, 100,000 inserts is not going to be quick
as device flash storage tends to be slow in comparison to what we're used to with desktop and notebook hard drives and SSDs
Md. N.
alright ..
Mark M.
you might also try https://groups.google.com/forum/#!forum/ormlite... if you do not get further help in StackOverflow
(note to EGHDK: if your MP4 is local, I cannot explain the difference, but if you are trying to stream the MP4, there are a variety of possible issues)
if either of you has another question, go ahead
4:45 PM
Md. N.
alright .. i better try it
thanks btw
Mark M.
you are very welcome
EGHDK
Yeah, the file is local. Plays through gallery, won't play in my app.
Mark M.
how are you trying to play it?
4:50 PM
Md. N.
Hey . can I ask another question ?
Mark M.
go ahead
Md. N.
say , I have a custom Listview ..
I mean items are custom
And I have multiple EditText in each item
for say listvie item size is quite large .. I need to get all the value from all the edit text
what do you suggest ?
Mark M.
I cannot really answer that
first, I do not like focusable widgets in ListView rows, as they tend to mess things up
second, you first need to work out how you are saving what the user types into the EditText widgets as you go, so as rows scroll and get recycled, you do not lose what the user types in
4:55 PM
EGHDK
Tried playing it using the sample code from Android. It's a battle for another day. Enjoy your 4th Mark! Appreciate the wisdom once again.
Mark M.
beyond that, I do not really understand your question, as I do not know what "item size is quite large" means
(EGHDK: I should have an improved video playing sample in the next update, FWIW)
Md. N.
I mean listview item count
Mark M.
again, you need to be updating some data model as the user is typing, otherwise you will lose data when the user scrolls the ListView
this is the closest sample I have to what you are doing, where I have a single RatingBar per row rather than multiple EditText widgets
if you follow some similar model with your EditText widgets, everything will be in your data model when you need it
Md. N.
thanks .. i will check that..
5:00 PM
Mark M.
that's a wrap for today's chat
the transcript will be archived shortly at http://commonsware.com/office-hours/
the next chat is Tuesday at 7:30pm Eastern
have a pleasant day, all!
Md. N.
:0
:)
EGHDK
has left the room
Md. N.
has left the room
Mark M.
turned off guest access

Yesterday, July 2

 

Office Hours

People in this transcript

  • EGHDK
  • Mark Murphy
  • Md. Nazrul Islam