[android-developers] rotating map
So, I successfully took the MapView sample that demonstrates rotating a map based on device orientation. What I am not liking about it is that the text and such are rotating with the view. So, when you turn 180 degrees all the text is upside-down. I am wondering if perhaps I missed something in my implementation? Maybe I need to invalidate a view or something? -- 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
Re: [android-developers] rotating map
Like I said, it is derrived from the sample that is provided with the Google API. But here is the onCreate for the activity: public void onCreate(Bundle bundle) { super.onCreate(bundle); String APIKey = mykey; mSensorManager = (SensorManager) getSystemService(SENSOR_SERVICE); // Create Rotate view mRotateView = new RotateView(this); RelativeLayout layout = new RelativeLayout(this); RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.FILL_PARENT, RelativeLayout.LayoutParams.FILL_PARENT); layout.setLayoutParams(params); // create a map view mapView = new MapView(this,APIKey); mapView.setBuiltInZoomControls(true); mapView.setClickable(true); mapView.setEnabled(true); mapController = mapView.getController(); mapController.setZoom(14); // Zoom 1 is world view mapView.setBuiltInZoomControls(true); Drawable drawable = this.getResources().getDrawable(R.drawable.pin_green); itemizedoverlay = new MyOverlays(drawable, this); layout.removeAllViews(); mRotateView.addView(mapView); layout.addView(mRotateView); setContentView(layout); mylocation = new MyLocationOverlay(this,mapView); createMarker(); Essentially there is a view created that manages the rotation, and it is updated when the sensor changes. That all works, it rotates nicely. But text on the map does not, and actually the touch layer doesn't (for example if I rotate 180 degrees and then pan down it actually pans up). I am just if anyone has achieved different behavior they would be willing to articulate what they did to make it work properly? On Thursday, April 5, 2012 11:37:55 AM UTC-4, TreKing wrote: On Thu, Apr 5, 2012 at 10:33 AM, RedBullet wrote: I am wondering if perhaps I missed something in my implementation? Maybe I need to invalidate a view or something? You've provided almost no information about your implementation, so it would be quite difficult for anyone to comment on it. - TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago transit tracking app for Android-powered devices -- 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
Re: [android-developers] rotating map
And for completeness for the rotation I do the following: public void onSensorChanged(SensorEvent event) { RideRouterApp.i(String.format(Sensor Name: %s, oriented %f, event.sensor.getName(), event.values[0])); synchronized (this) { mHeading = event.values[0]; invalidate(); } } @Override protected void dispatchDraw(Canvas canvas) { canvas.save(Canvas.MATRIX_SAVE_FLAG); canvas.rotate(-mHeading, getWidth() * 0.5f, getHeight() * 0.5f); mCanvas.delegate = canvas; super.dispatchDraw(mCanvas); canvas.restore(); mapView.invalidate(); } On Thursday, April 5, 2012 11:45:45 AM UTC-4, RedBullet wrote: Like I said, it is derrived from the sample that is provided with the Google API. But here is the onCreate for the activity: public void onCreate(Bundle bundle) { super.onCreate(bundle); String APIKey = mykey; mSensorManager = (SensorManager) getSystemService(SENSOR_SERVICE); // Create Rotate view mRotateView = new RotateView(this); RelativeLayout layout = new RelativeLayout(this); RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.FILL_PARENT, RelativeLayout.LayoutParams.FILL_PARENT); layout.setLayoutParams(params); // create a map view mapView = new MapView(this,APIKey); mapView.setBuiltInZoomControls(true); mapView.setClickable(true); mapView.setEnabled(true); mapController = mapView.getController(); mapController.setZoom(14); // Zoom 1 is world view mapView.setBuiltInZoomControls(true); Drawable drawable = this.getResources().getDrawable(R.drawable.pin_green); itemizedoverlay = new MyOverlays(drawable, this); layout.removeAllViews(); mRotateView.addView(mapView); layout.addView(mRotateView); setContentView(layout); mylocation = new MyLocationOverlay(this,mapView); createMarker(); Essentially there is a view created that manages the rotation, and it is updated when the sensor changes. That all works, it rotates nicely. But text on the map does not, and actually the touch layer doesn't (for example if I rotate 180 degrees and then pan down it actually pans up). I am just if anyone has achieved different behavior they would be willing to articulate what they did to make it work properly? On Thursday, April 5, 2012 11:37:55 AM UTC-4, TreKing wrote: On Thu, Apr 5, 2012 at 10:33 AM, RedBullet wrote: I am wondering if perhaps I missed something in my implementation? Maybe I need to invalidate a view or something? You've provided almost no information about your implementation, so it would be quite difficult for anyone to comment on it. - TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago transit tracking app for Android-powered devices -- 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: rotating map
Yea, I realized that was going on. I wasn't sure if perhaps the MapView had a mechanism to correct itself (when it initially draws it appears to orient text correctly) that I am missing. Or if the overall approach that the sample provides just can't work. Has anyone properly gotten the maps to rotate? On Thursday, April 5, 2012 5:55:32 PM UTC-4, lbendlin wrote: Maybe you haven't realised it yet, but the Google Maps API serves map tiles (unlike the Google Maps app that uses vector data). So the text is part of the image, and rotates with it. On Thursday, April 5, 2012 11:33:00 AM UTC-4, RedBullet wrote: So, I successfully took the MapView sample that demonstrates rotating a map based on device orientation. What I am not liking about it is that the text and such are rotating with the view. So, when you turn 180 degrees all the text is upside-down. I am wondering if perhaps I missed something in my implementation? Maybe I need to invalidate a view or something? -- 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
Re: [android-developers] No validating SAX parser for android?
Any more ideas on this? I must be doing something obviously wrong, but perhaps there just isn't a validating SAX parser for Android? (though I would have expected someone on this list to say so)... On Monday, April 2, 2012 12:40:13 PM UTC-4, RedBullet wrote: I just tried that and got the same error. No validaing SAX parser implementaion available. On Monday, April 2, 2012 12:14:33 PM UTC-4, Daniel Drozdzewski wrote: ...so did you tell your parser the following: static final String GARMIN_SCHEMA_LANGUAGE = http://www.w3.org/2001/XMLSchema-instance;; static final String W3C_XML_SCHEMA = http://www.w3.org/2001/XMLSchema;; SAXParserFactory factory = SAXParserFactory.newInstance(); factory.setNamespaceAware(true); factory.setValidating(true); saxParser.setProperty(GARMIN_SCHEMA_LANGUAGE, W3C_XML_SCHEMA); ?? On 2 April 2012 17:10, RedBullet wrote: Yea, I read that. My XML contains the following so I thought that would be sifficient: ?xml version=1.0 encoding=UTF-8? TrainingCenterDatabase xmlns=http://www.garmin.com/xmlschemas/TrainingCenterDatabase/v2; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation= http://www.garmin.com/xmlschemas/TrainingCenterDatabase/v2 http://www.garmin.com/xmlschemas/TrainingCenterDatabasev2.xsd; Isn't that how it is supposed to work?? On Monday, April 2, 2012 12:01:42 PM UTC-4, Daniel Drozdzewski wrote: Did you tell your parser which schema will it be validating against? Setting validation flag to true is not enough... Have a look here at a quick validating example using SAXParser: http://docs.oracle.com/javaee/1.4/tutorial/doc/JAXPSAX9.html Daniel On 2 April 2012 16:34, RedBullet wrote: I am parsing some XML with SAX, and I noticed that there was some XSD in the files I am parsing. So, I figured to would turn validation on the factory before I get the parse, but when I do I get an error saying there is no validating parser available. So... How does one validate XML on the Android?? -- -- Daniel Drozdzewski -- -- Daniel Drozdzewski -- 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
Re: [android-developers] No validating SAX parser for android?
That's sort of what I am doing now. Seems kind of unsatisfying ;-) Just wanted to know what my options were... It is confusing because the docs seem to imply that one can do validation... On Wednesday, April 4, 2012 9:39:07 AM UTC-4, Streets Of Boston wrote: What about not validating the incoming XML? Since i don't know what type of app you need the validating SAX parser for, but if your app just needs to read bits and pieces of incoming XML, you really don't need a validating XML. Just read the data and present it to the user. If the incoming data is not what you expect, i.e. after reading the XML you are still missing pieces of data and such, let your app handle this situation by itself. On Wednesday, April 4, 2012 9:10:37 AM UTC-4, RedBullet wrote: Any more ideas on this? I must be doing something obviously wrong, but perhaps there just isn't a validating SAX parser for Android? (though I would have expected someone on this list to say so)... On Monday, April 2, 2012 12:40:13 PM UTC-4, RedBullet wrote: I just tried that and got the same error. No validaing SAX parser implementaion available. On Monday, April 2, 2012 12:14:33 PM UTC-4, Daniel Drozdzewski wrote: ...so did you tell your parser the following: static final String GARMIN_SCHEMA_LANGUAGE = http://www.w3.org/2001/XMLSchema-instance;; static final String W3C_XML_SCHEMA = http://www.w3.org/2001/XMLSchema;; SAXParserFactory factory = SAXParserFactory.newInstance(); factory.setNamespaceAware(true); factory.setValidating(true); saxParser.setProperty(GARMIN_SCHEMA_LANGUAGE, W3C_XML_SCHEMA); ?? On 2 April 2012 17:10, RedBullet wrote: Yea, I read that. My XML contains the following so I thought that would be sifficient: ?xml version=1.0 encoding=UTF-8? TrainingCenterDatabase xmlns=http://www.garmin.com/xmlschemas/TrainingCenterDatabase/v2; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation= http://www.garmin.com/xmlschemas/TrainingCenterDatabase/v2 http://www.garmin.com/xmlschemas/TrainingCenterDatabasev2.xsd; Isn't that how it is supposed to work?? On Monday, April 2, 2012 12:01:42 PM UTC-4, Daniel Drozdzewski wrote: Did you tell your parser which schema will it be validating against? Setting validation flag to true is not enough... Have a look here at a quick validating example using SAXParser: http://docs.oracle.com/javaee/1.4/tutorial/doc/JAXPSAX9.html Daniel On 2 April 2012 16:34, RedBullet wrote: I am parsing some XML with SAX, and I noticed that there was some XSD in the files I am parsing. So, I figured to would turn validation on the factory before I get the parse, but when I do I get an error saying there is no validating parser available. So... How does one validate XML on the Android?? -- -- Daniel Drozdzewski -- -- Daniel Drozdzewski -- 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] No validating SAX parser for android?
I am parsing some XML with SAX, and I noticed that there was some XSD in the files I am parsing. So, I figured to would turn validation on the factory before I get the parse, but when I do I get an error saying there is no validating parser available. So... How does one validate XML on the Android?? -- 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
Re: [android-developers] No validating SAX parser for android?
I just tried that and got the same error. No validaing SAX parser implementaion available. On Monday, April 2, 2012 12:14:33 PM UTC-4, Daniel Drozdzewski wrote: ...so did you tell your parser the following: static final String GARMIN_SCHEMA_LANGUAGE = http://www.w3.org/2001/XMLSchema-instance;; static final String W3C_XML_SCHEMA = http://www.w3.org/2001/XMLSchema;; SAXParserFactory factory = SAXParserFactory.newInstance(); factory.setNamespaceAware(true); factory.setValidating(true); saxParser.setProperty(GARMIN_SCHEMA_LANGUAGE, W3C_XML_SCHEMA); ?? On 2 April 2012 17:10, RedBullet wrote: Yea, I read that. My XML contains the following so I thought that would be sifficient: ?xml version=1.0 encoding=UTF-8? TrainingCenterDatabase xmlns=http://www.garmin.com/xmlschemas/TrainingCenterDatabase/v2; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation= http://www.garmin.com/xmlschemas/TrainingCenterDatabase/v2 http://www.garmin.com/xmlschemas/TrainingCenterDatabasev2.xsd; Isn't that how it is supposed to work?? On Monday, April 2, 2012 12:01:42 PM UTC-4, Daniel Drozdzewski wrote: Did you tell your parser which schema will it be validating against? Setting validation flag to true is not enough... Have a look here at a quick validating example using SAXParser: http://docs.oracle.com/javaee/1.4/tutorial/doc/JAXPSAX9.html Daniel On 2 April 2012 16:34, RedBullet wrote: I am parsing some XML with SAX, and I noticed that there was some XSD in the files I am parsing. So, I figured to would turn validation on the factory before I get the parse, but when I do I get an error saying there is no validating parser available. So... How does one validate XML on the Android?? -- -- Daniel Drozdzewski -- -- Daniel Drozdzewski -- 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 save/restore SharedPreferences between devices?
While my app is in beta testing I want to provide a mechanism to allow my testers to send me information (logs and such) so that I can have a better chance at reproducing problems. My question is, is there a reasonable way for an app to send along the SharedPreferences state to me such that I could then restore it in the emulator to help diagnose problems? I have certainly thought about just grabbing the values I am interested in and creating an XML file, and then just parse it on the other end. But it strikes me that there might be a better way. Any ideas? -- 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] Missing classes when running in emulator (new to R17)
So, I just updated SDK to R17, and updated my ADT to match. I just noticed that it doesn't appear to be including my third party libraries any more. I have the commons net 1.4.1 jar in my project, everything compiles like a champ, but when it runs I get a runtime error saying it cannot find a class in that JAR. Any ideas?? -- 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: Missing classes when running in emulator (new to R17)
Thanks! On Wednesday, March 28, 2012 11:22:38 AM UTC-4, Nadeem Hasan wrote: Rename your lib directory to libs. Clean and rebuild the project and try again. -- 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] Transitioning from debug to release builds
I am in the process of building my first app using Eclipse, and am preparing to start doing release builds. For example I am going through to make sure I have the right logging level for my log statements. But I do not really see how to produce a release build. For example in the documentation for Log ( http://developer.android.com/reference/android/util/Log.html) it says: Verbose should never be compiled into an application except during development. Debug logs are compiled in but stripped at runtime. Error, warning and info logs are always kept. It isn't clear to me how *I* do that or if that is done on my behalf when a release build is done... And to the last point there, I don't see where I actually do a release build... 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] use of audio streams
I am building an app that will do TTS to read turn by turn directions for navigation. When I am using a bluetooth headset I turn on SCO and use the STREAM_VOICE_CALLhttp://developer.android.com/reference/android/media/AudioManager.html#STREAM_VOICE_CALL stream. My question is, when I am NOT using bluetooth and just want to use the phone (optionally speaker) which stream do I use? STREAM_MUSIChttp://developer.android.com/reference/android/media/AudioManager.html#STREAM_MUSIC or something else? -- 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
Re: [android-developers] Transitioning from debug to release builds
In my app I have Warning, Debug, Information, and Verbose logging. They ALL see to get logged whether I am running, debugging, or running on the device (exported the app from eclipse and installed/run on my phone). On Tuesday, March 27, 2012 10:59:57 AM UTC-4, lbendlin wrote: if you are not yet ready to post to the market, you can also simply use Run rather than Debug in Eclipse. On Tuesday, March 27, 2012 10:55:26 AM UTC-4, MagouyaWare wrote: Export a signed .apk from eclipse... On Mar 27, 2012 6:47 AM, RedBullet wrote: I am in the process of building my first app using Eclipse, and am preparing to start doing release builds. For example I am going through to make sure I have the right logging level for my log statements. But I do not really see how to produce a release build. For example in the documentation for Log ( http://developer.android.com/reference/android/util/Log.html) it says: Verbose should never be compiled into an application except during development. Debug logs are compiled in but stripped at runtime. Error, warning and info logs are always kept. It isn't clear to me how *I* do that or if that is done on my behalf when a release build is done... And to the last point there, I don't see where I actually do a release build... 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: use of audio streams
Since what I am doing is navigation, it should be heard over anything else (except phone calls). On Tuesday, March 27, 2012 1:43:22 PM UTC-4, lbendlin wrote: This entirely depends on how cooperative you want to be with the other applications on the device that may use the audio services at the same time. On Tuesday, March 27, 2012 11:09:26 AM UTC-4, RedBullet wrote: I am building an app that will do TTS to read turn by turn directions for navigation. When I am using a bluetooth headset I turn on SCO and use the STREAM_VOICE_CALLhttp://developer.android.com/reference/android/media/AudioManager.html#STREAM_VOICE_CALL stream. My question is, when I am NOT using bluetooth and just want to use the phone (optionally speaker) which stream do I use? STREAM_MUSIChttp://developer.android.com/reference/android/media/AudioManager.html#STREAM_MUSIC or something else? -- 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
Re: [android-developers] Re: use of audio streams
Back to the question please, how do I decide which stream I use? Or am I thinking of this incorrectly? The behavior I want is that I want my TTS to be heard. On Tuesday, March 27, 2012 5:01:05 PM UTC-4, lbendlin wrote: and they will be rather quick with the Uninstall button if they don't like the way your app does it. On Tuesday, March 27, 2012 2:16:58 PM UTC-4, Kristopher Micinski wrote: I think people would all make similar arguments for their applications, however.. (mp3 players, etc..) kris On Tue, Mar 27, 2012 at 1:49 PM, RedBullet wrote: Since what I am doing is navigation, it should be heard over anything else (except phone calls). On Tuesday, March 27, 2012 1:43:22 PM UTC-4, lbendlin wrote: This entirely depends on how cooperative you want to be with the other applications on the device that may use the audio services at the same time. On Tuesday, March 27, 2012 11:09:26 AM UTC-4, RedBullet wrote: I am building an app that will do TTS to read turn by turn directions for navigation. When I am using a bluetooth headset I turn on SCO and use the STREAM_VOICE_CALL stream. My question is, when I am NOT using bluetooth and just want to use the phone (optionally speaker) which stream do I use? STREAM_MUSIC or something else? -- -- 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: Transitioning from debug to release builds
I guess I don't understand what the documentation means when it says Debug logs are compiled in but stripped at runtime it implies there is some processing that takes place. If the answer is that the developer should comment out or otherwise remove Verbose/Debug log statements it seems like it should just say so? On Tuesday, March 27, 2012 12:45:15 PM UTC-4, Chris Pearson wrote: Creating a release build doesn't remove the Log messages. It would be nice to be able to disable them automatically that way, though. On Mar 27, 8:22 am, RedBullet scottedchap...@gmail.com wrote: In my app I have Warning, Debug, Information, and Verbose logging. They ALL see to get logged whether I am running, debugging, or running on the device (exported the app from eclipse and installed/run on my phone). On Tuesday, March 27, 2012 10:59:57 AM UTC-4, lbendlin wrote: if you are not yet ready to post to the market, you can also simply use Run rather than Debug in Eclipse. On Tuesday, March 27, 2012 10:55:26 AM UTC-4, MagouyaWare wrote: Export a signed .apk from eclipse... On Mar 27, 2012 6:47 AM, RedBullet wrote: I am in the process of building my first app using Eclipse, and am preparing to start doing release builds. For example I am going through to make sure I have the right logging level for my log statements. But I do not really see how to produce a release build. For example in the documentation for Log ( http://developer.android.com/reference/android/util/Log.html) it says: Verbose should never be compiled into an application except during development. Debug logs are compiled in but stripped at runtime. Error, warning and info logs are always kept. It isn't clear to me how *I* do that or if that is done on my behalf when a release build is done... And to the last point there, I don't see where I actually do a release build... 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
Re: [android-developers] Re: Transitioning from debug to release builds
Can you explain how I would proxy it? On Tuesday, March 27, 2012 9:22:07 PM UTC-4, Kristopher Micinski wrote: Right, but my point is that you can even do this without the ifs, as you probably don't want to put them all over your code, and a null method body will get optimized away. kris On Tue, Mar 27, 2012 at 9:19 PM, Nikolay Elenkov wrote: On Wed, Mar 28, 2012 at 10:13 AM, Kristopher Micinski wrote: You can also try proxying the logger class into your own, and in your implementation comment out the debug functions. The calls will simply be optimized away (even without JIT, Dalvik will remove these..) With ADT17 is as easy as: if (BuildConfig.DEBUG) { Log.d(TAG, foobar); } BuildConfig.DEBUG will be set to false when exporting a signed up, thus log statement will be removed from the release build. -- -- 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] Trying to detect is bluetooth headset is paired so I can know to route audio to it (using SCO)
So, I have an app which currently has a setting to enable/disable SCO routing. Is there a way for me to detect if there is a Bluetooth Headset paired (I can enumerate through the BT devices OK), and get any information on it? Like does it support SCO? -- 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 tell is Bluetooth SCO is available?
What's the proper way to determine is Bluetooth SCO is available? I am guessing that one just needs to call startBluetoothSco() and then listen for the status intent? -- 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't find my resources in my service...
So, I noticed something a little odd as I was refactoring my code. Basically I am moving a bunch of code from an activity to a service, and this included a Notification. In my notification I reference a String and an Icon which are both in my resources (R.drawable.myicon for example). When I moved this code to my Service class it was no longer able to resolve that path... Stumped... But must be missing something fundamental. -- 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 keep activity running
My application is a GPS nav type app. Needs to be running when I am doing a route. It appears that the system can decide to kill my process (I see onDestroy) get called for example. So, what's the right policy here, should I over-ride the onDestroy and just have it do nothing, but provide a way to manually kill the 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: How to keep activity running
Yea, I am basically using the activity as my application. Might need to refactor the whole damn thing, create a real Application, Service, and then activities... Maybe as a short-term hack I can just do nothing in my own activity (I already have an exit button). On Monday, March 19, 2012 9:39:41 AM UTC-4, RedBullet wrote: My application is a GPS nav type app. Needs to be running when I am doing a route. It appears that the system can decide to kill my process (I see onDestroy) get called for example. So, what's the right policy here, should I over-ride the onDestroy and just have it do nothing, but provide a way to manually kill the 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
Re: [android-developers] How to keep activity running
So, is there an example that shows how an Application class interacts with activities? My app to date is just activity based. Do I need to do anything aside from create a class derived from Application, store my own application state info in it, an update my manifest? Or do I need to more than that? (I'll read up on services, but I can find a ton of examples of those) On Monday, March 19, 2012 9:57:54 AM UTC-4, TreKing wrote: On Mon, Mar 19, 2012 at 8:55 AM, TreKing wrote: If you need to keep it from getting killed and need to interact with the user, you need an ongoing notification along with your Service. I should clarify that this still does not guarantee you won't be killed - it'll just make it less likely. - TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago transit tracking app for Android-powered devices -- 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
Re: [android-developers] How to keep activity running
Yea, I'll create a service to essentially do the route tracking when I am doing a route. I am wondering if it makes sense to contain all that state/logic in the service, or if I should put as much of the common state into an Application class, and let the activities/services access it through the application class. On Monday, March 19, 2012 12:18:57 PM UTC-4, TreKing wrote: On Mon, Mar 19, 2012 at 10:01 AM, RedBullet wrote: So, is there an example that shows how an Application class interacts with activities? Application doesn't really interact with Activities. You can of course add your own logic that does, but it's not necessary, particularly for what you've described as your use case. My app to date is just activity based. Do I need to do anything aside from create a class derived from Application, store my own application state info in it, an update my manifest? Or do I need to more than that? Yes. I really sounds like you need a Service, not an Application. See the Google Navigation app for a prime example. - TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago transit tracking app for Android-powered devices -- 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
Re: [android-developers] How to keep activity running
Yea, that is sort of where I am going too. It does seem like what the Application class is for... On Monday, March 19, 2012 12:54:12 PM UTC-4, TreKing wrote: On Mon, Mar 19, 2012 at 11:40 AM, RedBullet wrote: I am wondering if it makes sense to contain all that state/logic in the service, or if I should put as much of the common state into an Application class, and let the activities/services access it through the application class. Well, now you're getting into architecture questions for your business-specific logic, so that's really ultimately up to you. Personally, I would abstract that logic into its own class(es), which are then accessed from wherever they're needed, whether it be the background service the current foreground activity. As Singletons, perhaps? - TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago transit tracking app for Android-powered devices -- 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] Intent always restarts activity, even if already running...
So, I am creating a notification which, when selected, I would like to make my app the active app. But what it is doing instead is re-starting the app even though I know it is still running. Here is how I create the notification, I suspect I need to be more clever with the Intent: private void createNotification() { NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); Notification notification = new Notification(R.drawable.icon, A new notification, System.currentTimeMillis()); // Hide the notification after its selected notification.flags |= Notification.FLAG_AUTO_CANCEL; Intent intent = new Intent(this, RideRoutingActivity.class); PendingIntent activity = PendingIntent.getActivity(this, 0, intent, 0); notification.setLatestEventInfo(this, This is the title, This is the text, activity); notification.number += 1; notificationManager.notify(0, notification); } -- 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: Intent always restarts activity, even if already running...
OK, got it. Just needed the right notification flags... Thought it had to do with the intent! Sheesh! On Saturday, March 17, 2012 3:24:19 PM UTC-4, RedBullet wrote: So, I am creating a notification which, when selected, I would like to make my app the active app. But what it is doing instead is re-starting the app even though I know it is still running. Here is how I create the notification, I suspect I need to be more clever with the Intent: private void createNotification() { NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); Notification notification = new Notification(R.drawable.icon, A new notification, System.currentTimeMillis()); // Hide the notification after its selected notification.flags |= Notification.FLAG_AUTO_CANCEL; Intent intent = new Intent(this, RideRoutingActivity.class); PendingIntent activity = PendingIntent.getActivity(this, 0, intent, 0); notification.setLatestEventInfo(this, This is the title, This is the text, activity); notification.number += 1; notificationManager.notify(0, notification); } -- 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 leverage a specific API when available?
So, I had been developing an app to run on API 10, and when I switched to run it on API 7 noticed that AudioManager.startBluetoothSCO didn't exist... So, how do I handle that? I can just remove it form my code, but not sure if that means I just can't send audio to SCO in old versions of android. Is there a reasonable approach to leveraging a specific API function if I am running on an API that supports it? -- 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] newb-question - registering for intents
I am calling startBluetoothSCO and according to the docs, I should be waiting for the state change: As the SCO connection establishment can take several seconds, applications should not rely on the connection to be available when the method returns but instead register to receive the intentACTION_SCO_AUDIO_STATE_UPDATEDhttp://developer.android.com/reference/android/media/AudioManager.html#ACTION_SCO_AUDIO_STATE_UPDATED and wait for the state to be SCO_AUDIO_STATE_CONNECTEDhttp://developer.android.com/reference/android/media/AudioManager.html#SCO_AUDIO_STATE_CONNECTED . I am at a loss as to how to do that... -- 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 have a preference with no UI?
I have a bunch of preferences that I want the user to be able to set, but I also want to be able to store some values to keep between executions of my program. I didn't see a way to do this with shared preferences... Do I need to use something different?? -- 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
Re: [android-developers] Can I have a preference with no UI?
Thanks, I'll try that. I am using a PreferencesActivity to manage the display and updating of the values, and I created a preferences.xml that details it. So, I assume that I can programatically add/modify additional ones as you describe? On Wednesday, March 14, 2012 4:45:56 PM UTC-4, MagouyaWare wrote: String prefKey = my_pref_key; String prefVal = my_pref_value; SharedPreferences prefMgr = PreferenceManager.getDefaultSharedPreferences(context);Editor prefEdit = prefMgr.edit(); prefEdit.putString(prefKey, prefValue); prefEdit.commit(); Thanks, Justin Anderson MagouyaWare Developer http://sites.google.com/site/magouyaware On Wed, Mar 14, 2012 at 2:34 PM, RedBullet wrote: I have a bunch of preferences that I want the user to be able to set, but I also want to be able to store some values to keep between executions of my program. I didn't see a way to do this with shared preferences... Do I need to use something different?? -- -- 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
Re: [android-developers] How to get view for selected item in a ListView
So that brings up a really good point. I can think of a couple of circumstances when the item I want to modify might not have been rendered yet so there may not be a view for it. Is there a way to have it rendered so I can get the view? Or possibly, since this is not a large list, for the entire list to be rendered? On Friday, March 9, 2012 5:31:36 PM UTC-5, Kostya Vasilyev wrote: On 03/10/2012 02:25 AM, RedBullet wrote: Zactlee. When I load up the view, I want it starting from the first item on the list... At this point, the list view doesn't have any children yet, it has not been layed out on the screen. Or, putting it differently, ListView doesn't start drinking before 11am :) -- Kostya -- 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
Re: [android-developers] How to get view for selected item in a ListView
Any guidance on implementing step #1? There must be a tutorial or example I can look at? Thanks in advance! On Saturday, March 10, 2012 8:41:53 AM UTC-5, Mark Murphy (a Commons Guy) wrote: On Sat, Mar 10, 2012 at 8:15 AM, RedBullet wrote: So that brings up a really good point. I can think of a couple of circumstances when the item I want to modify might not have been rendered yet so there may not be a view for it. Is there a way to have it rendered so I can get the view? Or possibly, since this is not a large list, for the entire list to be rendered? Step #1: Teach your *adapter* how to tailor the views based upon state Step #2: Call notifyDataSetChanged() on the adapter whenever that state changes Never never never never never never never adjust Views in an AdapterView *except via the adapter*. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy _Android Programming Tutorials_ Version 4.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
Re: [android-developers] How to get view for selected item in a ListView
Awesome. Where can I buy your book? Seriously? On Saturday, March 10, 2012 9:28:04 AM UTC-5, Mark Murphy (a Commons Guy) wrote: On Sat, Mar 10, 2012 at 9:09 AM, RedBullet wrote: Any guidance on implementing step #1? There must be a tutorial or example I can look at? http://commonsware.com/Android/excerpt.pdf -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy _Android Programming Tutorials_ Version 4.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] How to get view for selected item in a ListView
So, I have a class that implements ListActivity, and it loads up a a list of turns for turn-by-turn navigation. Essentially I want to decorate the item that is the next waypoint in the list, and when you arrive, de-decorate and decorate the next waypoint in the list. So, I have been noodling this, but haven't figured out how to do this yet. I know I can call setSelected(int) to say which item is the current one, but I don't see how I can get the view associated with the currently selected item. I don't think getView is right since I am not populating the ListView. Any ideas? -- 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
Re: [android-developers] How to get view for selected item in a ListView
Really? So, if I have 100 items in my ListView, and I want to be monkeying around with item #50 I would do: getListView().getChild(getListView().getFirstVisiblePosition() - 50)) ? that doesn't seem right... On Friday, March 9, 2012 2:42:29 PM UTC-5, MagouyaWare wrote: Didn't mean to send that yet... You can calculate the correct index by using this: http://developer.android.com/reference/android/widget/AdapterView.html#getFirstVisiblePosition%28%29 You subtract the position in the adapter from the first visible position. Thanks, Justin Anderson MagouyaWare Developer http://sites.google.com/site/magouyaware On Fri, Mar 9, 2012 at 12:41 PM, Justin Anderson wrote: Try using this: http://developer.android.com/reference/android/view/ViewGroup.html#getChildAt%28int%29 However, beware that the child index is not necessarily the same as the position of the item in the ArrayAdapter due to view recycling. But you can get the correct index Thanks, Justin Anderson MagouyaWare Developer http://sites.google.com/site/magouyaware On Fri, Mar 9, 2012 at 12:32 PM, RedBullet wrote: So, I have a class that implements ListActivity, and it loads up a a list of turns for turn-by-turn navigation. Essentially I want to decorate the item that is the next waypoint in the list, and when you arrive, de-decorate and decorate the next waypoint in the list. So, I have been noodling this, but haven't figured out how to do this yet. I know I can call setSelected(int) to say which item is the current one, but I don't see how I can get the view associated with the currently selected item. I don't think getView is right since I am not populating the ListView. Any ideas? -- -- 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
Re: [android-developers] How to get view for selected item in a ListView
OK, so here is my code snipet: RouteAdapter adapter = new RouteAdapter(this, route.getCues()); setListAdapter(adapter); setSelection(); } public void setSelection() { RouteAdapter adapter = (RouteAdapter) getListAdapter(); Integer index = adapter.getPosition(nextCuePoint); View itemView = this.getListView().getChildAt(index - getListView().getFirstVisiblePosition()); The position of the nextCuePoint is 0 (which is correct since it is the first cue). But I am getting null for itemView... On Friday, March 9, 2012 3:11:21 PM UTC-5, Kostya Vasilyev wrote: The children are always numbered starting at 0. The top position may correspond to, erm, 1812'th adapter item, and still be the zero'th child. int nFirst = mAccountListView.getFirstVisiblePosition(); int nLast = mAccountListView.getLastVisiblePosition(); for (int position = nFirst; position = nLast; ++position) { View itemView = mAccountListView.getChildAt(position - nFirst); ... On 03/10/2012 12:03 AM, RedBullet wrote: Really? So, if I have 100 items in my ListView, and I want to be monkeying around with item #50 I would do: getListView().getChild(getListView().getFirstVisiblePosition() - 50)) ? that doesn't seem right... -- 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
Re: [android-developers] How to get view for selected item in a ListView
Good question; I'll have to check later, but I know index was 0. On Friday, March 9, 2012 3:27:08 PM UTC-5, MagouyaWare wrote: What is the value of index - getListView().getFirstVisiblePosition()? Thanks, Justin Anderson MagouyaWare Developer http://sites.google.com/site/magouyaware On Fri, Mar 9, 2012 at 1:21 PM, RedBullet wrote: OK, so here is my code snipet: RouteAdapter adapter = new RouteAdapter(this, route.getCues()); setListAdapter(adapter); setSelection(); } public void setSelection() { RouteAdapter adapter = (RouteAdapter) getListAdapter(); Integer index = adapter.getPosition(nextCuePoint); View itemView = this.getListView().getChildAt(index - getListView().getFirstVisiblePosition()); The position of the nextCuePoint is 0 (which is correct since it is the first cue). But I am getting null for itemView... On Friday, March 9, 2012 3:11:21 PM UTC-5, Kostya Vasilyev wrote: The children are always numbered starting at 0. The top position may correspond to, erm, 1812'th adapter item, and still be the zero'th child. int nFirst = mAccountListView.**getFirstVisiblePosition(); int nLast = mAccountListView.**getLastVisiblePosition(); for (int position = nFirst; position = nLast; ++position) { View itemView = mAccountListView.getChildAt(**position - nFirst); ... On 03/10/2012 12:03 AM, RedBullet wrote: Really? So, if I have 100 items in my ListView, and I want to be monkeying around with item #50 I would do: getListView().getChild(**getListView().**getFirstVisiblePosition() - 50)) ? that doesn't seem right... -- -- 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
Re: [android-developers] How to get view for selected item in a ListView
And the answer is 0 On Friday, March 9, 2012 3:27:08 PM UTC-5, MagouyaWare wrote: What is the value of index - getListView().getFirstVisiblePosition()? Thanks, Justin Anderson MagouyaWare Developer http://sites.google.com/site/magouyaware On Fri, Mar 9, 2012 at 1:21 PM, RedBullet wrote: OK, so here is my code snipet: RouteAdapter adapter = new RouteAdapter(this, route.getCues()); setListAdapter(adapter); setSelection(); } public void setSelection() { RouteAdapter adapter = (RouteAdapter) getListAdapter(); Integer index = adapter.getPosition(nextCuePoint); View itemView = this.getListView().getChildAt(index - getListView().getFirstVisiblePosition()); The position of the nextCuePoint is 0 (which is correct since it is the first cue). But I am getting null for itemView... On Friday, March 9, 2012 3:11:21 PM UTC-5, Kostya Vasilyev wrote: The children are always numbered starting at 0. The top position may correspond to, erm, 1812'th adapter item, and still be the zero'th child. int nFirst = mAccountListView.**getFirstVisiblePosition(); int nLast = mAccountListView.**getLastVisiblePosition(); for (int position = nFirst; position = nLast; ++position) { View itemView = mAccountListView.getChildAt(**position - nFirst); ... On 03/10/2012 12:03 AM, RedBullet wrote: Really? So, if I have 100 items in my ListView, and I want to be monkeying around with item #50 I would do: getListView().getChild(**getListView().**getFirstVisiblePosition() - 50)) ? that doesn't seem right... -- 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
Re: [android-developers] How to get view for selected item in a ListView
Zactlee. When I load up the view, I want it starting from the first item on the list... On Friday, March 9, 2012 5:02:34 PM UTC-5, Kostya Vasilyev wrote: Are you doing this from onCreate? On 03/10/2012 02:00 AM, RedBullet wrote: And the answer is 0 On Friday, March 9, 2012 3:27:08 PM UTC-5, MagouyaWare wrote: What is the value of index - getListView().getFirstVisiblePosition()? Thanks, Justin Anderson MagouyaWare Developer http://sites.google.com/site/magouyaware On Fri, Mar 9, 2012 at 1:21 PM, RedBullet wrote: OK, so here is my code snipet: RouteAdapter adapter = new RouteAdapter(this, route.getCues()); setListAdapter(adapter); setSelection(); } public void setSelection() { RouteAdapter adapter = (RouteAdapter) getListAdapter(); Integer index = adapter.getPosition(nextCuePoint); View itemView = this.getListView().getChildAt(index - getListView().getFirstVisiblePosition()); The position of the nextCuePoint is 0 (which is correct since it is the first cue). But I am getting null for itemView... On Friday, March 9, 2012 3:11:21 PM UTC-5, Kostya Vasilyev wrote: The children are always numbered starting at 0. The top position may correspond to, erm, 1812'th adapter item, and still be the zero'th child. int nFirst = mAccountListView.getFirstVisiblePosition(); int nLast = mAccountListView.getLastVisiblePosition(); for (int position = nFirst; position = nLast; ++position) { View itemView = mAccountListView.getChildAt(position - nFirst); ... On 03/10/2012 12:03 AM, RedBullet wrote: Really? So, if I have 100 items in my ListView, and I want to be monkeying around with item #50 I would do: getListView().getChild(getListView().getFirstVisiblePosition() - 50)) ? that doesn't seem right... -- -- 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
Re: [android-developers] How to get view for selected item in a ListView
Yea so i guess i need to figure how ti initialize this differently... -- 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] Looking for LocationManager use for cycling app
I am writing an app that will will follow a route on the map, very similar to a car navigation (except that it is following a specific route, not simply trying to get to a location). What I am interested in is what would you recommend regarding which provider to use, and what criteria to use when listening for location changes. Overall what I need to do is the following: 1. Announce when I am off course by about 100 meters 2. Announce when I am approaching a turn by about 100-200 meters 3. go to the next waypoint when I arrive at a turn (about 50 meters) 4. cyclists ride about 10-30 MPH 5. Rides generally last 3-8 hours (so think battery power). Right now I am doing this: locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); Criteria criteria = new Criteria(); criteria.setAccuracy(Criteria.ACCURACY_COARSE); criteria.setPowerRequirement(Criteria.POWER_LOW); provider = locationManager.getBestProvider(criteria, false); locationManager.requestLocationUpdates( provider, MINIMUM_TIME_BETWEEN_UPDATES, MINIMUM_DISTANCE_CHANGE_FOR_UPDATES, this ); Where min time is 5000 and min distance is 10 Any other recommendations? Like should I just always pick GPS for provider? Or other strategies? 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] Problem with SAX parser on large XML files?
I have been debugging this for a while now, and I can only reproduce it when I run in the Android environment (emulator or device), but not reproducible in plain old java. The behavior is that I am just PART of a fragment instead of the entire element. For example Longitude-71.41000482232/Longitude What I actually get is just 1000482232. My characters function is the basic: public void characters(char[] ch, int start, int length) throws SAXException { tempVal = new String(ch,start,length); } No errors or exceptions or warning or anything... It is as if it is doing buffering since it appear to give me fragments after parsing some 2-4k lines of XML. Any ideas?? -- 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: Problem with SAX parser on large XML files?
I am talking about what I see when endELement event occurs. I end up with tempVal containing a partial element. Is there some example I can see that does a proper job? Virtually every example I have seen seems to be making the same assumption I am... On Tuesday, March 6, 2012 4:20:10 PM UTC-5, Lew wrote: SAX parsers, such as you appear to be using, do not guarantee to give all the character data for a given element in a single callback to 'characters()'. Your logic that assumes otherwise is fatally flawed. You're not guaranteed to have processed the whole element until 'endElement()', of course. -- Lew On Tuesday, March 6, 2012 1:09:57 PM UTC-8, RedBullet wrote: I have been debugging this for a while now, and I can only reproduce it when I run in the Android environment (emulator or device), but not reproducible in plain old java. The behavior is that I am just PART of a fragment instead of the entire element. For example Longitude-71.41000482232/Longitude What I actually get is just 1000482232. My characters function is the basic: public void characters(char[] ch, int start, int length) throws SAXException { tempVal = new String(ch,start,length); } No errors or exceptions or warning or anything... It is as if it is doing buffering since it appear to give me fragments after parsing some 2-4k lines of XML. Any ideas?? -- 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
Re: [android-developers] Re: Problem with SAX parser on large XML files?
Got it, so if I turn my characters method into an accumulator and make sure I reset it either in startElement or endElement (as appropriate) I should be good? On Tuesday, March 6, 2012 5:05:18 PM UTC-5, Mark Murphy (a Commons Guy) wrote: On Tue, Mar 6, 2012 at 4:52 PM, RedBullet wrote: I am talking about what I see when endELement event occurs. I end up with tempVal containing a partial element. Correct. That is because your implementation is buggy. You may be called with characters() several times for an element's text node(s), and you are only holding onto the last value. Use StringBuilder or something to concatenate your results. Is there some example I can see that does a proper job? Virtually every example I have seen seems to be making the same assumption I am... http://stackoverflow.com/questions/4567636/java-sax-parser-split-calls-to-characters http://stackoverflow.com/questions/4511955/sax-parser-issue http://stackoverflow.com/questions/3201918/sax-parsing-in-android http://stackoverflow.com/questions/8635414/sax-parser-returns-first-character-of-the-title -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Android Training in NYC: http://marakana.com/training/android/ -- 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: Looking for LocationManager use for cycling app
Generally out in the country. On Tuesday, March 6, 2012 5:07:36 PM UTC-5, lbendlin wrote: you are not saying where they are riding the bike. Network location services work MUCH better in densely populated areas than out in the country. On Tuesday, March 6, 2012 1:16:00 PM UTC-5, RedBullet wrote: I am writing an app that will will follow a route on the map, very similar to a car navigation (except that it is following a specific route, not simply trying to get to a location). What I am interested in is what would you recommend regarding which provider to use, and what criteria to use when listening for location changes. Overall what I need to do is the following: 1. Announce when I am off course by about 100 meters 2. Announce when I am approaching a turn by about 100-200 meters 3. go to the next waypoint when I arrive at a turn (about 50 meters) 4. cyclists ride about 10-30 MPH 5. Rides generally last 3-8 hours (so think battery power). Right now I am doing this: locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); Criteria criteria = new Criteria(); criteria.setAccuracy(Criteria.ACCURACY_COARSE); criteria.setPowerRequirement(Criteria.POWER_LOW); provider = locationManager.getBestProvider(criteria, false); locationManager.requestLocationUpdates( provider, MINIMUM_TIME_BETWEEN_UPDATES, MINIMUM_DISTANCE_CHANGE_FOR_UPDATES, this ); Where min time is 5000 and min distance is 10 Any other recommendations? Like should I just always pick GPS for provider? Or other strategies? 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
Re: [android-developers] Re: Problem with SAX parser on large XML files?
I may not have this problem with the XML structure I am interested in parsing, but I imagine one could run into issues if there are nested elements being parsed: body got some text here authorme/author /body I am guessing I would have to be clever and maintain multiple accumulators for each element when it is started (until I get the endElement). On Tuesday, March 6, 2012 5:47:03 PM UTC-5, Mark Murphy (a Commons Guy) wrote: On Tue, Mar 6, 2012 at 5:41 PM, RedBullet wrote: Got it, so if I turn my characters method into an accumulator and make sure I reset it either in startElement or endElement (as appropriate) I should be good? AFAIK, yes. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Android Training in NYC: http://marakana.com/training/android/ -- 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: Looking for LocationManager use for cycling app
Not necessarily. In most of New England here we have network coverage. So, I get that network location services have lower power requirements. What about the other parameters? Like how often to be notified (either min time or min distance) do those affect power usage in any significant way for an app like this? What's a good strategy here? On Tuesday, March 6, 2012 6:42:00 PM UTC-5, lbendlin wrote: so - GPS it is. Tell them to bring a spare battery. On Tuesday, March 6, 2012 5:45:20 PM UTC-5, RedBullet wrote: Generally out in the country. On Tuesday, March 6, 2012 5:07:36 PM UTC-5, lbendlin wrote: you are not saying where they are riding the bike. Network location services work MUCH better in densely populated areas than out in the country. On Tuesday, March 6, 2012 1:16:00 PM UTC-5, RedBullet wrote: I am writing an app that will will follow a route on the map, very similar to a car navigation (except that it is following a specific route, not simply trying to get to a location). What I am interested in is what would you recommend regarding which provider to use, and what criteria to use when listening for location changes. Overall what I need to do is the following: 1. Announce when I am off course by about 100 meters 2. Announce when I am approaching a turn by about 100-200 meters 3. go to the next waypoint when I arrive at a turn (about 50 meters) 4. cyclists ride about 10-30 MPH 5. Rides generally last 3-8 hours (so think battery power). Right now I am doing this: locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); Criteria criteria = new Criteria(); criteria.setAccuracy(Criteria.ACCURACY_COARSE); criteria.setPowerRequirement(Criteria.POWER_LOW); provider = locationManager.getBestProvider(criteria, false); locationManager.requestLocationUpdates( provider, MINIMUM_TIME_BETWEEN_UPDATES, MINIMUM_DISTANCE_CHANGE_FOR_UPDATES, this ); Where min time is 5000 and min distance is 10 Any other recommendations? Like should I just always pick GPS for provider? Or other strategies? 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
Re: [android-developers] Re: Looking for LocationManager use for cycling app
OK, got it. So, if I am going to use GPS, are there any good strategies for conserving power? Do the update intervals make any difference? Or is the drain going to be the same because the radio is essentially on? On Tuesday, March 6, 2012 7:07:45 PM UTC-5, Mark Murphy (a Commons Guy) wrote: On Tue, Mar 6, 2012 at 6:55 PM, RedBullet wrote: Not necessarily. In most of New England here we have network coverage. Not with anything vaguely resembling the accuracy you seek. Network provider, in the form of cell tower triangulation, is good for a 1km or so. The only technology that presently exists that can give you 50m accuracy is GPS. Galileo, perhaps, in a few years, maybe, if it happens, but that's not today. WiFi hotspot proximity can also do pretty good, but that's not likely to be useful in your scenario. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Android Training in NYC: http://marakana.com/training/android/ -- 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
Re: [android-developers] Re: Looking for LocationManager use for cycling app
I suppose another thing I could do is pick a provider based on how far away I am from the next waypoint and switch to GPS when I am less than 1KM. Does proximityAlerts help in this case? On Tuesday, March 6, 2012 7:30:19 PM UTC-5, RedBullet wrote: OK, got it. So, if I am going to use GPS, are there any good strategies for conserving power? Do the update intervals make any difference? Or is the drain going to be the same because the radio is essentially on? On Tuesday, March 6, 2012 7:07:45 PM UTC-5, Mark Murphy (a Commons Guy) wrote: On Tue, Mar 6, 2012 at 6:55 PM, RedBullet wrote: Not necessarily. In most of New England here we have network coverage. Not with anything vaguely resembling the accuracy you seek. Network provider, in the form of cell tower triangulation, is good for a 1km or so. The only technology that presently exists that can give you 50m accuracy is GPS. Galileo, perhaps, in a few years, maybe, if it happens, but that's not today. WiFi hotspot proximity can also do pretty good, but that's not likely to be useful in your scenario. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Android Training in NYC: http://marakana.com/training/android/ -- 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
Re: [android-developers] Re: Looking for LocationManager use for cycling app
I guess the question is do they do anything fancy resembling magic in an effort to be power frugal? I suspect it is just a convenience... On Tuesday, March 6, 2012 7:56:53 PM UTC-5, Mark Murphy (a Commons Guy) wrote: On Tue, Mar 6, 2012 at 7:44 PM, RedBullet wrote: I suppose another thing I could do is pick a provider based on how far away I am from the next waypoint and switch to GPS when I am less than 1KM. Does proximityAlerts help in this case? They can. They will let you know when you get near a point. They, of course, are limited by the accuracy of your chosen provider. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Android Training in NYC: http://marakana.com/training/android/ -- 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
Re: [android-developers] Re: Looking for LocationManager use for cycling app
I am seeing some evidence that folks are able to use MyTracks to track a long bike ride. So, I might do some testing with it to make sure that is the case (recommendation is to turn off things you don't need, like wifi, bluetooth, and switch to 2G are among the recommendations. Though Airplane mode was also recommended). If that works out reasonably well, then I guess I can assume I shouldn't worry so much about it? On Tuesday, March 6, 2012 7:42:34 PM UTC-5, Mark Murphy (a Commons Guy) wrote: On Tue, Mar 6, 2012 at 7:30 PM, RedBullet wrote: OK, got it. So, if I am going to use GPS, are there any good strategies for conserving power? Do the update intervals make any difference? Or is the drain going to be the same because the radio is essentially on? In theory, a longer minTime may be used by Android to power down the GPS in between checks. In practice, I don't know how big of an effect it has. And, for any sort of navigation-type app, I'd be hesitant to make too many assumptions. For example, you're assuming a fairly slow cyclist speed, and there are some faster cyclists than that, but your app might be used by people riding Vespas, motorcycles, etc. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Android Training in NYC: http://marakana.com/training/android/ -- 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] Routing TTS to SCO bluetooth headset
I am trying to get my android app to use the TTS engine to send the audio to my old BT headset. I have tried starting SCO, then setting it to on. Nothing. Audio still comes out the speakers... Anyone ever done this? I am sure there is just something I am missing... -- 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