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
|
Mark M. |
how can I help you today?
|
EGHDK |
Hey, three "quick" questions.
|
EGHDK |
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.
|
EGHDK |
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
|
Mark M. |
I definitely do not get into Window much, outside of the tapjacking chapter
|
Mark M. |
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
|
Jul 3 | 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
|
Mark M. |
dialogs sans fragments can be a pain due to configuration changes
|
EGHDK |
View paste
|
Mark M. |
um, which of the many answers did you try?
|
Jul 3 | 4:10 PM |
Mark M. | |
Mark M. |
that answer seems cleanest for use from onCreateView() of a DialogFragment
|
Mark M. |
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. | |
Mark M. |
if by Quicktime you mean .mov, that's not a supported format
|
Jul 3 | 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/
|
Mark M. |
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
|
Mark M. |
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?
|
EGHDK |
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?"
|
Mark M. |
you can access the asset via getAssets().open("/path/within/assets/directory.txt")
|
Mark M. |
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
|
Jul 3 | 4:20 PM |
Mark M. |
or, if you need an actual File object for some API
|
EGHDK |
Sweet nibblets. Thanks.
|
EGHDK |
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.
|
EGHDK | |
Mark M. |
I am hoping to cover DrawerLayout in the next update, or the one after that
|
Mark M. |
but it's not there presently
|
Jul 3 | 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
|
Mark M. |
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 :-)
|
Jul 3 | 4:30 PM |
Mark M. |
BTW, do you have a second StackOverflow account?
|
Mark M. |
this question just hit: http://stackoverflow.com/q/17457519/115145
|
EGHDK |
Hahah. Nope, but I'll check it out.
|
EGHDK |
Heh. Looks like the exact same question.
|
Mark M. |
great minds think alike
|
EGHDK |
Guess so.
|
Jul 3 | 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
|
Mark M. |
Md. Nazrul Islam: do you have a question?
|
Md. N. |
yes
|
Md. N. |
I'm currently working on ormlite
|
Md. N. |
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
|
Md. N. |
here is a stack-overflow question: http://stackoverflow.com/questions/17456321/how...
|
Md. N. |
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
|
Mark M. |
the big thing with bulk data insertion is that you need to use transactions
|
Mark M. |
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
|
Mark M. |
I just work straight with SQLite myself, without an ORM later
|
Mark M. |
er, layer
|
Jul 3 | 4:40 PM |
Md. N. |
okay ..
|
Md. N. |
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
|
Mark M. |
that being said, 100,000 inserts is not going to be quick
|
Mark M. |
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
|
Mark M. |
(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)
|
Mark M. |
if either of you has another question, go ahead
|
Jul 3 | 4:45 PM |
Md. N. |
alright .. i better try it
|
Md. N. |
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?
|
Jul 3 | 4:50 PM |
Md. N. |
Hey . can I ask another question ?
|
Mark M. |
go ahead
|
Md. N. |
say , I have a custom Listview ..
|
Md. N. |
I mean items are custom
|
Md. N. |
And I have multiple EditText in each item
|
Md. N. |
for say listvie item size is quite large .. I need to get all the value from all the edit text
|
Md. N. |
what do you suggest ?
|
Mark M. |
I cannot really answer that
|
Mark M. |
first, I do not like focusable widgets in ListView rows, as they tend to mess things up
|
Mark M. |
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
|
Jul 3 | 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
|
Mark M. |
(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
|
Mark M. | |
Mark M. |
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
|
Mark M. |
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..
|
Jul 3 | 5:00 PM |
Mark M. |
that's a wrap for today's chat
|
Mark M. |
the transcript will be archived shortly at http://commonsware.com/office-hours/
|
Mark M. |
the next chat is Tuesday at 7:30pm Eastern
|
Mark M. |
have a pleasant day, all!
|
Md. N. |
:0
|
Md. N. |
:)
|
EGHDK | has left the room |
Md. N. | has left the room |
Mark M. | turned off guest access |