Saurabh you did implement the OnClickListener as an anonymous class and the click just works fine.The only problem here is that you are running it on an android 2.2 emulator since you will be launching an google map you should run it on an emulator which has one and you should do this by installing google api 2.2 platform and creating an emulator for it.I have run the same code you put here on an google api 2.2 emulator and it works just fine
Joined: Sep 21, 2011
zoheb hassan wrote:Saurabh you did implement the OnClickListener as an anonymous class and the click just works fine.
How do you figure that? The post states that the logging statements are not being executed - so the button click does not "work just fine". Furthermore, how do you infer that code runs on Android 2.2, or in an emulator? None of that is mentioned in the post.
Joined: Sep 05, 2011
whats the point of using System.out.println() for android you can use Log??
How do you figure that? The post states that the logging statements are not being executed - so the button click does not "work just fine".
Hey Tim well i did mention that i ran the code myself and the log statements do execute fine unless he tied his OnClickListener to an another button which may not be the case and the implementation however was right i.e., listening for a button click and firing an intent. Looking at the code one can infer that the guy was using an EdiText to take an input location and on click of an button wanted to display on map the location the user Input.
What i am not clear tough is whether you were asking a question or asserting the above statement
Furthermore, how do you infer that code runs on Android 2.2, or in an emulator? None of that is mentioned in the post.
Because the only place this code would fail is on an android emulator with no google apis.If the same code was being run on an actual device or an emulator with google api it would not fail and hence the statement was made.His implementation or the code was all right only issue here was running it on an emulator not meant for it
Joined: Sep 21, 2011
i ran the code myself and the log statements do execute fine
Well, we don't know what code you ran, but we have to believe Saurabh Pillai when he says that his code is not logging anything, and thus does not work fine. (And no, I'm not asking, I'm making a statement.)
Because the only place this code would fail is on an android emulator with no google apis.
The code appears not even to run, so it's too early to make assumptions about why it fails. There are plenty of devices that do not have the Google APIs, by the way, not just the emulator. Those devices *may* have other software that knows what to do with a "geo:" URI, or they may not. (And I still don't see where the "Android 2.2" comes from.)
As a general rule, I'd put an @Override annotation before each method that is supposed to override (or implement) a superclass (or interface) method. That habit will save you lots of time, even if it's not the problem here.
Joined: Sep 12, 2008
Zoheb was right. I was running it against Android emulator as opposed to Google API emulator. I changed it to proper emulator and it works just fine.
Also, I was wrong about logging-statements-not-being-printed or I should say I was looking at the wrong place. I was looking at Console opposed to LogCat. But I did not know anything about DDMS when I posted this question. I read about it now and now I know something.
But it is really frustrating that emulator take really long (10 minutes for Google API level 8 emulator). How long does it take for you guys?
Well Saurabh glad that the posts were helpful in figuring out what the problem was.As for looking at the wrong places you figured where to look for them that's another step forward.Good luck in developing your app and do let us know when you publish it to the market and as for emulator it does take frustratingly long for it to get started don't worry about it just leave it on once you begin for the day and close it when only when you are done with it or you can get a android device.