[android-developers] Problems with ListView using buttons on each row
I have an issue with a list view that has buttons (more precisely ImageButton) on each row. (The list view is similar to the one used in the Amazon MP3 application included in the G1 where you can see the song/album name and press a button with the price to purchase it.) I need to be able to perform 2 actions for each row - one when you click on the row and different when you click on the row's button. Adding the button itself to the row and handling the button clicks works fine, the problem is that for every row that has a button, you can't click on the row itself anymore. You can click on the row's button, but clicking on the rest of the row does not generate ItemClick event for that row in the list view. You can select the row using the navigation keys and press Enter and that correctly generates the ItemClick even on the row, but clicking on the row itself does nothing. If I hide the buttons on some of the rows, the row without a button clicking starts to work correctly, but the rows with buttons still don't work. It seems like the existence of a button on the row renders the row itself unclickable. Oddly enough, if you use a RatingBar on the row instead of the Button you can click on both the row and the rating bar independently and they all work correctly as expected. Does anyone know why would the Button behave differently than the RatingBar and what is the correct way to make both the button and row be independently clickable. Stefan --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] saving and restoring scrollbar position
Hi, I have an ExpandableListView with lots of elements in it. I need to remember how much the list is scrolled, save it and later on restore the list scrolled at the same position. Because of that I have two problems: First: how to get the scrolled coordinates? I tried with getScrollX() and getScrollY(), but they are always returning (0,0) . I also tried getGlobalVisibleRect(), no success either. Second: Once I have the coordinates how do I restore them? Again I tried using the provided scrollTo() and scrollBy() functions (not with real values cause i can't get them). The list is scrolled, great, but the scrollbar stays in its initial position, not great at all. I again also tried requestRectangleOnScreen, but again no success either. This tasks seems to me that should not be so difficult to accomplish, but nevertheless I have no idea how to. Any help will be greatly appreciated. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] What is the proper handling of action.MEDIA_BUTTON?
Does anyone know what is the proper way of subscribing for the action.MEDIA_BUTTON - (this is sent by the button on the headset and currently controls the play/pause of the built in player). The built in music application, registers a broadcast receiver for that action in the AndroidMainfest which explicitly ties it to that button. If another player wants to hijack the button it probably has to register I higher priority receiver and abort the broadcast chain so the media player does not get it. Would it be better to register for it dynamically (for example when the player is playing, or the application window is open) or register in AndroidManifest which theoretically will prevent the built in player form ever working. Has anyone had experience handling this? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] SlidingDrawer not working with RC33
It appears that android.internal.widget.SlidingDrawer widget had changed between RC30 and RC33. On RC33 it fails to inflate the layout XML complaining that: The handle attribute is required and must refer to a valid child This is the XML I am trying to inflate: com.android.internal.widget.SlidingDrawer android:id=@+id/drawer android:layout_width=fill_parent android:layout_height=wrap_content android:topOffset=5px android:bottomOffset=7px android:handle=@+id/playlistHeader android:content=@+id/playList ImageView android:id=@id/playlistHeader android:focusable=true android:clickable=true android:scaleType=center android:src=@drawable/ic_mp_current_playlist_btn android:layout_height=56dip android:layout_width=fill_parent / ListView android:id=@+id/playList android:layout_width=fill_parent android:layout_height=fill_parent android:background=@color/grid_dark_background/ /com.android.internal.widget.SlidingDrawer The XML above has both the content and the handle attribute and worked fine in RC30? Does anyone know what has changed and how to fix it? Stefan --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: SlidingDrawer not working with RC33
After digging a bit around in the source code, it looks like the namespace used for the attributes of the internal widgets has changed in RC33 from xmlns:android=http://schemas.android.com/apk/res/ android to some other namespace (probably something like http://schemas.android.com/apk/res/android.intenral ??) and that caused the SlidingDrawer to not find its attributes. Well... one should never rely on internal classes, but... the SlidingDrawer is actually so useful... I am glad it will make it as an officially supported class. On Feb 7, 4:34 pm, Romain Guy romain...@google.com wrote: Even worse, SlidingDrawer will move to android.widget in Cupcake :)) (And thus become public API.) On Sat, Feb 7, 2009 at 12:14 PM, Jean-Baptiste Queru j...@android.com wrote: Oh, ah, I hadn't seen that it was android.INTERNAL.SlidingDrawer (emphasis mine). There's no guarantee of compatibility of private APIs between versions. JBQ On Sat, Feb 7, 2009 at 11:28 AM, Romain Guy romain...@google.com wrote: No, SlidingDrawer is a private widget. It is not supported. On Sat, Feb 7, 2009 at 7:18 AM, Jean-Baptiste Queru j...@android.com wrote: Can you please report this issue inhttp://b.android.com/? (a plain copy-paste will do). Thanks, JBQ On Sat, Feb 7, 2009 at 6:54 AM, Stefan skyntc...@gmail.com wrote: It appears that android.internal.widget.SlidingDrawer widget had changed between RC30 and RC33. On RC33 it fails to inflate the layout XML complaining that: The handle attribute is required and must refer to a valid child This is the XML I am trying to inflate: com.android.internal.widget.SlidingDrawer android:id=@+id/drawer android:layout_width=fill_parent android:layout_height=wrap_content android:topOffset=5px android:bottomOffset=7px android:handle=@+id/playlistHeader android:content=@+id/playList ImageView android:id=@id/playlistHeader android:focusable=true android:clickable=true android:scaleType=center android:src=@drawable/ic_mp_current_playlist_btn android:layout_height=56dip android:layout_width=fill_parent / ListView android:id=@+id/playList android:layout_width=fill_parent android:layout_height=fill_parent android:background=@color/grid_dark_background/ /com.android.internal.widget.SlidingDrawer The XML above has both the content and the handle attribute and worked fine in RC30? Does anyone know what has changed and how to fix it? Stefan -- Jean-Baptiste M. JBQ Queru Android Engineer, Google. -- Romain Guy Android framework engineer romain...@android.com Note: please don't send private questions to me, as I don't have time to provide private support. All such questions should be posted on public forums, where I and others can see and answer them -- Jean-Baptiste M. JBQ Queru Android Engineer, Google. -- Romain Guy Android framework engineer romain...@android.com Note: please don't send private questions to me, as I don't have time to provide private support. All such questions should be posted on public forums, where I and others can see and answer them --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: SlidingDrawer not working with RC33
Yes, I do agree that relying on private APIs is dangerous and should be avoided for all the reasons you mention. (The only reason I posted my findings is to save somebody the debugging time as it was not obvious what was the reason at first) This brings another related question. Is there a single place where we as developers can see what has changed between the public releases of the API's for example from RC30 = RC33? - (preferably both internal and external changes)? The only thing I could find is that RC33 has fixed several bugs and added several features, but nothing specific about what has changed and what bugs have been fixed. Stefan On Feb 7, 6:21 pm, Jean-Baptiste Queru j...@android.com wrote: Even worse, it hurts the entire ecosystem, by making users believe that plaftorm upgrades have bugs when in fact the applications are broken to start with. JBQ On Sat, Feb 7, 2009 at 3:18 PM, Romain Guy romain...@google.com wrote: That means your app will break in cupcake though. Please, please don't use private APIs, it only hurts the users :( On Feb 7, 2009 1:43 PM, Stefan skyntc...@gmail.com wrote: After digging a bit around in the source code, it looks like the namespace used for the attributes of the internal widgets has changed in RC33 from xmlns:android=http://schemas.android.com/apk/res/ android to some other namespace (probably something likehttp://schemas.android.com/apk/res/android.intenral ??) and that caused the SlidingDrawer to not find its attributes. Well... one should never rely on internal classes, but... the SlidingDrawer is actually so useful... I am glad it will make it as an officially supported class. On Feb 7, 4:34 pm, Romain Guy romain...@google.com wrote: Even worse, SlidingDrawer will move ... On Sat, Feb 7, 2009 at 12:14 PM, Jean-Baptiste Queru j...@android.com wrote:Oh, ah, I had... On Sat, Feb 7, 2009 at 11:28 AM, Romain Guy romain...@google.com wrote:No, SlidingDraw... On Sat, Feb 7, 2009 at 7:18 AM, Jean-Baptiste Queru j...@android.com wrote: Can you please report this issue inhttp://b.android.com/?(a plain copy-paste will do).Thanks, JBQ On Sat, Feb 7, 2009 at 6:54 AM, Stefan skyntc...@gmail.com wrote: It appears that ... romain...@android.com Note: please don't send private questions to me, as I don't have time to provide private... Romain Guy Android framework engineer romain...@android.com Note: please don't send private questions to me, as I don't have time to provide private suppo... -- Jean-Baptiste M. JBQ Queru Android Engineer, Google. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: SlidingDrawer not working with RC33
Dianne, In this particular case, the SlidingDrawer class is not private, it is public but it is in the package com.android.internal.widget package. This .internal. (and the lack of official documentation on it) is the only clue you get that this class is probably not intended to be used directly. (I come from the world of Windows Mobile development where it is to a large degree a custom to rely on some undocumented APIs to do what you want to do, so that made me take that gamble, which in my case did not pay of) I actually did something similar to what you suggest - as my app was already built around it - I end up creating my own implementation for the SlidingDrawer - this way I know it will work with RC30, RC33 and probably Cupcake. I have to admit, the fact that the Android is an open source OS and we have at all access the the source code to learn and diagnose issues, is like a breath of fresh air after having to deal for many years in the proprietary Windows world. My only suggestion is that at least for the official releases RC30, RC33 etc. that are being pushed to the end users - give us a way to find what has changed in the APIs and what bugs have been fixed. I simple change list will do, or an API checking tool or whatever other means that you can think of. On Feb 7, 10:48 pm, Dianne Hackborn hack...@android.com wrote: When a new SDK is posted, there is a complete API diff and overview of the changes. However, there is very little change to the platform APIs in 1.1, so there isn't much to say about this one. I'm not sure when an SDK for it will be available. Also, out of curiosity, how did you go about using the private class? If you are actually using the SDK, you shouldn't be able to use any of the private classes, just to protect people from accidentally using things that will break on them. Finally, if there is a class like this in the internal implementation that you really want to use, just copy it out and build the copy in to your own code. That way your code won't break when the system changes. On Sat, Feb 7, 2009 at 4:10 PM, Stefan skyntc...@gmail.com wrote: Yes, I do agree that relying on private APIs is dangerous and should be avoided for all the reasons you mention. (The only reason I posted my findings is to save somebody the debugging time as it was not obvious what was the reason at first) This brings another related question. Is there a single place where we as developers can see what has changed between the public releases of the API's for example from RC30 = RC33? - (preferably both internal and external changes)? The only thing I could find is that RC33 has fixed several bugs and added several features, but nothing specific about what has changed and what bugs have been fixed. Stefan On Feb 7, 6:21 pm, Jean-Baptiste Queru j...@android.com wrote: Even worse, it hurts the entire ecosystem, by making users believe that plaftorm upgrades have bugs when in fact the applications are broken to start with. JBQ On Sat, Feb 7, 2009 at 3:18 PM, Romain Guy romain...@google.com wrote: That means your app will break in cupcake though. Please, please don't use private APIs, it only hurts the users :( On Feb 7, 2009 1:43 PM, Stefan skyntc...@gmail.com wrote: After digging a bit around in the source code, it looks like the namespace used for the attributes of the internal widgets has changed in RC33 from xmlns:android= http://schemas.android.com/apk/res/ android to some other namespace (probably something likehttp:// schemas.android.com/apk/res/android.intenral ??) and that caused the SlidingDrawer to not find its attributes. Well... one should never rely on internal classes, but... the SlidingDrawer is actually so useful... I am glad it will make it as an officially supported class. On Feb 7, 4:34 pm, Romain Guy romain...@google.com wrote: Even worse, SlidingDrawer will move ... On Sat, Feb 7, 2009 at 12:14 PM, Jean-Baptiste Queru j...@android.com wrote:Oh, ah, I had... On Sat, Feb 7, 2009 at 11:28 AM, Romain Guy romain...@google.com wrote:No, SlidingDraw... On Sat, Feb 7, 2009 at 7:18 AM, Jean-Baptiste Queru j...@android.com wrote: Can you please report this issue inhttp://b.android.com/?(ahttp://b.android.com/?%28aplain copy-paste will do).Thanks, JBQ On Sat, Feb 7, 2009 at 6:54 AM, Stefan skyntc...@gmail.com wrote: It appears that ... romain...@android.com Note: please don't send private questions to me, as I don't have time to provide private... Romain Guy Android framework engineer romain...@android.com Note: please don't send private questions to me, as I don't have time to provide private suppo... -- Jean-Baptiste M. JBQ Queru Android Engineer, Google. -- Dianne Hackborn Android framework
[android-developers] Re: SlidingDrawer not working with RC33
Building apps with the SDK is apparently NOT enough to insure API compliance as the example with the SlidingDrawer showed - the app was build with the latest SDK 1.0 r2 and without using reflection or any other funky access. I firmly believe that we as developers, have the most vested interest for our apps to work on the widest possible range of API versions and device types (Just wait until Android gets a candy bar style models where users rely mostly keyboard for navigation. How many of the apps available today will still work flawlessly?). If you put lots of time and effort to write your app, you want to ensure that you did not do (unknowingly) anything stupid to limit its use. Even more you want to find as soon as possible all stupid things you did and fix them before they hit the end user. I am sure we all test our apps on the emulator and the G1 device we have, but can you be absolutely sure it will work flawlessly on the next release (RC33.. Cupcake...)? One other example I noticed - the text on the tab buttons - in RC30 if it is longer - it wraps, in RC33 - the same text is displayed in a marquee). Is this an API change? While the tab text is probably not significant issue, it points that you really don't know about it until you get the RC33 and realize that your UI may be a bit off here and there. The truth is API changes happen - sometimes they are big and obvious, sometimes small and less obvious. In my opinion the smart thing to do is to give developers the information and tools to react to the changes and update our applications as soon as possible. There is probably a complementary set of tools that can help us with that: API change list, API Checking tool, Emulator images for RC30, RC33 Cupcake etc - are all ways that we can use proactively before the new platform changes are pushed to the public. On Feb 8, 5:18 am, Al Sutton a...@funkyandroid.com wrote: I agree it's not necessary if you're building apps with the SDK, but I see it's primary usage as being by developers wanting to check an apks' compliance level and its' results would be firmly tied to the android version and thus the SDK version, so an API checker from the 1.0 SDK may generate errors for cupcake apps, but an API checker from the cupcake SDK would pass them. Al. Urs Grob wrote: I'm not sure if it should be part of the sdk. any app created with the sdk already would pass this check. It should more be a tool built into the normal make process so you get warnings like you get right now if you change the api. Additionally it could notify the developer and maybe show him a link with FAQs about internal api usage, or jni, or whatever evil was detected in the app. On Sun, Feb 8, 2009 at 11:10 AM, Al Sutton a...@funkyandroid.com wrote: Looks like we're on the same page :). Just PLEASE make this a public API checker (possibly as part of the SDK). I'd happily include the check into AndAppStore, and I'm sure Shane would be interested in putting into SlideME as well. Al. Romain Guy wrote: That said, it could be interesting to flag bad apps on Market and warn the user that the app he's about to download might break with a future update of the system :)) On Sun, Feb 8, 2009 at 2:06 AM, Romain Guy romain...@google.com wrote: It would be way too costly to do it at install time (both in CPU and disk space.) We could do the check during the upload to Market but that wouldn't solve the issue with apps installed through other means (especially alternatives to Market.) I'd rather trust the developers to do the right thing. On Sun, Feb 8, 2009 at 2:02 AM, Al Sutton a...@funkyandroid.com wrote: Is checking API usage in a apk feasible? That way problems could be picked up at distribution or installation time? Al. Romain Guy wrote: That's the whole point of the SDK. It does NOT let you use private APIs since they are stripped out of the SDK. If you compile your app against the git tree or a custom SDK, there's not much we can do. It's also up to the developers to be reasonable. On Sun, Feb 8, 2009 at 1:43 AM, Al Sutton a...@funkyandroid.com wrote: Maybe an API compliance test should be run as part of any app build. Does an API usage checking tool exist? and is it publicly available? Al. Jean-Baptiste Queru wrote: Even worse, it hurts the entire ecosystem, by making users believe that plaftorm upgrades have bugs when in fact the applications are broken to start with. JBQ On Sat, Feb 7, 2009 at 3:18 PM, Romain Guy romain...@google.com wrote: That means your app will break in cupcake though. Please, please don't use private APIs, it only hurts the users :( On Feb 7, 2009 1:43 PM, Stefan skyntc...@gmail.com wrote: After digging a bit around in the source code, it looks like the namespace used for the attributes of the internal widgets has changed in RC33 from xmlns:android=http://schemas.android.com/apk
[android-developers] Re: SlidingDrawer not working with RC33
Dianne, To finish that dreaded SlidingDrawer topic - yes the use of the SlidingDrawer was in the Layout xml file only so I guess its was a loophole that I end up using without realizing. Thanks for your comments on the rest of the issues. I think we all agree that changes in the APIs happen and will happen. All we want is an advance notice so we can proactively react to them. In my experience probably a good start is to have: 1. Good Change List 2. A single pace where Google (and probably partners) can push emulator images (or ways to build them) for the various API releases and platforms. This will be a huge help to ensure we are ready for the new releases. On Feb 9, 11:32 am, Romain Guy romain...@google.com wrote: Currently the app lifecycle for the user is: Download app - get OTA - broken app - wait for app update - download app update - working app - get OTA - broken app - wait for app update - download app update - working app - .. Which is exactly why we tell developers not to use private APIs. But that's not your case and I already apologized for the lack of changelog for the current update. And you're right the SDK should also go out to developers before the update reaches the users. The good news is, it is what we want to do for Cupcake :) -- Romain Guy Android framework engineer romain...@android.com Note: please don't send private questions to me, as I don't have time to provide private support. All such questions should be posted on public forums, where I and others can see and answer them --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] How to get the current battery level of the device using an API call
Is there a way to get the current battery status of the device (battery level and if the battery is currently charging). The only way I found so far is by using a Broadcast receiver to listen for battery status changes. Is there a way to get the battery status using a direct API call? I my case, I would like to check if the battery has sufficient charge (or is being currently charged) before starting the download of some (potentially large) files. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] problems with the usage of sdcard iso in android sdk 1.6
Hello @all, have someone tested an app with android sdk 1.6 r1 and the usage of an sdcard iso?? In my app i use: private File root = Environment.getExternalStorageDirectory(); and: root.canWrite() return false. Why?? In Android 1.5, root.canWrite return true. So I have create a new iso with the mksdcard tool from sdk 1.6r1 tools folder, but nothing changed. Thanks for help, Stefan PS: I have of course changed the emulator line to: -sdcard /Users/Stefan/android-sdk-mac_x86-1.6_r1/tools/newone.iso --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: problems with the usage of sdcard iso in android sdk 1.6
Thanks for the fast answer. How can I request the permission? With a uses-permission ... tag?? I dont find something like/for that?? Thanks, Stefan On Sep 16, 8:38 pm, Dianne Hackborn hack...@android.com wrote: You now need to request the permission to write the SD card. On Wed, Sep 16, 2009 at 11:33 AM, Stefan ebay-dah...@web.de wrote: Hello @all, have someone tested an app with android sdk 1.6 r1 and the usage of an sdcard iso?? In my app i use: private File root = Environment.getExternalStorageDirectory(); and: root.canWrite() return false. Why?? In Android 1.5, root.canWrite return true. So I have create a new iso with the mksdcard tool from sdk 1.6r1 tools folder, but nothing changed. Thanks for help, Stefan PS: I have of course changed the emulator line to: -sdcard /Users/Stefan/android-sdk-mac_x86-1.6_r1/tools/newone.iso -- Dianne Hackborn Android framework engineer hack...@android.com Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: problems with the usage of sdcard iso in android sdk 1.6
Thanks a lot. Now all works fine :) Jack Ha wrote: uses-permission android:name=android.permission.WRITE_EXTERNAL_STORAGE/ -- Jack Ha Open Source Development Center ・T・ ・ ・Mobile・ stick together The coverage you need at the price you want The views, opinions and statements in this email are those of the author solely in their individual capacity, and do not necessarily represent those of T-Mobile USA, Inc. On Sep 16, 12:05 pm, Stefan ebay-dah...@web.de wrote: Thanks for the fast answer. How can I request the permission? With a uses-permission ... tag?? I dont find something like/for that?? Thanks, Stefan On Sep 16, 8:38 pm, Dianne Hackborn hack...@android.com wrote: You now need to request the permission to write the SD card. On Wed, Sep 16, 2009 at 11:33 AM, Stefan ebay-dah...@web.de wrote: Hello @all, have someone tested an app with android sdk 1.6 r1 and the usage of an sdcard iso?? In my app i use: private File root = Environment.getExternalStorageDirectory(); and: root.canWrite() return false. Why?? In Android 1.5, root.canWrite return true. So I have create a new iso with the mksdcard tool from sdk 1.6r1 tools folder, but nothing changed. Thanks for help, Stefan PS: I have of course changed the emulator line to: -sdcard /Users/Stefan/android-sdk-mac_x86-1.6_r1/tools/newone.iso -- Dianne Hackborn Android framework engineer hack...@android.com Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] taking picture / use camera in android sdk 1.6
Hello, i tried an old(er) example / tutorial to capture a picture from the camera. But android.hardware.CameraDevice; cannot be resolved. Has the name changed or have somebody a good tutorial for android 1.6 and the camera?? Thanks, Stefan PS: If I press a button, I want to open the Camera and make a picture. After that i want to save the picture on a sdcard and go back to my activity. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: taking picture / use camera in android sdk 1.6
thanks a lot, the example work fine!! Greets, Stefan On Sep 19, 11:31 am, Mark Murphy mmur...@commonsware.com wrote: Stefan wrote: Hello, i tried an old(er) example / tutorial to capture a picture from the camera. But android.hardware.CameraDevice; cannot be resolved. Has the name changed or have somebody a good tutorial for android 1.6 and the camera?? Thanks, Stefan PS: If I press a button, I want to open the Camera and make a picture. After that i want to save the picture on a sdcard and go back to my activity. The camera is now called Camera, if you want to take still pictures. Video recording is handled through MediaRecorder. Here are a couple of sample projects that demonstrate the use of the Camera: http://github.com/commonsguy/cw-advandroid/tree/master/Camera/ There is also this sample activity from the API Demos that accompany the SDK: http://developer.android.com/guide/samples/ApiDemos/src/com/example/a... -- Mark Murphy (a Commons Guy)http://commonsware.com|http://twitter.com/commonsguy _The Busy Coder's Guide to *Advanced* Android Development_ Version 1.1 Available! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Route between two GeoPoints/ lat-lon pairs
Hello, i am using the android 1.6 sdk. i search for a function / api, where i can find a route between 2 points. The DrivingDirections library doesn't exist!? So if there is a function or an api for that, please let me know. I take a look in the google-addon for android, but i don't find something for my problem. Currently, I get location updates as often as possible (requestLocationUpdates(..,0,0,..) Is the only way to connect all this points to a route the reverse Geocodring (to get the street names) and draw a line from point A to Point B on the map (i mean to use an Overlay and draw a straight line between the points)? On straight routes that would be no problem, but in curves/turns? What I want is, that i only get the GPS-points. Then some functions should reconstruct the route with all curves/turns. Thanks, Stefan --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] how can i use my kml file in a html file
Hello, i have found a nice javascript (google-api), where i can make an overlay on a map: ... function initialize() { if (GBrowserIsCompatible()) { geoXml = new GGeoXml(http://mapgadgets.googlepages.com/cta.kml;); map = new GMap2(document.getElementById(map_canvas)); map.setCenter(new GLatLng(41.875696,-87.624207), 11); map.addControl(new GLargeMapControl()); map.addOverlay(geoXml); ... My question is, how can i use my kml file (on a sd card) istead of the link in the GGeoXML object geoXml = new GGeoXml(http://mapgadgets.googlepages.com/cta.kml;); My idea is to use: HttpGet get = new HttpGet(A_HTML_FILE_WITH_HTMLGOOGLEAPI.html); client.execute(get); In this html file i load the javascript. Must i append ? param=THE_KML_FILE_IN_A_BUFFERED_READER_OBJECT_OR_SOMETHING_LIKE_THAT to get the data available? Thanks, Stefan PS: I don't find a GGeoXml function in the google api for android. So i decide to use the html google api. And i can search for a direction between two point in the html google-api --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] ddms doesn't work (issue 2545)
Hello, i am developing on a Mac OS X 10.4 (german version) and with android sdk 1.6 r1. The emulator only receive one lat/lon-value 0.0 if i tryy to send some a pair aof lat/lon value. I read the issue 2545 (http://code.google.com/p/android/issues/detail? id=2545) So i change the following settings in the emulator (because i read in an other thread, that only the english locale work) to: Custom locale: en - English Settings - Date and time: Automatic: off, Select time: GMT+01:00, British Summer Time, Use 24-hours: on, Select date: 2009-12-31 If i send one value (lat/lon), the emulator receive 0.0 0.0 and after that, the emulator receive no data. I test it with german locate, too. But the same error occur. What setting is wrong?? My gpx file, which i later want to use looks like: ?xml version=1.0 encoding=utf-8? gpxxmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xmlns=http://www.topografix.com/GPX/1/1; version=1.1 creator=i xsi:schemaLocation=http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd; . (some wpts) trk nameHUHU/name trkseg trkpt lat=50.8780618 lon=6.6014193 name value=CITY/ time2009-09-25T13:58:14Z/time /trkpt ... /trkseg /trk /gpx Thanks, Stefan --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: ddms doesn't work (issue 2545)
Hello, On Sep 30, 5:07 pm, piuccio piuc...@gmail.com wrote: Have you tried sending the coordinates through the terminal ? telnet localhost 5554 geo fix 50.8780618 6.6014193 Does this work ? yes that work, i know. but i want to get new gps data very fast (1 gps point per second) and my scripting skills are bad and i cannot write geo fix xxx yyy in one second. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] java.lang.OutOfMemoryError after orientation changed
Hello, i get an OutOfMemoryError in my app after changing the orientation. I have read, that if have to use Context.getApplicationContext() instead of a normal activity context?? My java file looks like: class . { private MapView mapView; onCreate() { ... mapView = findViewById(R.id.map); ... } Must i use mapView = new MapView(Context.getApplicationContext()) or something like that to avoid the OutOfMemoryError?? I will post the logcat in a reply message. Thanks, Stefan --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: java.lang.OutOfMemoryError after orientation changed
Here my logcat: E/dalvikvm-heap( 961): Out of memory on a 167772196-byte allocation. I/dalvikvm( 961): main prio=5 tid=3 RUNNABLE I/dalvikvm( 961): | group=main sCount=0 dsCount=0 s=N obj=0x4001ab08 self=0xbc60 I/dalvikvm( 961): | sysTid=961 nice=0 sched=0/0 handle=-1343996920 I/dalvikvm( 961): at com.google.googlenav.map.Map.resize ((null):~-1) I/dalvikvm( 961): at com.google.android.maps.MapView.onMeasure (MapView.java:536) I/dalvikvm( 961): at android.view.View.measure(View.java:7703) I/dalvikvm( 961): at android.widget.RelativeLayout.measureChildHorizontal (RelativeLayout.java:569) I/dalvikvm( 961): at android.widget.RelativeLayout.onMeasure (RelativeLayout.java:361) I/dalvikvm( 961): at android.view.View.measure(View.java:7703) I/dalvikvm( 961): at android.widget.RelativeLayout.measureChild (RelativeLayout.java:554) I/dalvikvm( 961): at android.widget.RelativeLayout.onMeasure (RelativeLayout.java:377) I/dalvikvm( 961): at android.view.View.measure(View.java:7703) I/dalvikvm( 961): at android.view.ViewGroup.measureChildWithMargins (ViewGroup.java:2989) I/dalvikvm( 961): at android.widget.FrameLayout.onMeasure (FrameLayout.java:245) I/dalvikvm( 961): at android.view.View.measure(View.java:7703) I/dalvikvm( 961): at android.widget.LinearLayout.measureVertical (LinearLayout.java:464) I/dalvikvm( 961): at android.widget.LinearLayout.onMeasure (LinearLayout.java:278) I/dalvikvm( 961): at android.view.View.measure(View.java:7703) I/dalvikvm( 961): at android.view.ViewGroup.measureChildWithMargins (ViewGroup.java:2989) I/dalvikvm( 961): at android.widget.FrameLayout.onMeasure (FrameLayout.java:245) I/dalvikvm( 961): at android.view.View.measure(View.java:7703) I/dalvikvm( 961): at android.view.ViewRoot.performTraversals (ViewRoot.java:747) I/dalvikvm( 961): at android.view.ViewRoot.handleMessage (ViewRoot.java:1613) I/dalvikvm( 961): at android.os.Handler.dispatchMessage (Handler.java:99) I/dalvikvm( 961): at android.os.Looper.loop(Looper.java:123) I/dalvikvm( 961): at android.app.ActivityThread.main (ActivityThread.java:4203) I/dalvikvm( 961): at java.lang.reflect.Method.invokeNative(Native Method) I/dalvikvm( 961): at java.lang.reflect.Method.invoke(Method.java: 521) I/dalvikvm( 961): at com.android.internal.os.ZygoteInit $MethodAndArgsCaller.run(ZygoteInit.java:791) I/dalvikvm( 961): at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:549) I/dalvikvm( 961): at dalvik.system.NativeStart.main(Native Method) I/dalvikvm( 961): D/AndroidRuntime( 961): Shutting down VM W/dalvikvm( 961): threadid=3: thread exiting with uncaught exception (group=0x4001aa28) E/AndroidRuntime( 961): Uncaught handler: thread main exiting due to uncaught exception E/AndroidRuntime( 961): java.lang.OutOfMemoryError E/AndroidRuntime( 961):at com.google.googlenav.map.Map.resize (Unknown Source) E/AndroidRuntime( 961):at com.google.android.maps.MapView.onMeasure(MapView.java:536) E/AndroidRuntime( 961):at android.view.View.measure(View.java: 7703) E/AndroidRuntime( 961):at android.widget.RelativeLayout.measureChildHorizontal (RelativeLayout.java:569) E/AndroidRuntime( 961):at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:361) E/AndroidRuntime( 961):at android.view.View.measure(View.java: 7703) E/AndroidRuntime( 961):at android.widget.RelativeLayout.measureChild(RelativeLayout.java:554) E/AndroidRuntime( 961):at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:377) E/AndroidRuntime( 961):at android.view.View.measure(View.java: 7703) E/AndroidRuntime( 961):at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:2989) E/AndroidRuntime( 961):at android.widget.FrameLayout.onMeasure (FrameLayout.java:245) E/AndroidRuntime( 961):at android.view.View.measure(View.java: 7703) E/AndroidRuntime( 961):at android.widget.LinearLayout.measureVertical(LinearLayout.java:464) E/AndroidRuntime( 961):at android.widget.LinearLayout.onMeasure(LinearLayout.java:278) E/AndroidRuntime( 961):at android.view.View.measure(View.java: 7703) E/AndroidRuntime( 961):at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:2989) E/AndroidRuntime( 961):at android.widget.FrameLayout.onMeasure (FrameLayout.java:245) E/AndroidRuntime( 961):at android.view.View.measure(View.java: 7703) E/AndroidRuntime( 961):at android.view.ViewRoot.performTraversals(ViewRoot.java:747) E/AndroidRuntime( 961):at android.view.ViewRoot.handleMessage (ViewRoot.java:1613) E/AndroidRuntime( 961):at android.os.Handler.dispatchMessage (Handler.java:99) E/AndroidRuntime( 961):at android.os.Looper.loop(Looper.java: 123) E/AndroidRuntime( 961):at android.app.ActivityThread.main (ActivityThread.java:4203) E/AndroidRuntime( 961):at
[android-developers] Re: java.lang.OutOfMemoryError after orientation changed
or something like that. In my app, i have a locationListener, which collect gps points... And in my app i can start an intent, where i can take pictures. So I don't know, why i allocate 160 MB?! Thanks, Stefan --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: java.lang.OutOfMemoryError after orientation changed
hi, i have test it without the mapView and my app work fine after i rotate the emulator. so the problem is the mapView. Can the display size a problem?? Because the button, which is over the MapView (if it will be activated), is positionated at the button of the display. But than i think, the MapView will be rendered, but is not visible for the user, because the display size in landscape is to small??? Is the only way to write a new layout xml file for landscape mode? Thanks, Stefan --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] saveInstanceState problem
Hello, i want to save important data. If the user rotate the device, the activity will be recreated (or i have to use the onConfigurationChanged-method). I want to save an instance of a class and some Location variables. I can save all integer values of one Location variable, but this is a dirty way and i have still the problem with my instance variable. So i hoped, that the following code would work, but this is not the case (save the string representation and get the values back with a cast of the string representation): public void onSaveInstanceState(Bundle savedInstanceState) { super.onSaveInstanceState(savedInstanceState); savedInstanceState.putString(sh, sh.toString()); savedInstanceState.putString(last, last.toString()); .. } public void getSaveInstanceState(Bundle savedInstanceState) { if (savedInstanceState!=null) { sh = (SaveHelper)savedInstanceState.get(sh); last = (Location)savedInstanceState.get(last); ... } } Or must I use the onRetainNonConfigurationInstance()-function?? But there i only get one return value?!? And if I use the onConfigurationChanged-function and android:configChanges=keyboardHidden|orientation in my AndroidManifest.xml, the app will recreate after other configuration changes, too So what is the best way for me?? Thanks, Stefan --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: saveInstanceState problem
Hi Mike, thanks for your answer. No, I don't implement the Serializible Interface. The class gets the lon/lat pairs and if i call saveFile()-method, I save my way- and trackpoints on the sdcard (my source code blow up so i decide to implement this in an own class). Now my question is: if I have stored many way- and trackpoints and if the config change i call getTrackpoints() for example - how efficient is that and how fast is that?? I use a StringBuilder with: trkpt lat=\+lat+\ lon=\+lon+\\n +/trkpt. So if i get a new location each second and if my track is 20km long, i think, that this is a cost-afflicted function (i don't drive, i walk or i drive with a bike)? I never implement the Serializible interface. Is this the best way?? Whats up with the efficency in this case (battery, responsivness and so on) My Location variables only holds lat and lon value. This is not the problem. Thanks, Stefan --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: saveInstanceState problem
hi @all, one more question: If I want to handle the configChanges in my own way, which things must I consider?? In the AndroidManifest.xml, I can set: - mcc, mnc, locale, touchscreen, keyboard, keyboardHidden, navigation, orientation, screenLayout, fontScale Are there more possible configChanges or only this ten??? What happened, if someone call me. I think there will be no recreation of the activity after finish the call? And if I use the onConfigurationChanged-function - must I really setup the view a second time like in onCreate()?? And I mustn't save the states of the variables and so on?? Thanks, Stefan --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] GPS-Tracking application and telephone call
Hi, i have a question for my app. I track gps points and i want to know what happened, if someone call me. I test it a little bit with the emulator. I change the location via telnet and after I hang up, i get a toast message, that the location has changed. But i only get the latest gps point, is that right? So must I implement a service to save all gps points, while i am calling?? Thanks, Stefan --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] onConfigurationChanged-function
hi, i have a question: If I want to handle the configuration changes in my own way, which things must I consider?? In the AndroidManifest.xml, I can set: - mcc, mnc, locale, touchscreen, keyboard, keyboardHidden, navigation, orientation, screenLayout, fontScale Are there more possible configChanges or only this ten??? What happened, if someone call me. I think there will be no recreation of the activity after finish the call? And if I use the onConfigurationChanged-function - must I really setup the view a second time like in onCreate()?? And must I save the states of the variables and so on?? I don't think so!? Thanks, Stefan --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: onConfigurationChanged-function
hi, thanks for your answers. thats really helps me for understanding. @Dianne Atm, i only need orientation and keyboardHidden for rotation. But If something other happened (like connecting an external keyboard), all states are lost. So i don't want to use onConfigurationChanged, because thats really hard, i know. But i have an instance of a class. How can i save this state?? I want save many data: public void onSaveInstanceState(Bundle savedInstanceState) { super.onSaveInstanceState(savedInstanceState); //easy savedInstanceState.putDouble(total_dist, total_dist);//easy savedInstanceState.putString(filename, filename);//easy savedInstanceState.putInt(pict_nr, pict_nr);//easy savedInstanceState.putBoolean(has_saved, has_saved);//easy savedInstanceState.putBoolean(first, first);//easy savedInstanceState.put?? (sh, sh); // thats my class instance (sh = new SaveHelper(), i save my track- and waypoints and if i call saveFile, the way- and trackpoints are saved as a gpx file on sd card). I implement an own class for that, because my source code blow up...) So how can i save all(!!!) important variables?? With the onRetainNonConfigurationInstance(), i can only save one complex data??? And in a bundle, i can't save a Location variable and my class instance?! Thanks, Stefan --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: onConfigurationChanged-function
hi, i don't find a good tutorial for that. I don't get behind the idea of this. But i want to understand it because in my opinion, this is the cleanest way?? A dirty but perhaps an easier idea is to implement a String getTrackPoint() function and save this in a Bundle. But i think, this isnt the best way for responsiveness (because the String could contain f.e. 1000 trkpt lat=xx lon=yy/ lines). In my class, the both important variables are: private StringBuilder wpt, trkpt. If the location changed in my main app, they get the new lat/lon values. And later, if I finish tracking, i call sh.saveFile() and i generate a gpx file with: gpx.append(wpt); gpx.append(trkpt); out.write(gpx.toString()); //BufferedWriter Must I only add implements Parcelable in my class definition and add something like that: public void writeToParcel(Parcel out, int flags) { out. } public static final Parcelable.Creator CREATOR = new Parcelable.Creator { public createFromParcel(Parcel in) { } @Override public ??? newArray(int size) { return new [size]; } }; must i add a StringBuffer Array for my class (perhaps write StringBuffer [] instead of ) And in the onSaveInstanceState - function, i only have to add saveInstanceState.putParcelable(sh, sh); ??? If my question is to complex to understand, you must not answer me. Thanks, Stefan --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: onConfigurationChanged-function
i think i have found a good example. But I must not create a service, or? I must only call: saveInstanceState.putParcelable(sh, sh); in my onSaveInstanceState - function??? And how can i use my sh object, after the activity was recreated?? Does this work: sh = (SaveHelper)savedInstanceState.getParcelable(sh); ??? Thanks, Stefan --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: onConfigurationChanged-function
Yeah, I get it work. I only add this to my class: private SaveHelper(Parcel in) { } @Override public void writeToParcel(Parcel dest, int flags) { // TODO Auto-generated method stub } public static final Parcelable.CreatorSaveHelper CREATOR = new Parcelable.CreatorSaveHelper() { public SaveHelper createFromParcel(Parcel in) { return new SaveHelper(in); } public SaveHelper[] newArray(int size) { return new SaveHelper[size]; } }; @Override public int describeContents() { // TODO Auto-generated method stub return 0; } And in my main-app: public void onSaveInstanceState(Bundle savedInstanceState) { super.onSaveInstanceState(savedInstanceState); savedInstanceState.putParcelable(sh, sh); } public void getSaveInstanceState(Bundle savedInstanceState) { if (savedInstanceState!=null) { . sh = (SaveHelper)savedInstanceState.getParcelable(sh); } } But i don't really understand, why... I test it with the emulator. I send some geo data via telnet, than i rotate the emulator and than i send some more geo data and in my gpx-file, ALL gps data are stored :) Tomorrow, i will test it on a real device with more than 4 gps data ;) I hope my app will be responsive enough ;) Thanks, Stefan --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: saveInstanceState problem
Hi, thanks for your answers! The rotation of the device is the only config. change, what I think will happen by using my app. But because this is not guaranteed, i found a way, how i can save my instance of my SaveHelper class (sh). I implements the Parcelable, and so i can save this in a Bundle. And for my location variables i decide to use putDoubles (putDouble(last_lat, last.getLatitude); and so on). With the onSaveInstanceState(Bundle savedInstanceState) function and getSaveInstanceState(Bundle savedInstanceState) (where i get all values back) - function i have covered all the configuration change cases, haven't I? One open question is what happened, if someone calls me on my phone. Does my app stop to get gps points (in my app i implement a locationListener)?? I do think so, because the app will be in the background and the phone app will be on the foreground?? Thanks, Stefan --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] this.getApplication() returns NULL pointer
I'm running the following line in an Activity, which is within the same application, but in a different package: AppObject appObj = (AppObject)this.getApplication(); // FYI: AppObject is my extension class of Application. It returns only a null pointer, while when I move it to the main package and run it from there it returns the application reference as expected. I've defined the activity in my AndroidManifest.xml with the full qualified class name, since it is in another package: activity android:name=com.foo.bar.TestActivity/activity Any ideas of what I've to do different? Thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] can I get XML information step by step using SaxParser??
Hello, i have a big xml file and i want to use the SaxParser because i've read, that this is faster than DOM and XmlPullParser. But now I want to get some information, before the parser has read the whole xml-file. ?xml version=1.0 encoding=utf-8? gpx... wpt lat=50.886021852493286 lon=6.5963780879974365 desc value=Friedensstraße 1/ /wpt OTHER WAYPOINTS ... ... trk nameHUHU/name trkseg trkpt lat=50.88498115539551 lon=6.59727931022644/trkpt VERY MUCH TRACKPOINTS!!! /trkseg /trk gpx If all waypoints has been read, i want to work with that data. And can I told the SaxParser, that i want to read the trackpoints step by step (for example the first 20 trackpoints will be returned and then the next 20 points and so on)? Thanks, Stefan PS: I want/have an own class for the Handler --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: can I get XML information step by step using SaxParser??
Hi, You can use these events to do whatever you need at any point in the document. So once we reach the start of trk we know all waypoints have been read right? Yes You should call the parser in a background thread so your UI thread can respond to a call from the parser when it reaches the marked element. Actually, in my main.java i have: getWpt = new Thread (new Runnable () { @Override public void run() { try { FileInputStream is = new FileInputStream(/sdcard/+fileList[pos]); SAXParserFactory factory = SAXParserFactory.newInstance(); SAXParser saxparser = factory.newSAXParser(); XMLReader reader = saxparser.getXMLReader(); xmlHandler = new XMLHandler (); reader.setContentHandler(xmlHandler); reader.parse( new InputSource (is) ); } .. than i have an own java file for my XMLHandler class. So how could i use a method like your callNotifyMethodInMainClass(wayPointArray). ?? Must I create a Handler object in my main.java and send the handler object to my handler class (instead of xmlHandler = new XMLHandler (); xmlHandler = new XMLHandler (myHandler); ?? If so, how can i send the wayPointArray back?? I only use myHandler.sendEmptyMessage(0) or something like that - so how can i pass the waypointArray object back?? Thanks for your answer, Stefan --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: this.getApplication() returns NULL pointer
Nope. Right now, for testing purposes, it is triggered through a button click. I've also included android:name=AppObject within the application- tag of the Manifest. And the initialization of the AppObject seems to work properly. The only thing that doesn't work is calling AppObject appObj = (AppObject)this.getApplication(); from an Activity that is not in the same package as the AppObject (which is in the main package). As soon as I move this Activity into the main package it works properly and (AppObject)this.getApplication(); returns the Application Object. On Oct 9, 8:26 pm, Dianne Hackborn hack...@android.com wrote: Are you calling it in the constructor? The activity is not yet fully initialized at that point. On Fri, Oct 9, 2009 at 2:28 AM, Stefan stefan.klu...@gmail.com wrote: I'm running the following line in an Activity, which is within the same application, but in a different package: AppObject appObj = (AppObject)this.getApplication(); // FYI: AppObject is my extension class of Application. It returns only a null pointer, while when I move it to the main package and run it from there it returns the application reference as expected. I've defined the activity in my AndroidManifest.xml with the full qualified class name, since it is in another package: activity android:name=com.foo.bar.TestActivity/activity Any ideas of what I've to do different? Thanks -- Dianne Hackborn Android framework engineer hack...@android.com Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] xmlpullparser does not work
) { } } }); getWpt.start(); But it never find my tags (the handler getWaypointHandler is never called). The XmlPullParser find the xml file, because my logcat shows: I/ActivityManager( 579): Starting activity: Intent { cmp=de.stefandahmen.android/.NavTrack (has extras) } E/ActivityThread( 692): Failed to find provider info for com.google.settings E/ActivityThread( 692): Failed to find provider info for com.google.settings E/ActivityThread( 692): Failed to find provider info for com.google.settings //GOES IN TRY BLOCK: E/IMINININ( 692): MEMEME //NOT THE END_TAG: E/EVENTTYPE( 692): 01 I/ActivityManager( 579): Start proc android.tts for service android.tts/.TtsService: pid=765 uid=10023 gids={3003, 1015} I/jdwp( 765): received file descriptor 10 from ADB D/dalvikvm( 553): GC freed 282 objects / 10712 bytes in 419ms I/MapActivity( 692): Handling network change notification:CONNECTED E/MapActivity( 692): Couldn't get connection factory client I/ARMAssembler( 579): generated scanline__0077:03515104__ [ 27 ipp] (41 ins) at [0x29dca8:0x29dd4c] in 922000 ns D/dalvikvm( 553): GC freed 50 objects / 2184 bytes in 960ms I/ARMAssembler( 579): generated scanline__0077:03515104_0001_ [ 46 ipp] (65 ins) at [0x29dd50:0x29de54] in 1508000 ns I/ActivityManager( 579): Displayed activity de.stefandahmen.android/.NavTrack: 2574 ms (total 2574 ms) I/TtsService( 765): TtsService.onCreate() D/dalvikvm( 553): GC freed 2 objects / 48 bytes in 482ms D/dalvikvm( 765): Trying to load lib /system/lib/libttssynthproxy.so 0x437600b0 D/dalvikvm( 765): Added shared lib /system/lib/libttssynthproxy.so 0x437600b0 E/TTS is loading( 765): /system/lib/libttspico.so V/SynthProxy( 765): AudioTrack started V/TtsService( 765): TtsService.setLanguage(eng, , ) I/SVOX Pico Engine( 765): TtsEngine::setLanguage found matching language(eng) but not matching country(). I/SVOX Pico Engine( 765): loaded en-US successfully I/SynthProxy( 765): setting speech rate to 100 I/TTS received: ( 692): Umlaute wie u.a. ä, ö und ü o.ä. sind einigermaßen einfach. Doch z.B. andere Abk.en sind schwieriger? Nein!!! Aber 1. dies und 2. das geht auch V/TtsService( 765): TTS service received Umlaute wie u.a. ä, ö und ü o.ä. sind einigermaßen einfach. Doch z.B. andere Abk.en sind schwieriger? Nein!!! Aber 1. dies und 2. das geht auch I/TtsService( 765): Stopping I/TtsService( 765): Stopped I/TtsService( 765): TTS processing: Umlaute wie u.a. ä, ö und ü o.ä. sind einigermaßen einfach. Doch z.B. andere Abk.en sind schwieriger? Nein!!! Aber 1. dies und 2. das geht auch V/TtsService( 765): TtsService.setLanguage(deu, , ) I/SVOX Pico Engine( 765): TtsEngine::setLanguage found matching language(deu) but not matching country(). I/SVOX Pico Engine( 765): loaded de-DE successfully I/SynthProxy( 765): setting speech rate to 100 W/AudioTrack( 765): obtainBuffer timed out (is the CPU pegged?) 0x1a89a8 user=1000, server= W/AudioFlinger( 554): write blocked for 49 msecs W/AudioFlinger( 554): write blocked for 50 msecs W/AudioFlinger( 554): write blocked for 49 msecs W/AudioFlinger( 554): write blocked for 46 msecs W/AudioFlinger( 554): write blocked for 52 msecs W/AudioFlinger( 554): write blocked for 50 msecs W/AudioFlinger( 554): write blocked for 55 msecs W/AudioFlinger( 554): write blocked for 63 msecs W/AudioFlinger( 554): write blocked for 48 msecs W/AudioFlinger( 554): write blocked for 49 msecs W/AudioFlinger( 554): write blocked for 47 msecs W/AudioFlinger( 554): write blocked for 74 msecs W/AudioFlinger( 554): write blocked for 56 msecs W/AudioFlinger( 554): write blocked for 49 msecs W/AudioFlinger( 554): write blocked for 49 msecs W/AudioTrack( 765): obtainBuffer timed out (is the CPU pegged?) 0x1a89a8 user=00017800, server=00016800 W/AudioFlinger( 554): write blocked for 47 msecs W/AudioFlinger( 554): write blocked for 48 msecs W/AudioFlinger( 554): write blocked for 48 msecs W/AudioFlinger( 554): write blocked for 50 msecs W/AudioFlinger( 554): write blocked for 52 msecs W/AudioFlinger( 554): write blocked for 52 msecs W/AudioFlinger( 554): write blocked for 50 msecs W/AudioFlinger( 554): write blocked for 55 msecs Thanks for help, Stefan --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: xmlpullparser does not work
I have forgot the gpx/xml-file: ?xml version=1.0 encoding=utf-8? gpxxmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xmlns=http://www.topografix.com/GPX/1/1; version=1.1 creator=Stefan Dahmen xsi:schemaLocation=http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd; wpt lat=50.886021852493286 lon=6.5963780879974365 desc value=h/ /wpt wpt lat=50.886054039001465 lon=6.5949565172195435 desc value=zzz8/ /wpt wpt lat=50.88499188423157 lon=6.595224738121033 desc value=y/ /wpt wpt lat=50.8851957321167 lon=6.5965336561203 desc value=/ /wpt trk nameHUHU/name trkseg trkpt lat=50.88498115539551 lon=6.59727931022644 /trkpttrkpt lat=50.88498115539551 lon=6.59727931022644 /trkpttrkpt lat=50.88498651981354 lon=6.59727931022644 /trkpttrkpt lat=50.88498651981354 lon=6.59727931022644 /trkpttrkpt lat=50.88498651981354 lon=6.597273945808411 /trkpt/trkseg /trk /gpx --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Unable to receive AVRC Bbuetooth buttons presses on HTC Hero devices
Does anyone have an idea why bluetooth AVRC buttons (play/pause FF/RW) are not recognized on HTC Hero devices. The same code works fine on G1 and MyTouch 3G phones. The code actually also correctly recognizes the WIRED headset's button press on the Hero - but the bluetooth button presses go directly to the built in Android Media Player. I am guessing that on the Hero, there may be other Intent (other than Intent.ACTION_MEDIA_BUTTON) to broadcast the bluetooth button presses? If this is the case it would explain why they go directly to the Media Player. Here is the code I am using: *For registering: IntentFilter filter = new IntentFilter(); filter.addAction(Intent.ACTION_MEDIA_BUTTON); filter.addAction(android.media.AUDIO_BECOMING_NOISY); filter.setPriority(IntentFilter.SYSTEM_HIGH_PRIORITY); registerReceiver(_Receiver, filter); * For the receiver: public void onReceive(Context context, Intent intent) { String intentAction = intent.getAction(); if (android.media.AUDIO_BECOMING_NOISY.equals(intentAction)) { //pause the playback } else if (Intent.ACTION_MEDIA_BUTTON.equals(intentAction)) { //handle buttons } } Stefan --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: xmlpullparser does not work
thanks for your answer, i test XMLPullParser and SaxParser and i saw, that xmlpullparser and SaxParser have the same performance (sax is a little bit faster, but i thought, that the xmlpullparser will be faster in future sdks. But now I have a look to your page and this looks good. So thank you and I hope, I will find a good way now with this, Stefan --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: can I get XML information step by step using SaxParser??
hi, any ideas how i can send back my collected trackpoints if I have read 50 (the SaxParser parse 50 trackpoints in one second in my app) for example? If I use this in the startElement function,: else if (localName.equals(trkpt)) { .. if(counter%50 == 0) { gpxHandler.sendEmptyMessage(1); } } the SaxParser will continue parsing and so my object, which will collect my trackpoints is greater than 50, if i call getTrackpoints out of my Handler. Or if I stop the SaxParser, can I remember the point, where I stop parsing?? I don't think so. Its important because I want to overwrite the trackpoint object, if i have send it back to my Main-class (my sax Parser is in another java file) Thanks, Stefan --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] E/AndroidRuntime( 321): java.lang.VerifyError: de.stefandahmen.android.TourList
Hi, i get following error, if i test my app on a real android phone. On the emulator, my app works fine. W/dalvikvm( 321): threadid=3: thread exiting with uncaught exception (group=0x4000fe70) E/AndroidRuntime( 321): Uncaught handler: thread main exiting due to uncaught exception E/AndroidRuntime( 321): java.lang.VerifyError: de.stefandahmen.android.TourList E/AndroidRuntime( 321):at java.lang.Class.newInstanceImpl (Native Method) E/AndroidRuntime( 321):at java.lang.Class.newInstance (Class.java:1472) E/AndroidRuntime( 321):at android.app.Instrumentation.newActivity(Instrumentation.java:1097) E/AndroidRuntime( 321):at android.app.ActivityThread.performLaunchActivity(ActivityThread.java: 2186) E/AndroidRuntime( 321):at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java: 2284) E/AndroidRuntime( 321):at android.app.ActivityThread.access $1800(ActivityThread.java:112) E/AndroidRuntime( 321):at android.app.ActivityThread $H.handleMessage(ActivityThread.java:1692) E/AndroidRuntime( 321):at android.os.Handler.dispatchMessage (Handler.java:99) E/AndroidRuntime( 321):at android.os.Looper.loop(Looper.java: 123) E/AndroidRuntime( 321):at android.app.ActivityThread.main (ActivityThread.java:3948) E/AndroidRuntime( 321):at java.lang.reflect.Method.invokeNative(Native Method) E/AndroidRuntime( 321):at java.lang.reflect.Method.invoke (Method.java:521) E/AndroidRuntime( 321):at com.android.internal.os.ZygoteInit $MethodAndArgsCaller.run(ZygoteInit.java:782) E/AndroidRuntime( 321):at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540) E/AndroidRuntime( 321):at dalvik.system.NativeStart.main (Native Method) I/Process ( 60): Sending signal. PID: 321 SIG: 3 I/dalvikvm( 321): threadid=7: reacting to signal 3 I/dalvikvm( 321): Wrote stack trace to '/data/anr/traces.txt' W/ActivityManager( 60): Launch timeout has expired, giving up wake lock! W/ActivityManager( 60): Activity idle timeout for HistoryRecord {43359428 {de.stefandahmen.android/de.stefandahmen.android.TourList}} Thanks for help, Stefan --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: E/AndroidRuntime( 321): java.lang.VerifyError: de.stefandahmen.android.TourList
Hi, my TourList.java is very small: //imports and package public class TourList extends ListActivity { File dir = Environment.getExternalStorageDirectory(); String[] fileList = dir.list(new FilenameFilter() { public boolean accept(File d, String name) { return name.endsWith(.gpx); } }); @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.tourlist); if (fileList.length0) setListAdapter(new ArrayAdapterString (this,android.R.layout.simple_list_item_1,fileList)); else Toast.makeText(getBaseContext(), Keine Tour vorhanden!, Toast.LENGTH_SHORT).show(); } public void onListItemClick (ListView lv, View v, int pos, long id) { Intent intent = new Intent(TourList.this, NavTrack.class); intent.putExtra(pos, pos); intent.putExtra(fileList, fileList); startActivity(intent); } } Where can there be an error? Or is it a problem, that i work with sdk 1.6 and the handy has sdk 1.5 installed?? But another app works fine on sdk 1.5 handy and 1.6 emulator?? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: E/AndroidRuntime( 321): java.lang.VerifyError: de.stefandahmen.android.TourList
i have found the error... The NavTrack class includes the new TTS engine, which isnt included in the sdk 1.5 So the NavTrack class could not be compiled and in the onListItemClick function, the Intent couldnt find NavTrack.class Regards, Stefan --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] ProximityAlert problem
hello, i am developing a navigation software. I read some gps points out of a gpx file. Now i want to know, if i am near a gps point (for example 50m). So i use the addProximityAlert function. My problem is the order. I start with the first gps point, so i only want to know, if i am near the first point. after i am near this point i want to check, if i am near this point and so on. And after i was near the first point, i want to delete this from the proximityAlert function. My code: after i have read the gps points, i start the setProximityAlert function the first time: private void setProximityAlert() { if(arrayindex!=lat_w.length) { lati = lat_w[arrayindex]; lng = lon_w[arrayindex]; intent.putExtra(pos, arrayindex); proximityIntent = PendingIntent.getBroadcast (getApplicationContext(), arrayindex, intent, 0); lm.addProximityAlert(lati, lng, radius, expiration, proximityIntent); IntentFilter filter = new IntentFilter (TREASURE_PROXIMITY_ALERT); registerReceiver(new ProximityIntentReceiver(), filter); } else Toast.makeText(getBaseContext(), End of Tour :), Toast.LENGTH_SHORT).show(); } /** Proximity Alert Broadcast Receiver */ public class ProximityIntentReceiver extends BroadcastReceiver { @Override public void onReceive (Context context, Intent intent) { String key = LocationManager.KEY_PROXIMITY_ENTERING; entering = intent.getBooleanExtra(key, false); int pos = intent.getIntExtra(pos, 0); Toast.makeText(NavTrack.this, Treasure: + entering + Position + String.valueOf(pos), Toast.LENGTH_LONG).show(); //only the next gps point!!! if (entering old_pos+1 == pos) { old_pos=pos; arrayindex++; //for the setProximityAlert function Toast.makeText(getBaseContext(), Arrayindex: +String.valueOf(arrayindex), Toast.LENGTH_LONG).show(); lm.removeProximityAlert(proximityIntent); //hmmm, it seems, this doesnt work (because the toast // above shows several time position 0 or 1 or 2 and so on) // Because of that the workaround with if(... old_pos+1..) setProximityAlert (); //set the next gps point from file to addProximityAlert } } I think this is a very dirty code. The best way would be, if i could use a for-loop where i set all proximityAlerts and than check if i am near the first point, after that the second point and so on... So is this possible and does the removeProximityAlert do the right job (delete the proximity alerts for the checked gps point)??? Thanks, Stefan --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] battery life with proximity Alert
hello, i have read, that the usage of the proximity alert function isnt the best for the battery. What other solutions are a good way?? Shall I use xxx.distanceTo(loc) function? I have many POI, which I want to visit step by step. If i am near the first point, the TTS engine say something and i walk to the next POI. Thanks, Stefan --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] BaseAdapter getView() gets called 3x per item
I'm using my own extension of BaseAdapter to display a complex data model within a ListView. The code is located here: http://java.pastebin.com/f2e4c1e0b - it's very similar to the List14.java Android API demo sample (http:// developer.android.com/guide/samples/ApiDemos/src/com/example/android/ apis/view/List14.html) I put some extra Log.i() calls into my code to figure out some speed issues. That's where I discovered that getView() gets called sometimes 2x sometimes 3x per item. The logcat output is here: http://pastebin.com/f385a6ddd That is not really the speed issue I was investigating, however, I'm wondering why getView() is not only called once per item? Thanks -Stefan --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] ExpandableListActivity issue
Hello all, I am new to android and java programming. I am trying to display a list with People and their contact numbers as following: Name TYPE Number I am using ExpandableListActivity to accomplish that. Everything is working good when i am using the integer value if People.TYPE..but if i am trying to convert that to a string representation i get an unhandled exception. Can someone tell me what i am doing wrong? My Code: package org.ListExpandable; import android.app.ExpandableListActivity; import android.content.ContentUris; import android.content.Context; import android.database.Cursor; import android.net.Uri; import android.os.Bundle; import android.provider.Contacts.People; import android.widget.ExpandableListAdapter; import android.widget.SimpleCursorTreeAdapter; public class ListExpandable extends ExpandableListActivity { private int mGroupIdColumnIndex; private String mPhoneNumberProjection[] = new String[] { People.Phones._ID, People.Phones.NUMBER }; private ExpandableListAdapter mAdapter; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Query for people Cursor groupCursor = managedQuery(People.CONTENT_URI, new String[] {People._ID, People.NAME}, null, null, null); // Cache the ID column index mGroupIdColumnIndex = groupCursor.getColumnIndexOrThrow (People._ID); // Set up our adapter mAdapter = new MyExpandableListAdapter(groupCursor, this, android.R.layout.simple_expandable_list_item_1, android.R.layout.simple_expandable_list_item_2, new String[] {People.NAME}, // Name for group layouts new int[] {android.R.id.text1}, new String[] { NumberTypeToString(People.TYPE) , People.NUMBER}, // Number for child layouts new int[] {android.R.id.text1,android.R.id.text2}); setListAdapter(mAdapter); } private String NumberTypeToString(String underlying_type){ String retValue=Other; int converted_type=Integer.parseInt(underlying_type); switch (converted_type) { case People.TYPE_HOME: retValue=Home; break; case People.TYPE_MOBILE: retValue=Mobile; break; case People.TYPE_WORK: retValue=Work; break; case People.TYPE_OTHER: retValue=Other; break; } return retValue; } public class MyExpandableListAdapter extends SimpleCursorTreeAdapter { public MyExpandableListAdapter(Cursor cursor, Context context, int groupLayout, int childLayout, String[] groupFrom, int[] groupTo, String[] childrenFrom, int[] childrenTo) { super(context, cursor, groupLayout, groupFrom, groupTo, childLayout, childrenFrom, childrenTo); } @Override protected Cursor getChildrenCursor(Cursor groupCursor) { // Given the group, we return a cursor for all the children within that group // Return a cursor that points to this contact's phone numbers Uri.Builder builder = People.CONTENT_URI.buildUpon(); ContentUris.appendId(builder, groupCursor.getLong (mGroupIdColumnIndex)); builder.appendEncodedPath (People.Phones.CONTENT_DIRECTORY); Uri phoneNumbersUri = builder.build(); // The returned Cursor MUST be managed by us, so we use Activity's helper // functionality to manage it for us. //return managedQuery(phoneNumbersUri, mPhoneNumberProjection, null, null, null); return managedQuery(phoneNumbersUri, null, null, null, null); } } } -- Thank you for your help Stefan --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] differential GPS in android
Hi, is there a possibility to use the differential GPS (dgps) in android?? The accuracy of dgps is (how i read it) 2m, while the accuracy of normal gps is ~15 to 25m. Or can i manually calculate the dgps. i doesnt find a equation or something like that. Why i ask that: i track some gps points and save them into a gpx file. i let the gpx file draw on http://www.gpsvisualizer.com and i saw, that the accuracy is really only 15-25m. Btw, how can i interpolate the gps points in a map view. The track looks wavy, but i want a nearly straight line. Thanks, Stefan --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] how to call an Activity method from another java file
Hello, i have following problem: I have my MainActivity. In this Activity, i start a thread (SaxParser in another normal java file). Now I want to call a method from the MainActivity out of the normal java file? I have read something of an Application object, but i only find things, where i have to create a new Intent (...). Is it possible to use the application object in the other normal java file like that: Second/normal/SaxParser-file: public class XMLHandler extends DefaultHandler implements Parcelable { ConstructorOfSecondJavaFile( ApplicationObject o) { this.applicationObject = o; ... } ... o.callMethodOfMainActivity (int aValue); } MainActivity: private int val; public class MainAcitivity extends ...Acticity { public onCreate (..) { ... } public callMethodOfManinActivity (int val) { this.val = val; } } Thanks, Stefan --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: how to call an Activity method from another java file
Hi, thanks for your answer. i try option 1 today, but i couldnt call the funtion in my MainActivity class: My steps: in MainActivity: xmlHandler = new XMLHandler ( MainActivity.this ); // -- is that the Activity, i think so ?? in XMLHandler (normal java file): Activity main; public XMLHandler (Activity act) { this.main = act; } I now want to call the specific function, but i can't say: act.callMethodOfMainActivity (aValue); I also try to pass the Context, but first i dont think, that this is the activity and secondly, the same error occur. Thanks, Stefan PS: Is it also possilbe to use the Singleton Pattern? But the easier way and also my favorite is option 1. On Oct 30, 1:13 pm, Mark Murphy mmur...@commonsware.com wrote: Stefan wrote: i have following problem: I have my MainActivity. In this Activity, i start a thread (SaxParser in another normal java file). Now I want to call a method from the MainActivity out of the normal java file? Option #1: Pass the Activity in the constructor of your object from your normal java file Option #2: Have the Activity call a setter on your object from your normal java file (e.g., setActivity(this);) -- Mark Murphy (a Commons Guy)http://commonsware.com|http://twitter.com/commonsguy Android Development Wiki:http://wiki.andmob.org --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: how to call an Activity method from another java file
Thanks a lot. That was the error :) Now it works. Regards, Stefan On Oct 30, 1:48 pm, Mark Murphy mmur...@commonsware.com wrote: Stefan wrote: thanks for your answer. i try option 1 today, but i couldnt call the funtion in my MainActivity class: My steps: in MainActivity: xmlHandler = new XMLHandler ( MainActivity.this ); // -- is that the Activity, i think so ?? in XMLHandler (normal java file): Activity main; public XMLHandler (Activity act) { this.main = act; } I now want to call the specific function, but i can't say: act.callMethodOfMainActivity (aValue); Of course. Your XMLHandler is holding an Activity, not a MainActivity. -- Mark Murphy (a Commons Guy)http://commonsware.com|http://twitter.com/commonsguy Android Development Wiki:http://wiki.andmob.org --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: how to update a ListView in a Tab
Hi thanks for your fast answer. Unfortunately I was on the road, so i reply so late. Your suggestion seems to be right (my ListView show the new data). But i doesn't see an empty list before. It seems, that the activity wait, until my thread is ready I dont know why: public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.xxx); progress = ProgressDialog.show(this, yyy, , true,false); fileList = getIntent().getStringArrayExtra(fileList); pos = getIntent().getIntExtra(pos, -1); arrayindex=0; trackpoint = Trackpoint.getInstance(); waypoint = Waypoint.getInstance(); test = new ArrayList String(); setupTab(); //test is empty!!! } public void setupTab () { tabs = (TabHost)findViewById(R.id.aaa); tabs.setup(); TabHost.TabSpec ts=tabs.newTabSpec(list); lv=(ListView)findViewById(R.id.list); ts.setContent(new TabHost.TabContentFactory(){ public View createTabContent(String tag) { my_adapter = new MyAdapter(xxx.this); lv.setAdapter(my_adapter); return lv; } }); ts.setIndicator(Listenansicht); tabs.addTab(ts); ts = tabs.newTabSpec(ll); ts.setContent(R.id.ll); ts.setIndicator(Kartenansicht); tabs.addTab(ts); tabs.setCurrentTab(0); } I implement an observer pattern and if i get all waypoints, i add them to the arrayList: test.addAll(wp.getDescription()); But i only see the ListView with the updated data (and no empty list). Why dont i see the empty list before?? (my example only reads 5 waypoints out of a xml file, but the loading time of the activity seems to be long; before i see my tabs) Thanks, Stefan On Nov 5, 1:35 pm, Mark Murphy mmur...@commonsware.com wrote: Stefan wrote: Hi Mark, hi @all, i saw Mark M. example (http://www.androidguys.com/2008/07/28/fancy- listviews-part-five/ ) and test it. This is really good. But i have one problem: After i start the app, i want to see my GUI (one Tab content is a ListView, the second and last Tab is a MapView). In a background thread, i want (and i can) load the data for the listView. So i first create the Tab with the ListView without any content (my string array is empty: String [] array = {}; ). Don't do that if you want to modify the contents of the ArrayAdapter. Use an empty ArrayListString instead. Now if the background thread is ready and the array-String has get the data, i want to update the ListView in my tab. I try: my_adapter.notifyDataSetChanged(); but without success. What must i do, that the ListView gets updated. Add the values to the ArrayAdapter via add(). The ListView will update automatically. -- Mark Murphy (a Commons Guy)http://commonsware.com|http://twitter.com/commonsguy Android Consulting/App Development:http://commonsware.com/consulting -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Need an invitation to google Wave?
Hi, it will be great, if someone can send me an invitation, too. Thanks, Stefan -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] How to read resource based on the current theme
In my case I need to be able apply a color conditionally (for example based if an item is read or unread) so I need to be able to read the read and unread colors from the current theme and apply them appropriately. I gave the color special attribute name in my \attr xml file and assigned it different values in 2 different themes. if I do getResources().getColorStateList( my attribute resource ID) it fails because it can't find the resource. It seems like something needs to first resolve the attribute Id to the Id of the resource in the current theme, but I am not sure what does that. Stefan -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: How to read resource based on the current theme
That was exactly what I needed. Thank you very much for your help. In case somebody has a similar need this is the code that worked for me: R.attr.PrimaryColor, R.attr.PrimaryReadColor are the styled attributes (of type Color State List in my case) that have a specific value in each theme TypedArray atts = context.obtainStyledAttributes(new int[] { R.attr.PrimaryColor, R.attr.PrimaryReadColor}); _primaryColor = atts.getColorStateList(0); _primaryReadColor = atts.getColorStateList(1); Stefan On Nov 22, 2:48 pm, Dianne Hackborn hack...@android.com wrote: Resources does not let you access themes -- it doesn't know about a Theme, since there is one Resources object for you application, but an arbitrary number of themes. Typically to load themed resources, you would do what standard views and widgets do -- declare a styleable array of all of the attributes you want to retrieve, and use Context.obtainStyledAttributes or related to retrieve theme. The LabelView API demo shows an example of this: http://developer.android.com/guide/samples/ApiDemos/src/com/example/a... On Sun, Nov 22, 2009 at 4:22 AM, Stefan skyntc...@gmail.com wrote: In my case I need to be able apply a color conditionally (for example based if an item is read or unread) so I need to be able to read the read and unread colors from the current theme and apply them appropriately. I gave the color special attribute name in my \attr xml file and assigned it different values in 2 different themes. if I do getResources().getColorStateList( my attribute resource ID) it fails because it can't find the resource. It seems like something needs to first resolve the attribute Id to the Id of the resource in the current theme, but I am not sure what does that. Stefan -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Dianne Hackborn Android framework engineer hack...@android.com Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: How to read resource based on the current theme
Yes... I was not feeling very comfortable with having to index the items in the array either. For some reason I did not make the connection that R.styleable actually is the array of integers I need. Just to make sure I did it correct this time: In attrs.xml I have: declare-styleable name=PrimaryItemColors attr name=PrimaryColor format=color / attr name=PrimaryReadColor format=color / /declare-styleable The code to read them is: TypedArray atts = context.obtainStyledAttributes (R.styleable.PrimaryItemColors); _PrimaryColor = atts.getColorStateList (R.styleable.PrimaryItemColors_PrimaryColor); _PrimaryReadColor = atts.getColorStateList (R.styleable.PrimaryItemColors_PrimaryReadColor); atts.recycle(); Thank you again for your help. Stefan On Nov 22, 8:39 pm, Dianne Hackborn hack...@android.com wrote: Note: you really really should not be creating these arrays yourself, because the attributes need to be in a specific order for them to work. Use declare-styleable in one of your resource files (usually in attrs.xml where you declare your attributes) to define the sets of resources you want to retrieve. On Sun, Nov 22, 2009 at 1:19 PM, Stefan skyntc...@gmail.com wrote: That was exactly what I needed. Thank you very much for your help. In case somebody has a similar need this is the code that worked for me: R.attr.PrimaryColor, R.attr.PrimaryReadColor are the styled attributes (of type Color State List in my case) that have a specific value in each theme TypedArray atts = context.obtainStyledAttributes(new int[] { R.attr.PrimaryColor, R.attr.PrimaryReadColor}); _primaryColor = atts.getColorStateList(0); _primaryReadColor = atts.getColorStateList(1); Stefan On Nov 22, 2:48 pm, Dianne Hackborn hack...@android.com wrote: Resources does not let you access themes -- it doesn't know about a Theme, since there is one Resources object for you application, but an arbitrary number of themes. Typically to load themed resources, you would do what standard views and widgets do -- declare a styleable array of all of the attributes you want to retrieve, and use Context.obtainStyledAttributes or related to retrieve theme. The LabelView API demo shows an example of this: http://developer.android.com/guide/samples/ApiDemos/src/com/example/a... On Sun, Nov 22, 2009 at 4:22 AM, Stefan skyntc...@gmail.com wrote: In my case I need to be able apply a color conditionally (for example based if an item is read or unread) so I need to be able to read the read and unread colors from the current theme and apply them appropriately. I gave the color special attribute name in my \attr xml file and assigned it different values in 2 different themes. if I do getResources().getColorStateList( my attribute resource ID) it fails because it can't find the resource. It seems like something needs to first resolve the attribute Id to the Id of the resource in the current theme, but I am not sure what does that. Stefan -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com android-developers%2bunsubscr...@googlegroups.comandroid-developers%252bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Dianne Hackborn Android framework engineer hack...@android.com Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Dianne Hackborn Android framework engineer hack...@android.com Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group
[android-developers] SQLlite database
I was just trying to make a SQL lite database in Android, I will show you my first try... SQLiteDatabase database = SQLiteDatabase.create(null); database.execSQL(CREATE TABLE gps(longtitude Char(50),latitude Char (50))); database.execSQL(INSERT INTO gps(54.555, 54.544)); database.execSQL(SELECT * FROM gps); String[] kolommen = {longtitude, latitude}; Cursor data = database.query(gps, kolommen, null, null, null, null, null); Log.i(result, data.getColumnNames().toString()); But it isn't working... is there anyone who can say what I'm doing wrong? -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] java.lang.IllegalArgumentException while parsing xml file
Hello, i have several gpx files on my sd card and i show them (the filename) on a listview. if i choose a gpx file, the track is load in another activity with a listview,too (adress-strings are shown). if i use the back button, the listview with the filenames is shown again and i can choose another file. but if i repeat this the third time, i get this error: E/AndroidRuntime( 5075): Uncaught handler: thread Thread-16 exiting due to uncaught exception E/AndroidRuntime( 5075): java.lang.IllegalArgumentException E/AndroidRuntime( 5075):at java.util.AbstractList.subList (AbstractList.java:757) E/AndroidRuntime( 5075):at de.stefandahmen.android.navtrack.helper.Trackpoint.getTrkptLat (Trackpoint.java:40) E/AndroidRuntime( 5075):at de.stefandahmen.android.navtrack.NavTrack.update(NavTrack.java:682) E/AndroidRuntime( 5075):at java.util.Observable.notifyObservers (Observable.java:147) E/AndroidRuntime( 5075):at java.util.Observable.notifyObservers (Observable.java:128) E/AndroidRuntime( 5075):at de.stefandahmen.android.navtrack.helper.Trackpoint.setTrkpt (Trackpoint.java:22) E/AndroidRuntime( 5075):at de.stefandahmen.android.navtrack.helper.XMLHandler.endElement (XMLHandler.java:110) E/AndroidRuntime( 5075):at org.apache.harmony.xml.ExpatParser.endElement(ExpatParser.java:159) E/AndroidRuntime( 5075):at org.apache.harmony.xml.ExpatParser.append(Native Method) E/AndroidRuntime( 5075):at org.apache.harmony.xml.ExpatParser.parseFragment(ExpatParser.java:506) E/AndroidRuntime( 5075):at org.apache.harmony.xml.ExpatParser.parseDocument(ExpatParser.java:467) E/AndroidRuntime( 5075):at org.apache.harmony.xml.ExpatReader.parse(ExpatReader.java:329) E/AndroidRuntime( 5075):at org.apache.harmony.xml.ExpatReader.parse(ExpatReader.java:286) E/AndroidRuntime( 5075):at de.stefandahmen.android.navtrack.NavTrack$1.run(NavTrack.java:129) E/AndroidRuntime( 5075):at java.lang.Thread.run(Thread.java: 1060) I have implement the onKeyDown function for the back button, because in the second activity i show a listview with strings and if i press the back button and choose another file, the strings from the first file is still in the listview and the new strings are appended in this list. public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK) { Waypoint wp = Waypoint.getInstance(); Trackpoint tp = Trackpoint.getInstance(); mapView.getOverlays().clear(); wp.clearLists(); tp.clearLists(); this.i=0; finish(); //does this work?? return true; } else return super.onKeyDown(keyCode, event); } NavTrack.java:682 : lat = tp.getTrkptLat(this.i); Trackpoint.java:40: public double [] getTrkptLat(int pos) { ... line 40: sublist = this.trkpt.subList(pos, getTrkptSize()-1); //i search for the next 50 trackpoints in the gpx file ... } XMLHandler 110: this.tp.setTrkpt(newAddress); //address with lat and lon Thanks in advance, Stefan PS: i test it with one file.. choose the file and press beack button.. in the third iteration i get the error above. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] removing item from ListView
Hi, i want to remove the first line from my ListView. I use the http://www.androidguys.com/2008/07/22/fancy-listviews-part-three/ example from Mark Murphy. I have a ImageView and two TextViews in one List-row. My adapter class: class MyAdapter extends ArrayAdapterString { Activity context; MyAdapter(Activity context) { super(context, R.layout.row, description); //description is a list of Strings and is showed in one TextView. The image and the other TextView depends on other objects. this.context=context; } I try: String delete = (((MyAdapter)lv.getAdapter()).getItem(0)); my_adapter.remove(delete); lv.setAdapter(my_adapter); But it only remove the description, but not the whole row!? Thanks in advance, Stefan -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: removing item from ListView
Thanks for your answers. @Mark: You do not need to call setAdapter() again on the ListView. ArrayAdapter will already remove the row from the ListView without setAdapter() being called again. If I dont set it, the images from the row changed arbitrarily. One example of my listview: IMAGE1 DESCRIPTION1 ANOTHER_STRING1 IMAGE2 DESCRIPTION2 ANOTHER_STRING2 IMAGE3 DESCRIPTION3 ANOTHER_STRING3 IMAGE4 DESCRIPTION4 ANOTHER_STRING4 if i dont call setAdapter, i get: IMAGE1 DESCRIPTION2 ANOTHER_STRING1 IMAGE4 DESCRIPTION3 ANOTHER_STRING2 IMAGE3 DESCRIPTION4 ANOTHER_STRING3 if i call setAdapter, i get: IMAGE1 DESCRIPTION2 ANOTHER_STRING1 IMAGE2 DESCRIPTION3 ANOTHER_STRING2 IMAGE3 DESCRIPTION4 ANOTHER_STRING3 what is also wrong, too. Must I create an own class, where i save my three values (image, description, anotherstring) and make a ArrayListMYOWNCLASS object?? I cannot believe, that it is so difficult to delete one row... Thanks, Stefan -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: removing item from ListView
Hello again, now all works fine with the ListView. I create my own class called ListHelper and add all relevant information for one row in a ListListHelper object: for(int i=0; idescription.size(); i++) { list.add(new ListHelper(text, string for image, second text); } and in the viewwrapper class, i set the image resource depending on the string for image. if(getModel(position).getSymbol().equals(right)) { wrapper.getIcon().setImageResource(R.drawable.right); } else if // And the error with my adapter: i dont handle: if(getModel(position).getSymbol().equals(left)) { wrapper.getIcon().setImageResource(R.drawable.left); } else if because i thought, that this is covered with the ImageView getIcon () { if (icon==null) icon = (ImageView)base.findViewById(R.id.left); return icon; } Thanks for your help again, Stefan -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Strange NullPointerException in WebView.onTouchEvent in Android 2.1 Update 1
For some reason, since upgrading to Android 2.1 Update 1 (stock Nexus One), I occasionally get NullPointerException in WebView.onTouchEvent method. It does not happen all the time and that makes it difficult to track down. Here is the stack trace: java.lang.NullPointerException at android.webkit.WebView.onTouchEvent(WebView.java:3977) at android.view.View.dispatchTouchEvent(View.java:3709) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:852) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884) at com.android.internal.policy.impl.PhoneWindow $DecorView.superDispatchTouchEvent(PhoneWindow.java:1659) at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java: 1107) at android.app.Dialog.dispatchTouchEvent(Dialog.java:643) at com.android.internal.policy.impl.PhoneWindow $DecorView.dispatchTouchEvent(PhoneWindow.java:1643) at android.view.ViewRoot.handleMessage(ViewRoot.java:1691) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:123) at android.app.ActivityThread.main(ActivityThread.java:4363) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:521) at com.android.internal.os.ZygoteInit $MethodAndArgsCaller.run(ZygoteInit.java:860) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618) at dalvik.system.NativeStart.main(Native Method) It appears to happen after the device resumes from sleep. I also tried looking at the latest repo source, but the line number (3977) while it is in the correct function is on line that does not make much sense to cause the exception. Has anyonhe seen a similar issue or knows where to get the correct source of WebView.java that matches the released 2.1 Update 1? Stefan -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] MapView draw Overlays
Hello, i have a problem with my mapView. my app reads some gps points out of a file and i want to draw a route (drawing lines between the gps point). If my file contains many gps points, my app works really slow. i think its working slow, because i draw all overlays. now i want to check, whether a point is visible in my mapView or not. so i have to get the mapCenter and Lat/lon span (getLatitudeSpan,..) !? how and where must i save my points and how can i check all my points (after my mapCenter has changed for example). Shall I save my points in a list (in my Overlay class??) and iterate through every list item and check, wheter its visible or not?? Thanks, Stefan -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: MapView draw Overlays
Hi, thanks for your answer. i first try it with the getLatitudeSpan and so on and check, if this point is visible or not. this works fine in the most cases. it also works, if i touch (ACTION_DOWN) the map with my thumb, move the map (ACTION_MOVE), and leave the thumb from the map (ACTION_UP). But if i scroll the map very fast, the map continue scrolling after ACTION_UP. So how can i detect, if the map has a new Map center for example? Another solution could be, that i transmit the gps points to my overlay class, check whether the point is visible and draw the line (because every time the map position chages, the draw method will be called)? In the thread mentioned above i read, that it is more efficient to draw the lines into a bitmap and than draw the bitmap instead of use the canvas.drawLine function. Means that, that i use ONE bitmap for all lines or must i create a bitmap for each line? I dont find a nice tutorial for that and i have a mental block now... how would the code looks like? : class MyOverlay extends Overlay { //List of my gps points; MyOverlay(gpspoints) { . } @Override public boolean draw(Canvas canvas, MapView mapView, boolean shadow, long when) { Canvas can = new Canvas (); //i have read that some times the canvas has height=0 and width=0 at the beginning??) bitmap = Bitmap.createBitmap(canvas.getWidth(), canvas.getHeight(), Bitmap.Config.ARGB_); can.setBitmap(bitmap); iterate through the list and check, whether point is visible or not { if(visible) //how to add a line to that bitmap?? can.drawLine??? } //how to draw the bitmap?? } } or can i add all gps points (no check, if gps point is visible) into the bitmap and the perfomance is still fast?? Thanks again, Stefan -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Toast or AlertDialog problem
Hi, i need a alert dialog, which pop ups every time, when the location changed (after 100 meter for example). I want to have 2 Buttons in this dialog: left and right. If the user dont push one of these buttons after some seconds, the dialog should no longer be displayed. So I can't use the AlertDialog, because this one will wait for some user inputs!? But can I include Buttons in a Toast?? Thanks for help, Stefan --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Toast or AlertDialog problem
Hi, On Aug 1, 1:42 am, CraigsRace craig...@gmail.com wrote: You could create your own dialog class which started a thread that calls finish() (back on the EDT) after x seconds. Do you mean, that i should do something like that: alert = new AlertDialog.Builder(xxx.this).setTitle(Alert Example 1).setIcon(R.drawable.icon).setMessage(...).setPositiveButton (Left, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { //do something } }).setNegativeButton(Right, new DialogInterface.OnClickListener () { public void onClick(DialogInterface dialog, int whichButton) { //do something } }); an use this alert in a thread??: dialog = new Thread () { public void run() { alert.show(); } }; dialog.start(); I test something like that, but it didn't work. I will continue testing now ;) Thanks for help. Stefan PS: whats the meaning of EDT?? Event dispatching thread?? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Toast or AlertDialog problem
Thanks for your answers. Now I work with threads. But I dont use the AlertDialog - i make some buttons visible and invisible. Thats good enough for the first time. If someone has a better idea, please let me know. greets, Stefan --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Thread problem
Hi, i use a Thread to make buttons visible for some seconds. If the location change, the buttons should gets visible for x seconds. My code: dialog = new Thread (new Runnable() { public void run() { try { Thread.sleep(3000); handler.sendMessage(handler.obtainMessage()); } catch (Throwable t) { t.printStackTrace(); } } }); My handler: Handler handler = new Handler () { public void handleMessage(Message msg) { right.setVisibility(View.INVISIBLE); //Button left.setVisibility(View.INVISIBLE); //Button } }; in my onLocationChanged - method, i change the visibiliy of my buttons to View.VISIBLE and call dialog.run(); But the buttons aren't visible for 3 seconds.. It seems, thats my app sleep for 3 seconds and after that, the buttons are show for ~1ms. Thanks for tips. Greets, Stefan --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Mock up developing / creation tool for android
Hi, i search a tool to develop/create mock ups for android. The only things i find are psd files (http://www.matcheck.cz/androidguipsd/ and http://chrisbrummel.com/google-android-gui-psd - not all widgets) and this tool: http://www.balsamiq.com/products/mockups. But this tool isn't only for android and so the look of the elements isn't equal to the android widgets (button, menu/list item etc.). If someone knows a tool, please let me know. Regards, Stefan --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: How can i fetch builtin contacts in mobile...?
Hi, take a look on the source codes from the book professional android application development from reto meier. you can download it from this page: http://media.wiley.com/product_ancillary/17/04703447/DOWNLOAD/Download%20code%20for%20Professional%20Android.zip unzip the file and then browse to Chapter5_Sample_ContactPicker.zip an unzip this again. I hope I could help you. Regards, Stefan On Aug 7, 11:17 am, android.vinny vinny.s...@gmail.com wrote: Hi I need to fetch all the built in contacts we added in contacts app How is it possible to fetch the contacts Can any body suggest me regarding this ... TAI --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Mock up developing / creation tool for android
This is the best tool that I have used until now. I have test it a little bit, but the MapView is missing for example?!? But nevertheless a useful tool. Thanks, Stefan --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] get current location after pressing button
Hi, I want to implement a tracking software (saving outdoor routes with gps). If the user press a button, the device should save the current! (and not the LastKnownLocation) gps point. If there isn't a direction change, the device looks after xxx seconds, whether the user reaches a point yyy meters away from the last saved point (no problem with requestLocationUpdates(LocationManager.GPS_PROVIDER, xxx, yyy, locationListener); ) I can't or won't save all 1m and 1 second a new gps point. Or does somebody knows, how much memory is used, i i track a 10km route an save every second the new gps points (~5km/h) ? And if somebody track a 100km tour ^^ And whats up with the performance and responsivness of the app. So I want to use a thread. If i click on the button (left or right), I call removeLocationUpdate, than i start a thread, which calls getLocation. In this function, I set requestLocationUpdates(.., 0,0,..). And here's my last question: How should my LocationListener class know, wheter it was fired from requestLocationUpdates(.., 0,0,..) (pressing button) or from requestLocationUpdates (LocationManager.GPS_PROVIDER, xxx, yyy, locationListener); ??? Because I want to change the requestLocationUpdates - function back to xxx seconds and yyy meters?? I hope you can understand my problem and have some tipps for me. Thanks and regards, Stefan --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Efficiency of requestLocationUpdates() and how to save these gps data
Hello, i'm developing a small gps application. I want to track some gps data. So I use the requestLocationUpdates - function. Now a quote from the android development reference: The frequency of notification or new locations may be controlled using the minTime and minDistance parameters. If minTime is greater than 0, the LocationManager could potentially rest for minTime milliseconds between location updates to conserve power. If minDistance is greater than 0, a location will only be broadcast if the device moves by minDistance meters. To obtain notifications as frequently as possible, set both parameters to 0. My question is, how much battery power will be lost, if a user wants to track for example 100 km and i set the parameters to 0? My second question is, how I can save the gps data efficiently?? If the user wants to track a 100km tour, I will have 100.000 gps data (if the device broadcast a change of location every 1m). So I think, I have to choose the parameter values of the requestLocationUpdates - function greater than 0. Has anyone experience and can give me a value which gives good results (if I drive with a bike (10-15km/h) or if i walk (5km/h)? And how can I save a specific point during the minTime and minDist (for example if there is a landmark)? Thanks, Stefan --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] NullPointerException in getFromLocation function
Hello, i'm trying to get a location from lat /lon values with the getFromLocation function: adresses = geocoder.getFromLocation(lat, lon, 1); // Search addresses The function should return a empty List, if it don't find an address, but it throws the NullPointerException. What can/must I do to fix it?? Thanks, Stefan --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: NullPointerException in getFromLocation function
Sorry, i have found my stupid error. I don't initialize my Geocoder object. Regards, Stefan --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] show information after click on overlay
Hello, i work on two map based application, where i can save important points with text or image (first software). In the second software i want to draw overlays on the map with the important points (draw a bitmap, works fine). So i try to develop a overlay class. What kind of overlay is the best solution and how can i show the information (text and image). I try to solve my problem with ItemizedOverlay and the onTap() function. I get the correct index if i click on one bitmap. But i dont know, how i can popup the information (text or image). Must i implement a transparent panel and then show the information in that panel? i dont want to see only a Toast. The user should decide himself when he wants to close the information. What i want is something similar to the google maps application: If i click in the map, a popup shows the latitude/longitude or the streetname. Thanks in advance, Stefan -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: MapView Overlays Containing Widgets/View
hello, i have a similar problem. i want to see a picture or a text, if i click on an itemizedoverlay. my i-overlay is implemented in an own class. In my main app i add my itemizedoverlays: if(symbol[i].equals(huhu)) item = new OverlayItem(ov, PICTURE, description.get(i)); else if(symbol[i].equals(haha)) item = new OverlayItem(ov, TEXT, description.get(i)); overlay.addItem(item); mapView.getOverlays().add(overlay); And in my overlay class, i implement that: @Override protected boolean onTap(int i) { if(items.get(i).getTitle().equals(PICTURE)) { // i want to see the picture (i get the filename with getSnippet() ), until the user close the new window (with a button for example??) or make something invisible/gone?! } if(items.get(i).getTitle().equals(TEXT)) { // i want to see the text (text in getSnippet()), until the user close the new window (with a button for example??) or make something invisible/gone?! } How can I show this information in this seperate overlay class?? Thanks, Stefan PS: this was my question in my thread http://groups.google.com/group/android-developers/browse_thread/thread/b1f285209001b782, perhaps it was/is harder to understand, because my english isnt the best. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] SeekBar with Text?
hello, is there a xml attribute to define text below the seekbar for the values? or must i set TextViews below the seekbar? Or is there a other similar widget for that problem?? I want to change km/h values with the seekbar. and the user wants to see, which value they set. Thanks, Stefan -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] how can i save my overlays?
Hello, I have following problem with my application: in my main activity, i listen for gps points and show them on my map. if i want to describe a important point, i open a second activity with a EditText and i can save the description and finish this second activity (to write text, i change to landscape mode). when i return to the main activity, the overlay isnt display any more. My main activity has the android:screenOrientation=portrait attribute. I have implement the onSaveInstanceState()-Method, but how can i save the overlay (list)?? Must I implement a Parcelable Objekt?? Thanks, Stefan -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] MapView Overlay problem
hello, i have an activity with a MapView ad overlays. If i start a new activity and go back to my Activity with the map, i only see the map without my overlays. How can i save my overlays?? The mapView.onSaveInstanceState() does not save the overlays, does it? Or have i implement something wrong and the overlays should be visible after i come back to my MapActivity? Thanks in advance. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: MapView Overlay problem
On Jan 5, 1:16 pm, Master_Ne0 master.ne0s.soluti...@googlemail.com wrote: I also had this problem, i had to save the overlay locations to the outstate bundle then add them again onResume. Couldn't figure a way to save my overlay class to bundle. Let me know if you find a better workaround. Ne0 Thanks for your fast answer. Because this is the best idea until know, i will test your solution and if i find a better way, i will let you know. Thanks again, Stefan -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: MapView Overlay problem
On Jan 5, 6:48 pm, TreKing treking...@gmail.com wrote: Couldn't figure a way to save my overlay class to bundle Have your Overlay class implement the Parceable interface, which you can then save to / restore from a Bundle. hmmm, in my case i have always a new overlay for each line on my map: in every iteration/run of the onLocationChanged method i call overlay = new MyOverlay() before i know the MyLocationOverlay i draw my current location with the drawOval and for this overlay-object (my_pos = new MyOverlay (...) ) i use the parcelable. But i dont know how i can save my other normal overlays, because in each iteration/run i override my overlay object? -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: MapView Overlay problem
Ok, i try it :) 1. I track gps points in my app and draw my route on a MapView: @Override public void onLocationChanged(Location loc) { if (loc != null) { latitude = loc.getLatitude(); longitude = loc.getLongitude(); if(first) { p1 = new GeoPoint((int) (loc.getLatitude()*1E6), (int) (loc.getLongitude()*1E6)); mc.animateTo(p1); mc.setZoom(18); first=false; //act_pos = new TrackOverlay(p1, p1,1); I NOW USE MYLOCATIONOVERLAY //map.getOverlays().add(act_pos); mlo = new MyLocationOverlay(TRACKing.this, map); map.getOverlays().add(mlo); mlo.enableMyLocation(); mlo.runOnFirstFix(new Runnable() { public void run() { mc.animateTo(mlo.getMyLocation()); } }); } else { p2 = p1; p1 = new GeoPoint((int) (loc.getLatitude()*1E6), (int) (loc.getLongitude()*1E6)); to = new TrackOverlay(p1, p2, 0); //act_pos.setGeoPoints(p1, p2); I NOW USE MYLOCATIONOVERLAY map.getOverlays().add(to); mc.animateTo(p1); map.invalidate(); } } } 2. My TrackOverlay class: public class TrackOverlay extends Overlay implements Parcelable { private static final int TRACK = 0; private GeoPoint gp1, gp2; private int mode; public TrackOverlay(GeoPoint gp1,GeoPoint gp2, int mode) { this.gp1 = gp1; this.gp2 = gp2; this.mode = mode; } public void setGeoPoints (GeoPoint gp1, GeoPoint gp2) { this.gp1 = gp1; this.gp2 = gp2; } @Override public boolean draw(Canvas canvas, MapView mapView, boolean shadow, long when) { Projection projection = mapView.getProjection(); if (shadow == false) { Paint paint = new Paint(); paint.setAntiAlias(true); Point point = new Point(); if(gp1!=null gp2 != null) { projection.toPixels(gp1, point); if(mode==TRACK) { paint.setColor(Color.BLUE); Point point2 = new Point(); projection.toPixels(gp2, point2); paint.setStrokeWidth(5); paint.setAlpha(120); canvas.drawLine(point.x, point.y, point2.x,point2.y, paint); } else //atm nothing to do } } return super.draw(canvas, mapView, shadow, when); } @Override public int describeContents() { // TODO Auto-generated method stub return 0; } @Override public void writeToParcel(Parcel dest, int flags) { // TODO Auto-generated method stub } private TrackOverlay (Parcel in) { } public static final Parcelable.CreatorTrackOverlay CREATOR = new Parcelable.CreatorTrackOverlay() { public TrackOverlay createFromParcel(Parcel in) { return new TrackOverlay(in); } public TrackOverlay[] newArray(int size) { return new TrackOverlay[size]; } }; } 3. If i want to describe a specific point, i start a new activity (via menue). and if i come back to this activity, i cant see the overlays any more. So how can I save my overlays?? Thanks, Stefan PS: I hope this help you... -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: MapView Overlay problem
hi, thanks for your answer :) On Jan 5, 11:30 pm, TreKing treking...@gmail.com wrote: OK, well your main problem is that while you implemented the Parcelable class, you didn't implement the writeToParcel method or the constructor that takes a Parcel. That's the key. in one other class of my app i has implement the parcelable to, but there i mustnt implement these methods. i dont know why but it works. this other class is my SaveHelper class (its like a singleton - i only have one object), where i save my track/route... and i test it: i walk around my block and i rotate the handy several times (==recreation of my activity..). and after saving my gpx file i see, that ALL points are saved. You need to implement the first method to save all you state information (i.e., your member variables) to the Parcel object. Then implement the constructor to restore your instance state from the incoming Parcel object. I override my Overlay object, how you can see in my code and because of that i would only get the last overlay back?!?! I think you mean, that i do following: @Override public void writeToParcel(Parcel dest, int flags) { // TODO Auto-generated method stub dest.writeInt( (int)gp1.getLatitude()); //something like that } and private TrackOverlay(Parcel in) { gp1.setLatitude(in.readInt()); } but the onSaveInstanceState will only be called, if i pause the activity?! So i can only save the last to (TrackOverlay) object?!?! Or if i implement these methods i save all my Overlays?!? Then in your MapActivity onSavedInstanceState, iterate through all of your Overlays and shove them into an array you can store in the Bundle. In onRestoreInstanceState, get a list of Parcelables from the Bundle and re-create all of your Overlays (using the constructor that takes a Parcel). Perhaps it is easier to save all GeoPoints in a list and in onSaveInstanceState() i iterate through that list and save all GeoPoints in a int [] lat and int [] lon array and put it to my bundle and in onRestoreInstanceState i read this arrays and iterate through these arrays and draw the Overlays again, like: gp1.setLatitude(lat[0]); . for(int i= 1; i lat.length; i++) { gp2 = gp1; gp1.setLatitude(..) ... newOverlay = new TrackOverlay(gp1, gp2, MODUS); map.getOverlays().add(newOverlay); } map.ivalidate(); But what is more efficient and/or more elegant ? Other bit of advise: get rid of that if (first) { /*initialze*/} code. Set up your MyLocationOverlay object in onCreate. If you need to have a starting location while you wait for the first update, use getLastKnownLocation(). Yes, this is not the best solution and i will optimize it soon :) I hope that makes sense and helps some. Thanks for your detailed answer. Stefan -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: MapView Overlay problem
On Jan 6, 4:57 am, Peter SSK sasikumar.it1...@gmail.com wrote: see this link http://www.androidpeople.com/category/google-map/ is that the right link? There i only see, how to display a Map. Thats not the problem. But perhaps i dont find the right part?! -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: HTC Incredible no default external storage?
First day of HTC Incredible sales and reports about Why the need for storage card when the device has plenty of internal storage have already started. Not only we have to deal with different resolutions/DPIs, and versions of Android, now we have to also deal with multiple storage locations too. I guess this is the price to pay for having an open platform where each vendor is free to define their own standards. Stefan On Apr 27, 7:19 pm, Streets Of Boston flyingdutc...@gmail.com wrote: Thank you Mark. I just updated my app's description that it requires an SD-card. On Apr 27, 7:11 pm, Mark Murphy mmur...@commonsware.com wrote: Streets Of Boston wrote: Just great! NOT! I'll start another thread on this forum asking if Environment.getExternalStorageDirectory() still works on the Incredibleor not... It looks like it doesn't. My guess is that it returns /sdcard, as that would explain the behavior from the reviews. Also, that would be the default behavior if nobody changed anything with respect to that API. My HTC contacts came through (an hour or so after I kvetched on-list that they hadn't), and I am pursuing getting a loanerIncredibleto get to the bottom of this. I hope some Google engineers can chime in. I doubt they know the answer. They might have anIncrediblelying around they could test with, though. -- Mark Murphy (a Commons Guy)http://commonsware.com|http://twitter.com/commonsguy _Android Programming Tutorials_ Version 2.0 Available! -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group athttp://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group athttp://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Android 1.5 performance profiling
One of the new features mentioned in the 1.5 SDK is Easier application performance profiling. Can somebody shed some light on what new profiling features are available in the new SDK? Are those enhancements to TraceView, DDMS, or new profiling APIs ? Stefan --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: 2.3: WebView's JavaScriptInterface throwing exception 100% of time
I also found this to cause be a repeatable crash in 2.3 emulator. The crash log always starts with: 12-08 09:35:15.945: WARN/dalvikvm(8823): JNI WARNING: jarray 0x40540b30 points to non-array object (Ljava/lang/String;) then 12-08 09:35:16.185: INFO/DEBUG(7347): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr deadd00d 12-08 09:35:16.185: INFO/DEBUG(7347): r0 febc r1 deadd00d r2 0026 r3 12-08 09:35:16.185: INFO/DEBUG(7347): r4 81da45c8 r5 40540b30 r6 81d8592c r7 00263230 At this point all we can do is vote for the issue (http:// code.google.com/p/android/issues/detail?id=12987 ) and hope it is an emulator only issue or it gets fixed before the final build makes it to the devices. On Dec 8, 8:04 am, jsdf jasons...@gmail.com wrote: Thanks for reporting it Tony. I've contacted everyone I know at Google and outside. I found one workaround, but it's ugly. I'll post it on the issue itself. On Dec 7, 4:07 pm, Tony tony.cassan...@gmail.com wrote: Hey, I reported the issue that you linked to. I'm trying to find a workaround but have yet to see any possible way of getting things up and running. Anyone out there with any thoughts? Or someone at Google who can let us know the status of this? I'm really hoping that someone just screwed up the emulator build and that this won't affect the production builds... tony On Dec 7, 8:10 am, jsdf jasons...@gmail.com wrote: Hi all, Has anyone played with the 2.3, WebViews, and the JavaScript to Java interface? If so, have you gotten it working? I, and a number of others, have seen this fail 100% of the time.http://code.google.com/p/android/issues/detail?id=12987 This is a very serious issue. Anyone have suggestions? -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Any guidelines for handling the Headset and Bluetooth AVRC buttons in Froyo?
I am trying to figure out what is the correct (new) approach for handling of Intent.ACTION_MEDIA_BUTTON in Froyo. In pre 2.2 days we had to register a BroadcastReceiver (either permanently or at run- time) and the Media Button events would arrive (as long as no other application intercepts them and aborts the broadcast). Froyo seems to still somewhat support that model (at least for the wired headset), but it also introduces the registerMediaButtonEventReceiver, and unregisterMediaButtonEventReceiver methods that seem to control the transport focus between applications. During my experiments, using registerMediaButtonEventReceiver does cause both the bluetooth and the wired headset button presses to be routed to the application's broadcast receiver (the app gets the transport focus), but it looks like any change in the audio routing (for example unplugging the headset) shits the focus back to the default media player. What is the correct way to handle that in Froyo? Do we have to detect the change in the audio routing and try to re-gain the focus? This is an issue that any 3rd party media player on the Android platform has to deal with, so I hope that a Google Engineer can provide some guidelines that we all can follow. Having a standard approach may make headset button controls a bit more predictable for the end users. Stefan -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Problem using Debug.setAllocationLimit
I am trying to track some excessive memory allocations in my application. For some reason the use of Debug.setAllocationLimit or VMDebug.setAllocationLimit appears to have no effect. I have test code that does something like: Debug.setAllocationLimit(0); String s = new String(); Debug.setAllocationLimit(-1); expecting the second line to throw an allocation exception but it does not. What is the correct way to track allocations between 2 points in the code execution? Is there some global place where allocations tracking must be turned on before they can be counted? Stefan --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] PendingIntent / addProximityAlert problem
Hello, i have some questions about the addProximityAlert function. My task is to develop an android navigation application. The app reads some gps point out of a gpx-file. Thats not really a problem. If the handy is near the point, the app shall notify me this. So i used the addProximityAlert function: setProximityAlert () { .. double lati = lat[arrayindex]; //the saved gps data double lng = lon[arrayindex]; expiration=-1; .. Intent intent = new Intent(TREASURE_PROXIMITY_ALERT); proximityIntent = PendingIntent.getBroadcast(getApplicationContext(), 0, intent, 0); lm.addProximityAlert(lati, lng, radius, expiration, proximityIntent); IntentFilter filter = new IntentFilter(TREASURE_PROXIMITY_ALERT); registerReceiver(new ProximityIntentReceiver(), filter); } public class ProximityIntentReceiver extends BroadcastReceiver { public void onReceive (Context context, Intent intent) { String key = LocationManager.KEY_PROXIMITY_ENTERING; entering = intent.getBooleanExtra(key, false); if (entering) arrayindex++; //lm.removeProximityAlert(proximityIntent); } The setProximityAlert () function is called if the position has changed. I develop the app with the emulator and Android SDK 1.5. I use the console with geo fix commands to simulate gps data. If you can see in this lines of code, I use an arrayIndex. I've save all gps data of the gpx file in an array. If the handy is near the first point, the ProximityAlert notify, that the handy enters this position. My problem is, that sometimes the ProximityAlert fires only one time, sometimes 3 times or more. I think the problem is the expiration time? But if I took a value like 2000 (2sec), the proximityAlert only works for 2 seconds?! A solution can be, that I use multiple proximityIntents variables, so that I save all proximityAlerts with addProximityAlert function only once. But if I than enters the position of the third gps point before the second or first point, the ProximityAlert will fire, but it shouldn't before them! What can I do? Must I implement a subactivity, which starts when I entered the first position, than raise a counter and go back into the main activity? I think the problem will be the same? Greets, Stefan PS: I'm german, so apologize some mistakes. And this project is my first in the Android world. So i'm not an expert.. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] addProximityAlert problem
Hi, I have a problem with the proximityAlert function. I develop a navigation software, which reads some gps data out of a gpx file. Then I write the first gps point in the addProximityAlert function. When I get near this point, I want to raise an index to get the next position from the gpx file (I save all positions in an array). But some times the ProximityAlert fires one time (fine!), but sometimes it fires 3 times or more? I think thats a problem with the expiration time. I choose -1 (never expire). But if I took a value like 2000 (2 seconds), the alert fire only, if i reach the position in the next 2 seconds? I have try to use the removeProximityAlert function (I have a global PendingIntent variable therefore). But then it fires instead of 3 times 6 times?! I have also test to use multiple PendingInten variables and add them all with the addProximityAlert function. But then the ProximityAlert of the third point can fire before the first or second point?! Here is a part of my code: private void setProximityAlert() { //will call every time the location changed double lati = lat[arrayindex]; double lng = lon[arrayindex]; float radius = 1f; //meters long expiration = -1; //-1 für not expire Intent intent = new Intent(TREASURE_PROXIMITY_ALERT); proximityIntent = PendingIntent.getBroadcast (getApplicationContext(), 0, intent, 0); lm.addProximityAlert(lati, lng, radius, expiration, proximityIntent); IntentFilter filter = new IntentFilter (TREASURE_PROXIMITY_ALERT); registerReceiver(new ProximityIntentReceiver(), filter); } /** Proximity Alert Broadcast Receiver */ public class ProximityIntentReceiver extends BroadcastReceiver { @Override public void onReceive (Context context, Intent intent) { String key = LocationManager.KEY_PROXIMITY_ENTERING; entering = intent.getBooleanExtra(key, false); if (entering) arrayindex++; entering = false; //lm.removeProximityAlert(proximityIntent); } } I hope that I discribe my problem well enough. I'm german, so apologize some mistakes with the english syntax. Greets, Stefan PS: I try to write a message last night, but this message isn't visible?! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: PendingIntent / addProximityAlert problem
Hello again, one more information: i test my app with this gps data: lat, lon 3 3 lat, lon 10 10 I use the geo fix command as follows: 1. geo fix 3 3: fires one time == entering true... OK 2. geo fix 5 5: enters the ProximityIntentReceiver class - but not my if clause == entering is false! OK 3. geo fix 7 7: nothing happens WHY? 4. geo fix 10 10: is fired 3 times and my arrayindex raise from 1 to 4 WHY? Thanks for help --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] how to wrap content in optionsmenu?
Hi, my problem is, that i have long strings in my optionsmenu. so my question is, whether is it possible to define, that i only want to show one item per line: LNG STRING 1 LONG STRING2 or is it possible to wrap the content like - LOOONG | LOOONG STRING 1 | STRING 2 - i dont know, how android create such menus. i actually have 5 items in my menu: menu.add(Menu.NONE, 0, 1, R.string.mode); menu.add(Menu.NONE, 1, 0, R.string.delete); //long string menu.add(Menu.NONE, 2, 2, R.string.deletegef);//long string menu.add(Menu.NONE, 3, 3, R.string.help); menu.add(Menu.NONE, 4, 4, R.string.quit); the second and the third menu items are too long. so i decide to show the second menu entry at the top of the menu, but the third entry is still too long: - FIRST LONG ITEM - ONE SHORT | SECOND TOO LONG ITEM - SHORT | SHORT so how could i solve this problem? I try to define a long string with a \n character, but this does not work Thanks, Stefan -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] How to stream ADTS AAC on Android 3.0?
Hi! I am working on an audio playback application that needs to stream audio content to the device and I am having trouble selecting the right technologies for this. My raw data is in AAC-ADTS form and there is no way for me to change that. However, I can wrap the stream in a different container at various places of the system, but it is not clear to me which approach to take. I have checked the emails on this list and I have seen several posts with similar challenges, but no solutions. Data is delivered over http, but using a local server I could of course change that to something else. Any suggestions for a solution? Can any of the .3gp .mp4 or .m4a formats be used for progressive playback? If so, how should that stream be constructed? If I convert my ADTS stream to mp4 using VLC, a large chunk in the beginning of the file is created that is the index for the stream. However, if that has to be present in each file, then the latency for playback would be linear to the total size of the file. Any help or pointer would be highly appreciated! regards, Stefan Burstrom -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Specification of strings.xml available?
Hi all, I'd like to develop a tool converting Android strings.xml files to XLIFF files (http://docs.oasis-open.org/xliff/xliff-core/xliff- core.html) for localization and vice versa. Obviously strings processing is quite complicated on the Android platform. While experimenting I've found the following: - String can be quoted and unquoted - Besides XML escaping there is Java-style escaping (\n, \u, ...) - It seems as if there are reserved charaters like '@' or '?' (at least at the beginning of unquoted strings) - It seems as if whitespace is collapsed if a string is not quoted - By default strings are interpreted as formatted strings, so you have to be careful with '%' characters - The string element can have additional attributes like formatted - You can use HTML-markup in your strings - You can use elements of foreign namespaces inside strings To develop a working converter I need to know all the rules and conversions Android applies on strings. Unfortunately the developer guide seems to be incomplete with regards to string resources. Is there a formal strings.xml file specification available? I haven't found one so far. In case there is no specification available: Does somebody know which part of the Android code processes strings.xml files? Thanks and best regards, Stefan -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Multiple Threads
I'm making a app which got it's data from parsing a website, and I have to download around 100 webpages. This is a time consuming task, so I created a AsyncTask for downloading the data, so I can show a Loading message on the UI Thread. Only problem is, that the 100 webpages are now downloaded after each other. Is there a way to download the webpages at the same time? I tried to make a new thread in the asynctask, but I only got a Can't create handler inside thread that has not called Looper.prepare() eror... What's the best way to do this usually? -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Multiple Threads
This sounds a little bit diffecult to I'm not very experienced in writing my own ASyncTask, or creating a custum handler. Isn't it possible to create a new thread withing the asynchtask. So the big task is plitted up in several smaller tasks. On 4 mei, 16:27, Satya Komatineni satya.komatin...@gmail.com wrote: An AsyncTask may be doing its work with a single worker thread. You may want to download the sourcecode of AsyncTask and alter it so that a pool of threads can do the work to speed up. This is just thinking aloud. Or write your own handler that spawns multple threads and have the handler report back to the main thread much like the async task. Satya On Wed, May 4, 2011 at 10:03 AM, Stefan stefankru...@hotmail.com wrote: I'm making a app which got it's data from parsing a website, and I have to download around 100 webpages. This is a time consuming task, so I created a AsyncTask for downloading the data, so I can show a Loading message on the UI Thread. Only problem is, that the 100 webpages are now downloaded after each other. Is there a way to download the webpages at the same time? I tried to make a new thread in the asynctask, but I only got a Can't create handler inside thread that has not called Looper.prepare() eror... What's the best way to do this usually? -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Satya Komatinenihttp://www.satyakomatineni.comhttp://www.androidbook.com -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en