Office Hours — Today, November 10

Thursday, November 5

Nov 10
7:50 PM
Mark M.
turned on guest access
Nov 10
7:55 PM
Student8080
has entered the room
ostaski
has entered the room
Mark M.
Welcome, Student8080!
Mark M.
And, welcome, ostaski!
Student8080
Hi Mark! =)
ostaski
Howdy Mark, how's trix?
Mark M.
Oy
Mark M.
Ever hear the expression "having the tiger by the tail"?
ostaski
that's good, right? :)
Mark M.
Depends on how big the tiger is and how fast it moves
Bhavyank
has entered the room
Mark M.
Right now, I feel like I'm on the underside of Tigger, and being bounced upon repeatedly
Mark M.
Welcome, Bhavyank!
ostaski
watch the teeth.
Bhavyank
Hey Mark! how are you?
Mark M.
Yes, they are sharp and pointy
Mark M.
I'm a wee bit frazzled, but otherwise OK.
ostaski
the weekend is only ... 3 days away
Bhavyank
what did i miss here??
Mark M.
Hmmmm...I know not this "weekend" of which you speak.
Nov 10
8:00 PM
Mark M.
Bhavyank:
Mark M.
oops
Mark M.
@bhavyahk: haven't missed anything yet
Mark M.
So, anyone have any Android dev questions
Mark M.
?
Bhavyank
great!! Yeah! if ostaski is in the middle of asking..i will take the next turn
ostaski
I'm picking up where I left off last week ... got sidetracked
ostaski
ostaski
didn't get any takers
Mark M.
yeah, my problem is that I'm being moderated on -beginners right now
Mark M.
I don't answer much there at the moment
Mark M.
cotton-pickin' spammers
ostaski
no problem ... didn't want to cross post
Mark M.
I suspect you'll need a wildcard in your intent filter
Mark M.
I think that if the intent specifies a MIME type, you may have to match it
Mark M.
No, wait
Nov 10
8:05 PM
Mark M.
OK, so your activity runs, but when you try invoking the MmsSender logic, you blow up trying to send the MMS, right?
ostaski
right
ostaski
No Activity found to handle Intent
Mark M.
Have you tried a concrete MIME type instead of image/* in your setType() call?
Mark M.
ostaski
yes, I tried: sendIntent.setType("image/jepg"); first
ostaski
typo this time around
Mark M.
Presumably you mean image/jpeg
ostaski
yes
Mark M.
What happened then?
ostaski
same error
Mark M.
The snippet I linked to does not have a subject extra
Mark M.
That's the biggest difference I see
ostaski
not sure where I got that, but it included the comment
ostaski
View paste
                // The Messaging app needs to see a valid subject or else it will 
treat this an an SMS. 
Nov 10
8:10 PM
ostaski
I can try without the subject extra
Mark M.
The other possibility, which would be somewhat screwy, is if you can't use a SD-card image but have to grab one out of the media store, per that snippet
Mark M.
Oh, oops
Mark M.
Big difference in the action
Mark M.
snippet has ACTION_SEND, you have ACTION_SENDTO
ostaski
right, I'm trying to do this w/o user interaction
Mark M.
Ah, right
Mark M.
might not be possible
Mark M.
I'd try getting it working with ACTION_SEND first, to make sure the rest of the Intent is working properly, then switch to ACTION_SENDTO
Mark M.
If you get the same error (No Activity found to handle Intent), then you're just out of luck, I suspect
ostaski
figures ... running w/o subject extra now
ostaski
how you say ... Oy
Mark M.
While you experiment...Bhavyank, did you have a question?
Nov 10
8:15 PM
Student8080
has left the room
Bhavyank
yup
Bhavyank
I am trying to
ostaski
same error ... I'll defer to Bhavyank
Bhavyank
load the images with AsyncTask and when i am trying to actually load it ..I get this particular error everytime
Bhavyank
skia D --- decoder->decode returned false.
Bhavyank
and I never get the image loaded
Mark M.
When you say "load the images", what do you mean?
Bhavyank
ohh ok..Let me be more specific. I have an ImageView as a place holder in my activity
Bhavyank
I have the visibility as invisible in the beginning and based on the activity context i have to set the image from one specific url
Bhavyank
to that imageview and turn the visibility of that imageview to visible
Mark M.
OK
Bhavyank
so i just used the following code:
Bhavyank
View paste
URL newUrl = new URL(imageLoc);
                    URLConnection conn = newUrl.openConnection(); 
                    conn.connect(); 

        			InputStream is = conn.getInputStream();
        			Log.i("[PgDetail]","Retriving Image.....");
        			 BufferedInputStream bis = new BufferedInputStream(is); 
                      Decode url-data to a bitmap.  
                     Bitmap bm = BitmapFactory.decodeStream(bis); 
                     bis.close(); 
                     is.close(); 
                      Apply the Bitmap to the ImageView that will be returned.  
                     programLogo.setImageBitmap(bm); 
Nov 10
8:20 PM
Mark M.
Urk
Mark M.
And you're doing this in what method in the AsyncTask?
Bhavyank
onpostexecute
DeltaDroid
has entered the room
Mark M.
OK. You might want to split that logic up so that the bitmap-loading is being done in doInBackground(), but that is probably not the source of your error.
Mark M.
Let me guess -- your error occurs on the BitmapFactory.decodeStream() call, right?
DeltaDroid
hello all
Bhavyank
yup
Mark M.
Howdy, DeltaDroid!
Mark M.
I'm not a huge fan of decoding the bitmap straight off of a URLConnection -- that always made me nervous.
DeltaDroid
hi Mark
Bhavyank
actually i used one of your Bus module and implemented my own CachedImageLoader as well
Mark M.
OK
Bhavyank
still i got the same error
DeltaDroid
I'm total newbie so forgive my questions
Mark M.
If you look at the image loading code I have (there and in the Thumbnail stuff), I use HttpClient and download the whole byte array, then create a Bitmap from there.
Mark M.
DeltaDroid: no problem
Mark M.
Bhavyank: part of the reason for that is so my data loading can be done in doInBackground() -- your code as it stands does the data loading in onPostExecute(), which is on the UI thread
Nov 10
8:25 PM
Bhavyank
yeah..But i wanted to set the visibility to visible after the image is loaded..
Bhavyank
so i put the logic in onPostExecute()
Mark M.
Bhavyank: you would still put the image in the ImageView and make it visible in onPostExecute()
Mark M.
However, the actual loading of the image off the URL would be done in doInBackground()
Mark M.
After all, you have no idea how long that might take, given Internet connection speeds and such.
Mark M.
Here in semi-rural Pennsylvania, I don't have 3G -- more like 0.72G, so downloads of anything take time.
DeltaDroid
I have been able to run "hello world" on Android 2.0 using eclipse on vista but its super slow and inconsistent what are my options for speed?
Bhavyank
got it
Mark M.
DeltaDroid: #1 = keep your emulator open
Mark M.
#2 = get more RAM (Eclipse + emulator + Vista is gonna be big)
Mark M.
What are the specs of your development PC?
Mark M.
(by specs, I mean amount of RAM and speed of the CPU)
Nov 10
8:30 PM
Mark M.
ostaski: you said you got the same error -- did you try ACTION_SEND?
ostaski
just tried with ACTION_SEND and get the SMS dialog ... bombs with
ostaski
Transactiojava.io.IOException: Cannot establish route for http://mms.msg.eng.t-mobile.n(651): com/mms/wapenc: Unknown host
DeltaDroid
just a minute
ostaski
probably an emulator thing?
Mark M.
Oh, yeah, I would suspect an emulator would have a trifle bit of trouble sending an MMS
ostaski
I'll try on my G1, but not now.
Mark M.
A bit surprised the error is that cryptic-looking
Mark M.
But, regardless, you're definitely past the no-activity-found error when using ACTION_SEND
Mark M.
If you substitute in ACTION_SENDTO now, you get the no-activity-found error?
DeltaDroid
4G ram /intel celeron 1.73GHz
Mark M.
DeltaDroid: the RAM is fine, the CPU is not
Mark M.
I would expect that to crawl
DeltaDroid
it crawls
DeltaDroid
is a physical phone like tmobile pulse a good test phone?
Nov 10
8:35 PM
Mark M.
I don't know much about the Pulse -- it's not available in the US AFAIK
Mark M.
Most Android phones are fine for development
ostaski
tried again with ACTION_SENDTO and get the same error as before ... No Activity found to handle Intent
Mark M.
ostaski: yup, you're screwed
DeltaDroid
lol
Mark M.
must be the SMS/MMS activity doesn't have a filter for ACTION_SENDTO, just ACTION_SEND
Mark M.
at least for the MMS case
ostaski
Oy
Mark M.
you could try looking at the source code and seeing if there's a way to reuse some of it
Mark M.
I think the Messaging app is open source, though I haven't really looked for it
ostaski
good idea; I'll try that. Thanks!
Mark M.
Worst-case, you'll have fodder for a feature request
Mark M.
it might be that it sends MMS using APIs not in the SDK, only available to firmware apps
Mark M.
but, you could petition for them to open those up or support ACTION_SENDTO
ostaski
Guess we'll know soon enough. :)
Nov 10
8:40 PM
ostaski
Android doesn't seem to like stuff being done w/o user interaction ... probably a good idea, but makes this app a bear to build.
DeltaDroid
can I get an idea of what guys are building on ?I think I need to go shopping before
DeltaDroid
I can really start
Mark M.
DeltaDroid: well, my main rig is a quad-core, but that's decidedly overpowered for what you need
Mark M.
I'd think a decent dual-core would suffice, with the RAM you have
Mark M.
Of course, I don't use Eclipse...
Bhavyank
Mark, I did what u said
ostaski
FWIW, I've got a dual core 2.13 GHz with 2 GB ram
Bhavyank
and I still get the same error
ostaski
xp
Mark M.
Bhavyank: using HTTPClient?
Bhavyank
nope..i copy pased code from
Bhavyank
Bhavyank
URLConnection connection=new URL(url).openConnection(); InputStream stream=connection.getInputStream(); BufferedInputStream in=new BufferedInputStream(stream); ByteArrayOutputStream out=new ByteArrayOutputStream(10240); int read; byte[] b=new byte[4096]; while ((read = in.read(b)) != -1) { out.write(b, 0, read); } out.flush(); out.close(); byte[] raw=out.toByteArray(); put(url, new BitmapDrawable(new ByteArrayInputStream(raw)));
Mark M.
Ah, OK. Forgot I used URLConnection there, but it still reads the whole thing in.
Mark M.
What is the full text of the error message?
Bhavyank
skia D --- decoder->decode returned false.
Nov 10
8:45 PM
Bhavyank
it comes in the middle of my logging
DeltaDroid
whats the eclipse substitute and why not eclipse
Mark M.
Bhavyank: try writing the byte array out to a file, perhaps on the SD card, then examining it to see if you are getting the same file downloaded as you would expect
Bhavyank
ohh ok..
Bhavyank
thats a good suggestion..but i have one more question
ostaski
DeltaDroid: I run eclipse 3.4 ... no problem on xp
Bhavyank
if others don't have any problem
Mark M.
DeltaDroid: why not Eclipse? Partly, it has only been in the past year that I had a rig that could handle it. Mostly, it's because IDEs get in my way.
ostaski
go for it, Bhavyank
Bhavyank
thanks guys
Bhavyank
I am in the situation where: I need to present the login page in the middle of the application flow. But I don't want to show the login page again, when user preses the Back Button
Bhavyank
when i say page, i meant activity
Bhavyank
Is there any way to do that. When u press Back, you can skip specific activity and go to the one before that?
Mark M.
Bhavyank: is the destination after the login activity always the same?
Nov 10
8:50 PM
Bhavyank
right now it is
Bhavyank
but i can see that in few weeks..it will be either or ..for two activities
Mark M.
Phooey
Mark M.
I was going to say you could make the login not be an activity, but just something that's part of the destination.
Mark M.
One trick that I know has been used works something like this:
Mark M.
Step #1: Set a boolean flag in your login activity (e.g., hasLoggedIn) to true right before calling startActivity() on the destination.
Mark M.
Step #2: in onResume() of your login activity, if hasLoggedIn is true, immediately call finish().
Mark M.
Step #3: there is no step #3
Bhavyank
aah!
Mark M.
That will give the desired flow, though I'm not sure if the login activity will briefly flash on-screen or not
Bhavyank
and will that take me to the activity before the login
Bhavyank
?
Mark M.
Yes, finish() is the Java equivalent of the user pressing the BACK button
Bhavyank
it is essetially two back button at once then?
Mark M.
More or less, yes
Bhavyank
ohh ok..
Bhavyank
is there any way to listen to back button
Bhavyank
and put our own intent in the listener? for startActivity?
Mark M.
Oh, I *really* wouldn't do that.
DeltaDroid
how quickly can i transition my c# knowledge to java and whats the best way
Mark M.
How does the user ever leave your app, except via HOME, then?
Nov 10
8:55 PM
Mark M.
DeltaDroid: depends. Do you watch Dollhouse?
Mark M.
;-)
Bhavyank
yeah..I see your point
Mark M.
Bhavyank: you can listen to BACK by overriding onKeyPreIme() in a View (and maybe in an Activity), but I would not start a new activity then -- that could get messy
DeltaDroid
no what is it ? wait let me google it
Mark M.
DeltaDroid: more seriously, you might consider _Head First Java_ or another book
ostaski
DeltaDroid: check out Thinking In Java - http://www.mindview.net/Books/TIJ/
Mark M.
don't worry about the Dollhouse reference, just a bad joke
DeltaDroid
lol
Mark M.
yeah, there's also a Wikibook on Java development and umpteen gazillion online tutorials
ostaski
I'll need to google dollhouse. :)
Bhavyank
ohh ok..
Bhavyank
Has anybody has luck to run the apps on droid?
Mark M.
I learned Java back when wooly mammoths roamed North America, so I haven't used any recent resources
DeltaDroid
ostaki:hahaa
Mark M.
Bhavyank: picked up a DROID last night for testing, haven't had a chance to try any apps on it yet
Mark M.
If you are near where Google's having one of their Android Developer Labs this month, they'll have DROIDs available
Bhavyank
ohh ok..I fear that I may run into layout issues
Bhavyank
with higher resolution..i checked romanguy's
Mark M.
That sort of thing you should be able to test via the emulator
DeltaDroid
I tried to get in but they said it was full
Bhavyank
guidelines
Nov 10
9:00 PM
Bhavyank
yeah..i can go 854 resoution in emulator..but it just makes the emulator screen big..i am not sure about density of the screen
ostaski
Mark, looks like time's up ... will you being doing this again next week?
Mark M.
there's a -scale option you can pass, or if you can run outside of Eclipse, just run the android command, bring up the AVD Manager, and it'll give you a dialog to help you compute the right values.
Mark M.
ostaski: yup, time's up
Mark M.
Yes, I'll have another office hours next week, same time.
Mark M.
I won't have one Thursday morning, though, as I have an online training session scheduled that I need to teach
ostaski
great, "see" you then ... over & out
ostaski
has left the room
Bhavyank
Thanks Mark,
DeltaDroid
thanks a lot had fun learn a lt
Bhavyank
Good night guys!!
Bhavyank
has left the room
DeltaDroid
has left the room
Mark M.
turned off guest access

Thursday, November 5

 

Office Hours

People in this transcript

  • Bhavyank
  • DeltaDroid
  • Mark Murphy
  • ostaski
  • Student8080
Adblock