Mark M. | has entered the room |
Mark M. | turned on guest access |
Apr 28 | 7:30 PM |
David | has entered the room |
Mark M. |
howdy, David!
|
David |
Hi Mark,
|
Mark M. |
how can I help you today?
|
David |
View paste
|
Mark M. |
um, use different methods
|
Apr 28 | 7:35 PM |
Mark M. |
or listeners
|
Apr 28 | 7:35 PM |
Mark M. |
are you creating image_B in Java code?
|
David |
load from drawable.
|
Mark M. |
another possibility is to look at the View that is passed into your onClick method
|
Mark M. |
OK, let's back up a step
|
Mark M. |
image_B is not "load from drawable", because
Drawable objects do not respond to clicks. ImageView does, Button does,
other widgets do
|
Mike R. | has entered the room |
Mark M. |
Are image_A and image_B being displayed by two separate ImageView widgets?
|
Mark M. |
(btw, howdy, Mike R!)
|
Mike R. |
Hello
|
David |
Yes. the image_B is added to ImageView, then addView is called.
|
Mark M. |
right
|
Mark M. |
so, you have two choices:
|
David |
onClick, I checked the instance of ImageView.
|
Mark M. |
1. You use a different OnClickListener object for the second ImageView
|
Mark M. |
2. You examine the View that is passed into onClick() and see which ImageView it is
|
fitz | has entered the room |
fitz |
MORNING (somewhere right...)
|
David |
Image_A and B added different scrollView.
|
Mark M. |
howdy fitz!
|
Mark M. |
David: that does not matter
|
David |
I see. I will try what you suggested.
|
Mark M. |
OK
|
Mark M. |
Mike: do you have a question?
|
Apr 28 | 7:40 PM |
Mike R. |
Yes.
|
Mike R. |
In my app, I have an object that contains a lot of State information.
|
Mike R. |
I periodically serialize all of the object within the state information
|
Mike R. |
All the objects implement Serializable
|
Mike R. |
at app startup I de-serialize my object(s) and I'm good to go
|
Mike R. |
If the de-serialization throws an exception, I no that this is a new install and I initialize all of my state objects.
|
Mike R. |
this works great - 99.99 percent of the time
|
Mike R. |
Every once in a while, the de-serialzation runs without an exception, but the objects that are returned are all null
|
Mike R. |
this is a bad thing. what can I do to prevent it?
|
Mark M. |
use something other than serialization?
|
Mark M. |
I've never liked Serializable
|
Mark M. |
painful to debug and slow
|
Mark M. |
I assume that you haven't caught this in the lab?
|
Mike R. |
Isn't this what Serializable was made for?
|
Mike R. |
I caught it once
|
Mike R. |
but I've gotten several crash logs from Android Market, so it's happening in the wild
|
Apr 28 | 7:45 PM |
Mark M. |
the question is, where's the problem coming: is
the file corrupt when it is being written, or is the read hiccuping on a
good file?
|
Mike R. |
Also, it happens on the device and I don't think I can actually look at files on the device. Can I?
|
Mark M. |
no, but you can copy the file to SD, or upload it somewhere
|
Mark M. |
in terms of "isn't this what Serializable was made
for", I'd write the data to XML, JSON, or SQLite well before I'd fart
around with some proprietary opaque format
|
Mike R. |
I think it's happening on the write, because once
it starts happening it happens every time on startup - rendering the app
unusable.
|
Mark M. |
hmmmm...
|
Mark M. |
not sure what to tell you
|
Mark M. |
I suggest doing a bit more protection at write time
|
Mike R. |
what kind of protection can i do?
|
Mark M. |
serialize to a temp file, read it back in to make sure it's good, then get rid of the real file and rename
|
Mark M. |
basically, don't assume your write worked until you test it
|
Mark M. |
BTW, are there any patterns in terms of what devices are having this problem?
|
Mike R. |
I haven't looked at the crash logs in detail. I know it happened on my Droid
|
Mark M. |
OK, it's not an ext4 issue, then
|
Apr 28 | 7:50 PM |
Mark M. |
you should also add this: http://android-developers.blogspot.com/201…
|
Mike R. |
One thing that I was doing it Serializing in the OnDestroy() method of the last Activity
|
Mike R. |
Took that out of the code recently
|
Mike R. |
I'm thinking maybe the app was getting killed before the serialzation was complete
|
Mark M. |
that's certainly a possibility
|
Shawn V. | has entered the room |
Shawn V. |
Hi
|
Mark M. |
anyway, let me take some other questions, and I'll cycle back to you in a bit
|
Mike R. |
ok
|
Mark M. |
fitz: do you have a question?
|
Mark M. |
(btw, howdy, Shawn!)
|
fitz |
yes - but on phone so will wait
|
Mark M. |
ok
|
Mark M. |
Shawn: do you have a question?
|
Shawn V. |
Yes,
|
Shawn V. |
I have been doing Android for 8 months
|
Shawn V. |
But embedded software for about 20 years
|
Shawn V. |
I am supporting a software package written by BNR
|
Shawn V. |
So I have a lot of good examples to go by
|
Shawn V. |
But there are some fundamental ideas I think I am missing
|
Shawn V. |
For example, a view has a concept of an emptyView
|
Shawn V. |
But does it have a concept of an error view or multiple error views
|
Shawn V. |
I can always pop a dialog or update a text view
|
Apr 28 | 7:55 PM |
Mark M. |
first, a View does not have a concept of an emptyView
|
Mark M. |
AdapterView does
|
Mark M. |
so, ListView, GridView, etc.
|
Mark M. |
second, no, there is nothing like an "error view"
|
Mark M. |
UI handling of errors is up to you
|
scottt | has entered the room |
Shawn V. |
Another?
|
Mark M. |
let me swing through the others, and I'll get back with you in a bit
|
Shawn V. |
Sure
|
Mark M. |
scottt: nice timing -- do you have a question?
|
scottt |
not yet. ph call
|
Mark M. |
OK
|
Mark M. |
David: do you have another question?
|
Mark M. |
Mike: do you have another question?
|
Mike R. |
Nope. Still thinking about dealing with the first one.
|
Mark M. |
OK
|
Mark M. |
fitz: you ready?
|
Apr 28 | 8:00 PM |
scottt |
i don't have a question, but a comment: you're mentioned in 2 new books i just rec'd
|
scottt |
p120 of Beginning Android Games and p445 of pro Android 3
|
Mark M. |
heh, both Apress
|
Mark M. |
Shawn: got another question?
|
Shawn V. |
Definitely
|
Mike R. | has left the room |
Shawn V. |
I have an app that has two tabs and a view in each tab
|
Shawn V. |
On view uses and GroupedObjectCursorAdapter->ObjectCursorAdapter-BaseAdapter
|
scottt |
yeah. a little cross-marketing, eh? BAG directs the reader to yout books for more info on layouts/view groups/etc
|
Shawn V. |
The other is based on an ArrayAdapter
|
Shawn V. |
Now, I was asked if I could combine these two views into one scrollable view
|
Shawn V. |
And I thought of using the mergeAdapter you talked about
|
Shawn V. |
But in learning to think Android
|
Shawn V. |
I just wanted to know if there is any way to bind two views
|
Shawn V. |
Into a parentView that can scroll up and down
|
Shawn V. |
I know I said that like a 4 year old
|
Mark M. |
yes and no
|
Mark M. |
there is ScrollView
|
Mark M. |
but you cannot put scrollable things, like a ListView, in a ScrollView
|
Mark M. |
they fight over the touch events
|
Apr 28 | 8:05 PM |
Shawn V. |
That makes sense
|
Shawn V. |
And from a user perspective I think it is a bad idea,
|
Shawn V. |
But I have iPhone developers blazing the UI trail before me
|
Shawn V. |
So they think of some wacky things they want to do with the UI
|
Mark M. |
that's a large part of the reason why MergeAdapter
exists -- so you can stitch two Adapters' worth of data into one
scrollable entity
|
Shawn V. |
My understanding thought is that the merge items are sort of treated the same way?
|
Shawn V. |
though
|
Mark M. |
treated the same as... what?
|
Shawn V. |
Once the items are merged, can you implement separate onClickListeners for each item type?
|
Shawn V. |
So that items come from one source have one type of listener
|
Mark M. |
no
|
Mark M. |
the listeners are by the ListView
|
Mark M. |
you will need to distinguish type from type yourself based on position
|
fitz |
Mark I did look in detail at Adv Ch 17, 18, 19 -
have some great ideas and might even see light at the end of the
LONGGGGG tunnel - so thanks for books - keep on updating them :)
|
Shawn V. |
That makes sense. Thansk.
|
Mark M. |
fitz: hopefully, it's not an oncoming truck
|
Mark M. |
scottt: do you have a question?
|
fitz |
are you going to JAX this year in San Jose - guess first your in US
|
Mark M. |
fitz: no, not going to JAX
|
Apr 28 | 8:10 PM |
Mark M. |
either the conference or the city in Florida
|
Apr 28 | 8:10 PM |
fitz |
na it is an ambulance
|
Apr 28 | 8:10 PM |
fitz |
ok - got a free ticket the other day so thinking about it
|
scottt |
Pro Android 3 mentions your WakefulIntentService and gives the github link
|
fitz |
I have question on books - will hit you up on next office session - need to deal with phone issues again
|
scottt |
but i need to get back to the BCG2AAD so that i can try to acquire more bug bounty codes to give out as door prizes
|
Mark M. |
fitz: OK, two next week, 2:30pm Eastern
|
fitz |
ok thanks cya
|
fitz | has left the room |
Mark M. |
scottt: that's all cool... but do you have a question?
|
scottt |
i did, but all-nighter made me forget it :-(
|
Mark M. |
oops
|
Mark M. |
sorry
|
Mark M. |
maybe you'll remember before the chat ends
|
Mark M. |
OK, free for all -- anyone with a question, chime in
|
Shawn V. |
I have a book question. I have your books and
several others and at a medium to low level, they are very good, give
good examples, etc
|
Shawn V. |
But is there a book, documentation, etc at a very high level
|
Apr 28 | 8:15 PM |
Shawn V. |
That helps you see the Object Patterns in Android that helps you in visualizing
|
Mark M. |
I don't really know what "a very high level" is with respect to Android
|
Mark M. |
there's not that much in the way of "object patterns in Android"
|
Mark M. |
IMHO
|
Shawn V. |
I guess like a Patterns book for Android
|
Shawn V. |
More about problem solving in the Android environment
|
Mark M. |
usually patterns books come out several years after the introduction of a technology
|
Shawn V. |
And the "correct" way to go about certain things
|
Mark M. |
check back in 2013 or 2014 :-)
|
Shawn V. |
:)
|
Mark M. |
"correct" varies over time
|
Shawn V. |
Plus my background is varied, but mostly from a very low level.
|
Mark M. |
I'll be getting into bits and pieces of that in _Tuning Android Applications_, the next book in the series
|
Shawn V. |
This is the first time anyone has been brave enough to let me touch a UI :)
|
Shawn V. |
Awesome!
|
Mark M. |
but that'll be mostly along the lines of patterns for saving CPU/battery/RAM
|
Mark M. |
not "high level"
|
Shawn V. |
I just got a 50 page white paper from the "mobility experts" where I work on that kind of stuff
|
scottt |
i'd recommend some of the slides from some of the conventions
|
Mark M. |
yeah, conference presentations are often good for high level depictions
|
Mark M. |
Google I|O sessions are all on YouTube
|
Shawn V. |
I have watched several of the Google I/O 2009 and 2010 and they were very helpful.
|
scottt | |
Mark M. |
a bunch of the Android ones from this year's should be streamed live
|
Shawn V. |
I'm just kind of hard-headed. Too many years of being able to do anything I want in C code
|
Shawn V. |
Yeah, I heard that. People asked me if they stream them live, why go?
|
Mark M. |
that's a fine question
|
Shawn V. |
I always thought you went to those things to have fun and talk to people about the stuff you do
|
scottt |
perhaps to get the handout phone?
|
Mark M. |
there are some benefits to being there live
|
Apr 28 | 8:20 PM |
Shawn V. |
Very few people I know that I can talk Android development with
|
Shawn V. |
And the iPhone people really don't get me :)
|
Mark M. |
scottt: yeah, I suspect that's why I|O sold out in less than an hour
|
scottt |
i find conventions very motivational -- especially on someone else's dime
|
Mark M. |
conversely, outside of I|O, I pretty much avoid conferences unless I'm presenting
|
Mark M. |
too many people
|
scottt |
look for an android dev group near you. i just started one here in tampa bay to have others to share info/etc with
|
Shawn V. |
I went to one last week that started here in Tampa, Fl
|
scottt |
i found google's group listings paltry and frankly pathetic, but meetups.com has a lot of groups for a lot of things
|
scottt |
oh. did i meet you there?
|
Shawn V. |
Yep
|
scottt |
lol!
|
Shawn V. |
So I tried to do a really bad thing in Android last week
|
Mark M. |
I'd cue up "It's a Small World", but that's more Orlando... :-)
|
Shawn V. |
I tried to implement a dialog inside of a listener and make the listener return the results of the dialog
|
scottt |
did you just join commonsware? i was plugging it.
|
Shawn V. |
Really bad idea.
|
Shawn V. |
Are there any really common bad ideas people have when writing Android Apps?
|
scottt |
(you're welcome mark. but its not entirely unselfish of me to make sure your site/books stay around)
|
Mark M. |
Shawn: all UI stuff in Android is asynchronous, so, yeah, your approach was pretty much doomed
|
Apr 28 | 8:25 PM |
Mark M. |
scottt: thanks for the kudos!
|
Shawn V. |
Scott: I took a class from BNR and as part of the class I got a year's subscription
|
Shawn V. |
Yep, I did a face plant when I realized what I was trying to do.
|
scottt |
i'm trying to get our site set up for apress's user group program, but nobody answers my emails to their contact
|
Mark M. |
Apress has a user group program?
|
Shawn V. |
Are there any other ones that you see people trying to do over and over again Mark?
|
Mark M. |
they're not terribly well organized
|
Mark M. |
Shawn: lots, but everlasting services is probably one of the biggest bugaboos
|
scottt |
they say they do (on their home page), but its been a couple/few weeks and a couple of emails and no response yet
|
scottt |
i'll try calling the ph# next
|
Shawn V. |
Everlasting services?
|
Mark M. |
ones that you start and never stop, particularly starting them at boot time
|
Mark M. |
99.99% of Android apps do not need them
|
Shawn V. |
Nope, the app I work on has a service that starts when the application starts
|
Mark M. |
they're the reason the task killer was invented
|
Shawn V. |
But it is mostly for being able to download content after the user has selected it when they aren't using the app
|
Mark M. |
so long as you shut that service down as soon as you're done with it, you're good
|
Mark M. |
ah
|
Mark M. |
OK, so long as it shuts itself down when it's out of work (e.g., IntentService), you're good
|
Shawn V. |
That is the case.
|
Shawn V. |
Nothing in queue, the service shuts down
|
scottt |
i mistyped earlier, it was the work sessions for this link that had a lot of android-101 info: http://andevcon.com/speakerpresentations.html
|
Shawn V. |
I didn't code it though, I just use it
|
Mark M. |
beautiful!
|
scottt |
the sessions at the end of the list that sart with W-
|
Shawn V. |
Thanks Scott
|
Apr 28 | 8:30 PM |
Mark M. |
yeah, AnDevCon had some decent sessions
|
David | has left the room |
scottt |
i banged out a quick-and-dirty app the other night to solve an immediate need
|
Shawn V. |
We'll it's 8:30. Back to making tiny green cashy
pieces of paper for writing code for the evil Very Large Telecom Company
(VLTC)
|
scottt |
i needed a quick way to send a clock-in/out type email
|
Shawn V. |
Thank you very much for having this service and writing your books
|
Mark M. |
happy to help!
|
Shawn V. |
Next office hours?
|
scottt |
cya guys
|
Shawn V. |
Never mind, I see it now
|
Shawn V. |
Good night all and thanks again
|
scottt |
mark, look me up when you come to tampa bay. i'll buy you a beverage of your choice
|
Mark M. |
2:30pm Eastern Tuesday and Thursday next week
|
Mark M. |
scottt: ok!
|
Mark M. |
have a pleasant day, all!
|
scottt | has left the room |
Shawn V. | has left the room |
Mark M. | turned off guest access |