[android-developers] IllegalStateException: No wrapped connection.
Hi, I'm trying to send an HTTP request from a WakefulService so a Service which has been started from an alarm set up with AlarmManager and I get the error: IllegalStateException: No wrapped connection. HttpGet httpGet = (HttpGet) new HttpGet(MYRequestHelper.getRequest(this)); HttpClient client = ((MYApplication) getApplication()).getHttpClient(); String response; try { response = client.execute(httpGet, new BasicResponseHandler()); At this point I run through parsing JSON and creating new HttpGets and executing them on the client. Is it possible I running execute too many times on the client or something? I'm don't really understand what the error means and I haven't been able to glean anything much from Googling other than to catch it and hope for the best. Cheers, Julius. -- 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: Is it possible to run multiple Broadcast receivers for the same Intent in the same application?
On Oct 25, 4:12 pm, Some Coder somecoder...@gmail.com wrote: Is it possible to register multiple BroadcastReceivers for the same Intent in the same application and have them all run? You might want to read the documentation for BroadcastReceiver, understand the different between normal and ordered broadcasts, and find out which one the third party is generating. My guess is that it's generating an ordered broadcast and sometimes its own receiver is catching it first and aborting it. I don't think it's a good idea to re-broadcast normal broadcasts, because I imagine your receiver and any others could get called more than once (or even infinitely?!) if you're not careful. And I don't think it's possible to force yourself to receive an ordered broadcast if it was aborted upstream. Doug -- 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] IllegalStateException: No wrapped connection.
There is something messed up with your HttpClient object. That exception is being raised by HttpClient itself, based upon what I can see in the Android source code. Bear in mind that, in the case of an alarm, your process hopefully was terminated/recycled since the last alarm, and so there is little value in attempting to reuse some global HttpClient here. I'd just create a new one. Also, bear in mind that all IntentServices do their work on a background thread, and HttpClient is not thread-safe by default. It's possible this error is tied to that. You need to hook up a ThreadSafeClientConnManager to the HttpClient object if you will reuse it across multiple threads. On Sun, Oct 31, 2010 at 2:14 AM, Julius Spencer jul...@msa.co.nz wrote: Hi, I'm trying to send an HTTP request from a WakefulService so a Service which has been started from an alarm set up with AlarmManager and I get the error: IllegalStateException: No wrapped connection. HttpGet httpGet = (HttpGet) new HttpGet(MYRequestHelper.getRequest(this)); HttpClient client = ((MYApplication) getApplication()).getHttpClient(); String response; try { response = client.execute(httpGet, new BasicResponseHandler()); At this point I run through parsing JSON and creating new HttpGets and executing them on the client. Is it possible I running execute too many times on the client or something? I'm don't really understand what the error means and I haven't been able to glean anything much from Googling other than to catch it and hope for the best. Cheers, Julius. -- 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 -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Android 2.2 Programming Books: http://commonsware.com/books -- 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 different do the broadcast Intents need to be?
On Oct 30, 12:18 pm, Mark Murphy mmur...@commonsware.com wrote: I know I've read about this behavior in this forum in the past but I can't find in the documentation where this duplicate elimination logic is described in detail. Mostly, I just want to differentiate the Intents enough that they are not considered duplicates. Any pointers would be appreciated. I believe that Android uses filterEquals() on Intent to determine if two Intents are equivalent for this purpose. From the documentation: Determine if two intents are the same for the purposes of intent resolution (filtering). That is, if their action, data, type, class, and categories are the same. This does not compare any extra data included in the intents. To be fair, the javadoc for Intent.filterEquals() says nothing about if or when a broadcast intent would be dropped for any reason. Or do you think it's implied? It's strange because I just authored an IntentService yesterday that does work on command, then broadcasts an intent with an action and a single extra which varies based on the work done. As far as I can tell, no intents are being dropped from broadcast, and that's what I'd expect, unless I misunderstand the behavior that Bret is observing. Doug -- 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: How different do the broadcast Intents need to be?
On Sun, Oct 31, 2010 at 3:01 AM, Doug beafd...@gmail.com wrote: To be fair, the javadoc for Intent.filterEquals() says nothing about if or when a broadcast intent would be dropped for any reason. Or do you think it's implied? Whoops. I misread the original question, thinking we were talking abound PendingIntents. Those can have the appearance of being dropped, where the second PendingIntent really is just a reference to the first one, ignoring any changes in extras. It's strange because I just authored an IntentService yesterday that does work on command, then broadcasts an intent with an action and a single extra which varies based on the work done. As far as I can tell, no intents are being dropped from broadcast, and that's what I'd expect, unless I misunderstand the behavior that Bret is observing. Yes, I am not aware of broadcasts being dropped because of equivalence. My apologies for fouling up my original answer. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Android 2.2 Programming Books: http://commonsware.com/books -- 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.2.1 / N1 / USB Dropping
On Oct 30, 2:34 am, Pent tas...@dinglisch.net wrote: Anyone else ? +1 and annoyed by it. I always have to reboot to restore this functionality. But I honestly can't say if there's a correlation with 2.2.1. -- 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] One process, two live Application objects?
In a comment on an epic StackOverflow question-and-answer, a gentleman who I will call Tim has outlined a scenario he says he is running into, one I have some difficulty believing. Reading somewhat between the lines, the flow would appear to be this: 1. User taps on an activity icon in the launcher 2. Process starts up 3. Application object is put in that process -- and a custom Application object loads an NDK library which initializes some statics/singletons 4. User uses application 5. User abandons application (e.g., HOME) 6. Later, user returns to application, before the first process is killed or recycled for use with another app 7. A second Application object is created, in the same process, before the first Application object is called with onTerminate() This screws things up for Tim's app -- apparently, it does not deal with pre-initialized statics/singletons well. They were presumably counting on onTerminate() to let them clean up the NDK space. As a result, they are relying upon killProcess() (somehow...unclear under what conditions they might call this) to force their own process to go away, so their statics get cleaned up. Step #7 is what confuses me. I can see a new Application object being created, but only if the first Application object were terminated. I don't see any NDK-related bugs out on b.android.com that seem to match this complaint, though in principle it might cause problems for non-NDK apps as well. Has anyone encountered a new Application object being created in a process before the old one is terminated? Thanks! -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Android 2.2 Programming Books: http://commonsware.com/books -- 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 do i create a donate menu button
Can you explain more I am still new to this mixture I have not worked with browser activity On Oct 30, 11:26 am, Kumar Bibek coomar@gmail.com wrote: You need to have Internet permission. Instead of using thewebview, you are better off using the Bowser activity for this. On Sat, Oct 30, 2010 at 11:23 PM, Raziel23x raziel...@gmail.com wrote: I am having trouble creating a donate menu button but I am having trouble I tried doing it as a webview but my application is the use of the listview this Donation Menu item is the only item that requires the internet permission everything else is internal workings. [CODE]private static final int MENU_DONATE = 0;[/CODE] [CODE] /* Creates the menu items */ public boolean onCreateOptionsMenu(Menu menu) { menu.add(0, MENU_DONATE, 0, Home); return true; } /* Handles item selections */ �...@override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case MENU_DONATE: myweb.loadUrl( https://www.paypal.com/cgi-bin/webscr?cmd=_s- xclickhosted_button_id=A2L64XS44ZQ9S); return true; } return true; }[/CODE] but it is not working and giving me errors what do i need to fix this and get it to work correctly -- 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%2Bunsubs cr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Kumar Bibekhttp://techdroid.kbeanie.comhttp://www.kbeanie.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
Re: [android-developers] IllegalStateException: No wrapped connection.
Wow thank you Mark. I'll try to implement those changes. Regards, Julius. On 31/10/2010, at 7:56 PM, Mark Murphy wrote: There is something messed up with your HttpClient object. That exception is being raised by HttpClient itself, based upon what I can see in the Android source code. Bear in mind that, in the case of an alarm, your process hopefully was terminated/recycled since the last alarm, and so there is little value in attempting to reuse some global HttpClient here. I'd just create a new one. Also, bear in mind that all IntentServices do their work on a background thread, and HttpClient is not thread-safe by default. It's possible this error is tied to that. You need to hook up a ThreadSafeClientConnManager to the HttpClient object if you will reuse it across multiple threads. On Sun, Oct 31, 2010 at 2:14 AM, Julius Spencer jul...@msa.co.nz wrote: Hi, I'm trying to send an HTTP request from a WakefulService so a Service which has been started from an alarm set up with AlarmManager and I get the error: IllegalStateException: No wrapped connection. HttpGet httpGet = (HttpGet) new HttpGet(MYRequestHelper.getRequest(this)); HttpClient client = ((MYApplication) getApplication()).getHttpClient(); String response; try { response = client.execute(httpGet, new BasicResponseHandler()); At this point I run through parsing JSON and creating new HttpGets and executing them on the client. Is it possible I running execute too many times on the client or something? I'm don't really understand what the error means and I haven't been able to glean anything much from Googling other than to catch it and hope for the best. Cheers, Julius. -- 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 -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Android 2.2 Programming Books: http://commonsware.com/books -- 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 -- 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] AdMob Analytics?
Is anyone using AdMob analytics to track location and events in their app? I haven't been able to find any Android relevant info for the (AdMob) analytics side of things. Can someone please point me in the right direction? Alternatively, what are you using to track location and event data? -- 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] One process, two live Application objects?
I don't have an answer to your actual question, however - wouldn't it be more reliable to initialize native code from a static block? class MyApplication extends Application { private native void initializeNativeSide(); static { initializeNativeSide(); } } -- Kostya 31.10.2010 10:34, Mark Murphy пишет: In a comment on an epic StackOverflow question-and-answer, a gentleman who I will call Tim has outlined a scenario he says he is running into, one I have some difficulty believing. Reading somewhat between the lines, the flow would appear to be this: 1. User taps on an activity icon in the launcher 2. Process starts up 3. Application object is put in that process -- and a custom Application object loads an NDK library which initializes some statics/singletons 4. User uses application 5. User abandons application (e.g., HOME) 6. Later, user returns to application, before the first process is killed or recycled for use with another app 7. A second Application object is created, in the same process, before the first Application object is called with onTerminate() This screws things up for Tim's app -- apparently, it does not deal with pre-initialized statics/singletons well. They were presumably counting on onTerminate() to let them clean up the NDK space. As a result, they are relying upon killProcess() (somehow...unclear under what conditions they might call this) to force their own process to go away, so their statics get cleaned up. Step #7 is what confuses me. I can see a new Application object being created, but only if the first Application object were terminated. I don't see any NDK-related bugs out on b.android.com that seem to match this complaint, though in principle it might cause problems for non-NDK apps as well. Has anyone encountered a new Application object being created in a process before the old one is terminated? Thanks! -- Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.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
Re: [android-developers] One process, two live Application objects?
Well, in Tim's case, that static block would only be fired once, presumably. If Application instance B is created before Application instance A is terminated, then we're still talking the same VM, and so the static initializer would have been run when A was created and would not be re-run when B is created. I suppose the real problem might be that A is *never* being terminated, despite the process being recycled, though I haven't seen any signs of that occurring, either. This might occur if Android is recycling the process but not the VM, for example. I suspect that Tim can work around his problem via passing the Application object to his NDK library and detecting a change in that object (e.g., different hashCode()), reinitializing his statics when that occurs. On Sun, Oct 31, 2010 at 4:24 AM, Kostya Vasilyev kmans...@gmail.com wrote: I don't have an answer to your actual question, however - wouldn't it be more reliable to initialize native code from a static block? class MyApplication extends Application { private native void initializeNativeSide(); static { initializeNativeSide(); } } -- Kostya 31.10.2010 10:34, Mark Murphy пишет: In a comment on an epic StackOverflow question-and-answer, a gentleman who I will call Tim has outlined a scenario he says he is running into, one I have some difficulty believing. Reading somewhat between the lines, the flow would appear to be this: 1. User taps on an activity icon in the launcher 2. Process starts up 3. Application object is put in that process -- and a custom Application object loads an NDK library which initializes some statics/singletons 4. User uses application 5. User abandons application (e.g., HOME) 6. Later, user returns to application, before the first process is killed or recycled for use with another app 7. A second Application object is created, in the same process, before the first Application object is called with onTerminate() This screws things up for Tim's app -- apparently, it does not deal with pre-initialized statics/singletons well. They were presumably counting on onTerminate() to let them clean up the NDK space. As a result, they are relying upon killProcess() (somehow...unclear under what conditions they might call this) to force their own process to go away, so their statics get cleaned up. Step #7 is what confuses me. I can see a new Application object being created, but only if the first Application object were terminated. I don't see any NDK-related bugs out on b.android.com that seem to match this complaint, though in principle it might cause problems for non-NDK apps as well. Has anyone encountered a new Application object being created in a process before the old one is terminated? Thanks! -- Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.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 -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Android 2.2 Programming Books: http://commonsware.com/books -- 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] One process, two live Application objects?
Right, a static block runs only once. And is guaranteed to run in this case, since Android is going to instantiate MyApplication. You wrote in the original email that the native side needs to initialize some statics and singletons. Those should only be initialized once, so a static block works here. As for terminating those singletons - presumably, they can be left around until Android kills and cleans up the entire process. -- Kostya 31.10.2010 11:32, Mark Murphy пишет: Well, in Tim's case, that static block would only be fired once, presumably. If Application instance B is created before Application instance A is terminated, then we're still talking the same VM, and so the static initializer would have been run when A was created and would not be re-run when B is created. I suppose the real problem might be that A is *never* being terminated, despite the process being recycled, though I haven't seen any signs of that occurring, either. This might occur if Android is recycling the process but not the VM, for example. I suspect that Tim can work around his problem via passing the Application object to his NDK library and detecting a change in that object (e.g., different hashCode()), reinitializing his statics when that occurs. On Sun, Oct 31, 2010 at 4:24 AM, Kostya Vasilyevkmans...@gmail.com wrote: I don't have an answer to your actual question, however - wouldn't it be more reliable to initialize native code from a static block? class MyApplication extends Application { private native void initializeNativeSide(); static { initializeNativeSide(); } } -- Kostya 31.10.2010 10:34, Mark Murphy пишет: In a comment on an epic StackOverflow question-and-answer, a gentleman who I will call Tim has outlined a scenario he says he is running into, one I have some difficulty believing. Reading somewhat between the lines, the flow would appear to be this: 1. User taps on an activity icon in the launcher 2. Process starts up 3. Application object is put in that process -- and a custom Application object loads an NDK library which initializes some statics/singletons 4. User uses application 5. User abandons application (e.g., HOME) 6. Later, user returns to application, before the first process is killed or recycled for use with another app 7. A second Application object is created, in the same process, before the first Application object is called with onTerminate() This screws things up for Tim's app -- apparently, it does not deal with pre-initialized statics/singletons well. They were presumably counting on onTerminate() to let them clean up the NDK space. As a result, they are relying upon killProcess() (somehow...unclear under what conditions they might call this) to force their own process to go away, so their statics get cleaned up. Step #7 is what confuses me. I can see a new Application object being created, but only if the first Application object were terminated. I don't see any NDK-related bugs out on b.android.com that seem to match this complaint, though in principle it might cause problems for non-NDK apps as well. Has anyone encountered a new Application object being created in a process before the old one is terminated? Thanks! -- Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.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 -- Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.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
[android-developers] How can I create an aircraft-mounted-liked compass?
I want to create a non-generic compass that uses rotating directions instead of a rotating needle as in the conventional compass. The drawing is like the illustration below. | ' ' W ' ' ' ' ' N ' ' ' ' ' E ' ' ' ' ' S ' ' ' (shift a bit to the east) | ' ' ' ' ' N ' ' ' ' ' E ' ' ' ' ' S ' ' ' ' ' W The needle (depict as |) is fixed and the direction string should have some sort of rotation effect that immediately relocates each sign or character from one tip of the edge to the opposite edge. Of course, the movement follows the reading of the Android sensor. Does anyone has an idea how to implement this? I stumbled with how I create the rotation effect and connect the string's movement with the sensor reading. Thanks /Joe -- 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] IllegalStateException: No wrapped connection.
Hi Mark, Looks like it was a threading issue - from what you say; IntentService doing work on a separate thread, so just creating a new DefaultHttpClient seems to have done the trick. Thank you for explaining (once again) :) Regards, Julius. On 31/10/2010, at 7:56 PM, Mark Murphy wrote: There is something messed up with your HttpClient object. That exception is being raised by HttpClient itself, based upon what I can see in the Android source code. Bear in mind that, in the case of an alarm, your process hopefully was terminated/recycled since the last alarm, and so there is little value in attempting to reuse some global HttpClient here. I'd just create a new one. Also, bear in mind that all IntentServices do their work on a background thread, and HttpClient is not thread-safe by default. It's possible this error is tied to that. You need to hook up a ThreadSafeClientConnManager to the HttpClient object if you will reuse it across multiple threads. On Sun, Oct 31, 2010 at 2:14 AM, Julius Spencer jul...@msa.co.nz wrote: Hi, I'm trying to send an HTTP request from a WakefulService so a Service which has been started from an alarm set up with AlarmManager and I get the error: IllegalStateException: No wrapped connection. HttpGet httpGet = (HttpGet) new HttpGet(MYRequestHelper.getRequest(this)); HttpClient client = ((MYApplication) getApplication()).getHttpClient(); String response; try { response = client.execute(httpGet, new BasicResponseHandler()); At this point I run through parsing JSON and creating new HttpGets and executing them on the client. Is it possible I running execute too many times on the client or something? I'm don't really understand what the error means and I haven't been able to glean anything much from Googling other than to catch it and hope for the best. Cheers, Julius. -- 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 -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Android 2.2 Programming Books: http://commonsware.com/books -- 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 -- 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] Extending SimpleCursorAdapter
I'm an Android newbie, stuck on a problem for a over week now, if I knew what I was doing it would be 10 minutes work. Im using the NotePad example as a base for an application. This binds a ListActivity to a Provider. Its perfect, except it uses SimpleCursorAdaptor, which means the list only binds to and displays one item per row. I want it to display two items, both bound the Provider. Or more accurately display the text from one Content Provider field and an icon which depends on the value of a different field. This sounds like a pretty simple thing to do, a very slight modification to the NotePad application. Trouble is, I have no idea on *how* to do it. I really need a starting point, and approach to use. So far I have tried (unsuccessfully): * Hand populating the ListView by reading in the Provider data and populating an array in OnCreate. This works, except as the data is not bound the List does not update when I add an item. * Extending SimpleCursorAdapter with a custom getViewBinder. Could still only bind to a single column. * Building my own ListAdaptor. Couldn't get this to work. * Concatenating both fileds together and parsing 2 fields into 1 field read/write. The next thing I will try is extremely tacky running two separate simpleCursorAdaptors in two views in a Linear Layout, fudged so the row height is identical, and duplicate the logic. I say this only to show that I really, really have tried. Could someone give me at least a hint as to how I can create a custom CursorAdaptor which binds to two fields instead of just one like SimpleCursorAdapter? There must be some easy way Sorry/thanks/help Peter Webb -- 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] One process, two live Application objects?
On Sun, Oct 31, 2010 at 4:39 AM, Kostya Vasilyev kmans...@gmail.com wrote: Right, a static block runs only once. And is guaranteed to run in this case, since Android is going to instantiate MyApplication. You wrote in the original email that the native side needs to initialize some statics and singletons. Those should only be initialized once, so a static block works here. Apparently, Tim's app (combined with the scenario I outlined) does not deal well with this case. Near as I can interpret matters, his app gets confused when a new Application object is created yet his statics are still in the state from the previous Application object. Part of the problem is that his native code was written for iOS, which does not recycle processes. If the user plays this game, leaves the game, and comes back into the game, it's a brand new process with brand new initialized statics. Again, I think he can work around that by more closely tracking the Application object instances themselves. I'm just trying to figure out if the overlapping-Application condition can really happen. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Android 2.2 Programming Books: http://commonsware.com/books -- 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: for loop drawing first graphics to x0 y0 if more than 1 iteration
I'm a newb as well. I offer my idiot suggestion purely on the basis you sound desperate. I know that feeling. Have you tried calling .invalidate to force a redraw between steps, so the display and your code stay in sync? On Oct 31, 4:43 pm, acr acr...@gmail.com wrote: I am totally stumped here, any insight from anyone would be greatly appreciated. I hit a wall and am not sure what else to do. On Oct 31, 12:00 am, acr acr...@gmail.com wrote: Thanks for the reply, I've done this and it looks like the loop is moving faster than the canvas can draw to the surface. which would explain why I get a positive result when there is only one to loop through and a positive result for the last in the loop. I even attempted to put a Thread.sleep in the mix and still no luck. I relatively am new to android and Java, so not quite sure how to remedy the problem. On Oct 30, 10:49 pm, Shawn Brown big.coffee.lo...@gmail.com wrote: if(_theGrid1.size()7){ int g1left = 7-_theGrid1.size(); int i; for(i=1;i=g1left;i++){ x1=64; y1=i*64; graphic.getGridCoordinates().setGrid1X(x1); graphic.getGridCoordinates().setGrid1Y(y1); This looks fine to me. Personally, I'd just log the values to confirm that. As for the remaining code, I can't tell what you are doing there. Personally, I'd just log the values to see what is going wrong where. Shawn- Hide quoted text - - Show quoted text - -- 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] Extending SimpleCursorAdapter
On Sun, Oct 31, 2010 at 5:12 AM, Peter Webb r.peter.w...@gmail.com wrote: Its perfect, except it uses SimpleCursorAdaptor, which means the list only binds to and displays one item per row. I want it to display two items, both bound the Provider. Or more accurately display the text from one Content Provider field and an icon which depends on the value of a different field. I think SimpleCursorAdapter can handle that without subclassing via setViewBinder(), though I haven't experimented with this yet. * Hand populating the ListView by reading in the Provider data and populating an array in OnCreate. This works, except as the data is not bound the List does not update when I add an item. It also chews up lots of RAM and CPU time. * Extending SimpleCursorAdapter with a custom getViewBinder. Could still only bind to a single column. I think you're supposed to call setViewBinder(), not override getViewBinder(). Could someone give me at least a hint as to how I can create a custom CursorAdaptor which binds to two fields instead of just one like SimpleCursorAdapter? There must be some easy way Override bindView() and bind it yourself, if needed. bindView() will receive a Cursor (pointing at the right position in your data set) and the View to bind it to. You can call super.bindView() to allow SimpleCursorAdapter to do the basics, then use findViewById() on the row View to find your ImageView and set an appropriate resource on it. Here is a free excerpt from one of my books that touches on some of this, though in the context of an ArrayAdapter, since by this point in the book I haven't introduced Cursors yet: 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 2.2 Programming Books: http://commonsware.com/books -- 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] Extending SimpleCursorAdapter
Peter, SimpleCursorAdapter is the simplified version of the CursorAdapter. You need to use the real thing and override newView() and bindView(). newView needs to load (inflate) a new list item layout. bindView needs to set values in views contained in the list item layout to reflect values retrieved from its cursor. The whole class might look something like this: private static final class YourAdapter extends CursorAdapter { YourAdapter(Context context, Cursor cursor) { super(context, cursor); mInflater = LayoutInflater.from(context); mColField1 = cursor.getColumnIndex(name of db field 1); mColField2 = cursor.getColumnIndex(name of db field 2); } @Override public View newView(Context context, Cursor cursor, ViewGroup parent) { View v = mInflater.inflate(R.layout.my_list_item, parent, false); return v; } @Override public void bindView(View view, Context context, Cursor cursor) { // show text value TextView tv = (TextView) view.findViewById(R.id.item_field_1); tv.setText(cursor.getString(mColField1)); // show icon ImageView iv = (ImageView) view.findViewById(R.id.item_field_2); int icon_kind = cursor.getInt(mColField2); iv.setImageResource(some resource id value based on icon_kind); } LayoutInflater mInflater; private int mColField1; private int mColField2; } -- Kostya 31.10.2010 12:12, Peter Webb пишет: I'm an Android newbie, stuck on a problem for a over week now, if I knew what I was doing it would be 10 minutes work. Im using the NotePad example as a base for an application. This binds a ListActivity to a Provider. Its perfect, except it uses SimpleCursorAdaptor, which means the list only binds to and displays one item per row. I want it to display two items, both bound the Provider. Or more accurately display the text from one Content Provider field and an icon which depends on the value of a different field. This sounds like a pretty simple thing to do, a very slight modification to the NotePad application. Trouble is, I have no idea on *how* to do it. I really need a starting point, and approach to use. So far I have tried (unsuccessfully): * Hand populating the ListView by reading in the Provider data and populating an array in OnCreate. This works, except as the data is not bound the List does not update when I add an item. * Extending SimpleCursorAdapter with a custom getViewBinder. Could still only bind to a single column. * Building my own ListAdaptor. Couldn't get this to work. * Concatenating both fileds together and parsing 2 fields into 1 field read/write. The next thing I will try is extremely tacky running two separate simpleCursorAdaptors in two views in a Linear Layout, fudged so the row height is identical, and duplicate the logic. I say this only to show that I really, really have tried. Could someone give me at least a hint as to how I can create a custom CursorAdaptor which binds to two fields instead of just one like SimpleCursorAdapter? There must be some easy way Sorry/thanks/help Peter Webb -- Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.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
[android-developers] Content Service Crash
I get weird exception: 10-31 09:09:51.308: ERROR/ContentService(59): Content Service Crash 10-31 09:09:51.308: ERROR/ContentService(59): java.lang.NullPointerException 10-31 09:09:51.308: ERROR/ContentService(59): at android.content.ContentService $ObserverNode.collectObserversLocked(ContentService.java:620) 10-31 09:09:51.308: ERROR/ContentService(59): at android.content.ContentService.notifyChange(ContentService.java:134) 10-31 09:09:51.308: ERROR/ContentService(59): at android.content.IContentService$Stub.onTransact(IContentService.java: 91) 10-31 09:09:51.308: ERROR/ContentService(59): at android.content.ContentService.onTransact(ContentService.java:83) 10-31 09:09:51.308: ERROR/ContentService(59): at android.os.Binder.execTransact(Binder.java:288) 10-31 09:09:51.308: ERROR/ContentService(59): at dalvik.system.NativeStart.run(Native Method) after that - only a restart of the emulator helps. anyone knows what is this? Ori -- 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] render an activity to an image file.
On 31 October 2010 02:58, sdphil phil.pellouch...@gmail.com wrote: i know you can't take a screenshot without having root access, but is there a way to render an activity and all the contents to an image file? a) root your phone or b) use simulator to get the screenshot c) grant yourself READ_FRAME_BUFFER permission and play with framebuffer data yourself - but for this you need root anyway as your app will not be granted this permission on non-rooted device. -- 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: render an activity to an image file.
Never tried it, but first thing I would try is to just make a Bitmap the size of the screen, construct a Canvas using the constructor that takes a Bitmap, then get the Window from the Activity, then get the decor View from that, and pass the Canvas to its onDraw. On Oct 30, 8:58 pm, sdphil phil.pellouch...@gmail.com wrote: i know you can't take a screenshot without having root access, but is there a way to render an activity and all the contents to an image file? anyone have code to do this? it would be nice to have any dialogs, menus, etc... as well, but not required. tia. -- 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: Collecting my Market installation statistics
Thanks. In what ways have you found the numbers to be untrustworthy? Are the numbers exposed via the API any different? Also, can you point me to the API you recommend? A quick search just now found several unofficial APIs, but no official support. Thanks, David On Oct 28, 5:50 pm, TreKing treking...@gmail.com wrote: On Thu, Oct 28, 2010 at 4:40 AM, deg d...@degel.com wrote: Is this info available anywhere on the Market site? Nope. And don't trust the numbers you see there anyway. If not, has anyone written a screen-scraping utility (or equivalent) that can harvest the data into a spreadsheet? I don't know, but there a Market API you could use for yourself. Or use some kind of analytics library. --- -- 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] Dialog not displayed properly in Landscape mode
Hi all, @landscape mode In messaging application screen i am trying to attach a audio , it pop up a dialog and, at the same time some incoming call came, after disconnecting the call the popup dialog displayed (half) not full dialog ( only header of dialog visible no buttons are visible to select or cancel), It is not happening in the portraite mode, how to solve it. need help Regards, Dilli -- 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: for loop drawing first graphics to x0 y0 if more than 1 iteration
invalidate and postInvalidate doesn't fix the problem, VERY desperate, but that's the type of response I was looking for much appreciated. I used logcat and looked at everything if i remove/add 3 items items from the array, the loop runs, it sets the coordinates through each iteration, just the first 2 graphics draw to x0,y0 and the third draws to the correct location. do you or ANYone else have ANYother suggestions? MUCH appreciated On Oct 31, 5:27 am, Peter Webb r.peter.w...@gmail.com wrote: I'm a newb as well. I offer my idiot suggestion purely on the basis you sound desperate. I know that feeling. Have you tried calling .invalidate to force a redraw between steps, so the display and your code stay in sync? On Oct 31, 4:43 pm, acr acr...@gmail.com wrote: I am totally stumped here, any insight from anyone would be greatly appreciated. I hit a wall and am not sure what else to do. On Oct 31, 12:00 am, acr acr...@gmail.com wrote: Thanks for the reply, I've done this and it looks like the loop is moving faster than the canvas can draw to the surface. which would explain why I get a positive result when there is only one to loop through and a positive result for the last in the loop. I even attempted to put a Thread.sleep in the mix and still no luck. I relatively am new to android and Java, so not quite sure how to remedy the problem. On Oct 30, 10:49 pm, Shawn Brown big.coffee.lo...@gmail.com wrote: if(_theGrid1.size()7){ int g1left = 7-_theGrid1.size(); int i; for(i=1;i=g1left;i++){ x1=64; y1=i*64; graphic.getGridCoordinates().setGrid1X(x1); graphic.getGridCoordinates().setGrid1Y(y1); This looks fine to me. Personally, I'd just log the values to confirm that. As for the remaining code, I can't tell what you are doing there. Personally, I'd just log the values to see what is going wrong where. Shawn- Hide quoted text - - Show quoted text - -- 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] Adventures with LVL
I have finally got LVL working in my app, but now I am having second thoughts about including it. If you have published an app including LVL, what are your experiences? Has it caused bad feedback from your users? -- 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: for loop drawing first graphics to x0 y0 if more than 1 iteration
Now I even tried to change my loop to go through the array and get the same EXACT result.. I have to be missing something here. Has ANYone else experienced this type of problem? or can give me some guidance. Thanks a bunch. int temp1Y=0; for(Graphic g1 : _toAdd1){ temp1Y+=1; x1=0; y1=temp1Y*-63; graphic.getGridCoordinates().setGrid1X(x1); graphic.getGridCoordinates().setGrid1Y(y1); _toMove.add(g1); _theGrid1.add(0,g1); _theGrid1.get(0).setAMT(_toAdd1.size()); _theGrid1.get(0).setMV(temp1Y+10); x1=0; y1=temp1Y*-63; graphic.getGridCoordinates().setGrid1X(x1); graphic.getGridCoordinates().setGrid1Y(y1); } _toAdd1.removeAll(_toAdd1); temp1Y=0; On Oct 31, 7:22 am, acr acr...@gmail.com wrote: invalidate and postInvalidate doesn't fix the problem, VERY desperate, but that's the type of response I was looking for much appreciated. I used logcat and looked at everything if i remove/add 3 items items from the array, the loop runs, it sets the coordinates through each iteration, just the first 2 graphics draw to x0,y0 and the third draws to the correct location. do you or ANYone else have ANYother suggestions? MUCH appreciated On Oct 31, 5:27 am, Peter Webb r.peter.w...@gmail.com wrote: I'm a newb as well. I offer my idiot suggestion purely on the basis you sound desperate. I know that feeling. Have you tried calling .invalidate to force a redraw between steps, so the display and your code stay in sync? On Oct 31, 4:43 pm, acr acr...@gmail.com wrote: I am totally stumped here, any insight from anyone would be greatly appreciated. I hit a wall and am not sure what else to do. On Oct 31, 12:00 am, acr acr...@gmail.com wrote: Thanks for the reply, I've done this and it looks like the loop is moving faster than the canvas can draw to the surface. which would explain why I get a positive result when there is only one to loop through and a positive result for the last in the loop. I even attempted to put a Thread.sleep in the mix and still no luck. I relatively am new to android and Java, so not quite sure how to remedy the problem. On Oct 30, 10:49 pm, Shawn Brown big.coffee.lo...@gmail.com wrote: if(_theGrid1.size()7){ int g1left = 7-_theGrid1.size(); int i; for(i=1;i=g1left;i++){ x1=64; y1=i*64; graphic.getGridCoordinates().setGrid1X(x1); graphic.getGridCoordinates().setGrid1Y(y1); This looks fine to me. Personally, I'd just log the values to confirm that. As for the remaining code, I can't tell what you are doing there. Personally, I'd just log the values to see what is going wrong where. Shawn- Hide quoted text - - Show quoted text - -- 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 selected Overlay index
hi guys, i'm working with a google maps for a while now. i'm having multiple markers in the map once you select a perticular maker an Overaly will appear so once the Overlay is selected i want to get the index of the overlay. every time its 0. this is how i'm adding overlays GeoPoint point = new GeoPoint((int) (postal_lat * 1E6), (int) (postal_lng * 1E6)); Drawable postal_icon = getResources().getDrawable(R.drawable.location); MyItemizedOverlay itemizedOverlay2 = new MyItemizedOverlay(postal_icon, mapview); OverlayItem overlayItem_postal = new OverlayItem(point, postal_msg, null); itemizedOverlay2.addOverlay(overlayItem_postal); MyItemizedOverlay implementation public class MyItemizedOverlay extends BalloonItemizedOverlayOverlayItem { private ArrayListOverlayItem m_overlays = new ArrayListOverlayItem(); private Context c; public MyItemizedOverlay(Drawable defaultMarker, MapView mapView) { super(boundCenter(defaultMarker), mapView); c = mapView.getContext(); } public void addOverlay(OverlayItem overlay, int id) { m_overlays.add(overlay); populate(); } @Override protected OverlayItem createItem(int i) { return m_overlays.get(i); } @Override public int size() { return m_overlays.size(); } @Override protected boolean onBalloonTap(int index) { NearestLocation near = MapInfo.nearestArray[index]; Toast.makeText(c, index + near.getPartname() + index, Toast.LENGTH_LONG).show(); return true; } } onBalloonTap always returns 0?? regards, Mike -- 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: Collecting my Market installation statistics
On Sun, Oct 31, 2010 at 5:16 AM, deg d...@degel.com wrote: In what ways have you found the numbers to be untrustworthy? http://www.google.com/support/forum/p/Android+Market/thread?tid=2ad7b50d916b941bhl=enstart=40 Are the numbers exposed via the API any different? I don't know. Also, can you point me to the API you recommend? A quick search just now found several unofficial APIs, but no official support. http://code.google.com/p/android-market-api/ I don't think there's anything official - 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 get the selected Overlay index
On Sun, Oct 31, 2010 at 8:11 AM, Donald hasitharand...@gmail.com wrote: onBalloonTap always returns 0?? Actually, it looks like it always returns true, according to your code. What is onBalloonTap and BalloonItemizedOverlay? I don't see either of those in the documentation. - 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 resolution: supplying action+data where filter had only action, causes it to fail
I thought that Action was preeminent during intent resolution and if the intent had the same action as the intent filter, it would be considered a match regardless of data, if the filter did not specify anything. So I was very surprised to find that supplying action+data where filter had only action, causes it to fail. In the code below, if you comment out line 47 so that data is *not* sent, only then it resolves correctly. alertIntent.setData(alert_i); To get it to work with the data (an id that is simply a String), what mime type should I specify in the intent filter? thanks... - package com.iovercomer; import java.util.Calendar; import java.util.Date; import android.app.Activity; import android.app.AlarmManager; import android.app.PendingIntent; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.content.IntentFilter.MalformedMimeTypeException; import android.net.Uri; import android.os.Bundle; import android.os.SystemClock; import android.util.Log; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.TextView; import android.widget.Toast; public class TestIntentResolution extends Activity { public static final String ALERT_ME_ACTION = com.iovercomer.TestIntentResolution.alertMe; AlarmManager am; PendingIntent mAlarmSender; String uriBase = content://com.iovercomer/alerts/; Intent alertIntent; int alarmNumber = 99; protected int requestCode = 23; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Button startButton = (Button) findViewById(R.id.start_alarm); startButton.setOnClickListener(mStartAlarmListener); am = (AlarmManager) getSystemService(Context.ALARM_SERVICE); alertIntent = new Intent(ALERT_ME_ACTION); } private OnClickListener mStartAlarmListener = new OnClickListener() { @Override public void onClick(View v) { Uri alert_i = Uri.parse(uriBase + alarmNumber); // comment out the following line to get the intent to resolve to the receiver alertIntent.setData(alert_i); int flags = PendingIntent.FLAG_UPDATE_CURRENT; mAlarmSender = PendingIntent.getBroadcast(TestIntentResolution.this, requestCode , alertIntent, flags); long firstTime = SystemClock.elapsedRealtime(); am.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, firstTime + 10 * 1000, mAlarmSender); Toast.makeText(TestIntentResolution.this, starting + alarm + alarmNumber, Toast.LENGTH_LONG).show(); } }; @Override public void onResume() { super.onResume(); Intent inte = registerReceiver(receiver, new IntentFilter( ALERT_ME_ACTION)); } @Override public void onPause() { super.onPause(); unregisterReceiver(receiver); } void alertMe(String time, String data) { String t = alert! at + time + + data + \n; Toast.makeText(getApplicationContext(), t, Toast.LENGTH_SHORT).show(); TextView tv = (TextView) findViewById(R.id.myginew); tv.setText(t); } MyAlarmReceiver receiver = new MyAlarmReceiver(); public class MyAlarmReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { Date dt = Calendar.getInstance().getTime(); intent.getAction(); intent.getType(); Uri d = intent.getData(); String frag = (d == null ? :d.getLastPathSegment()); alertMe(dt.toString(), frag); } }; } -- 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 get the selected Overlay index
Hi Treking, thanks for your reply.BalloonItemizedOverlay is a class which extends BalloonItemizedOverlay. this is the BalloonItemizedOverlay implementation public abstract class BalloonItemizedOverlayItem extends ItemizedOverlayOverlayItem { private MapView mapView; private BalloonOverlayView balloonView; private View clickRegion; private int viewOffset; final MapController mc; private int id; /** * Create a new BalloonItemizedOverlay * * @param defaultMarker *- A bounded Drawable to be drawn on the map for each item in *the overlay. * @param mapView *- The view upon which the overlay items are to be drawn. */ public BalloonItemizedOverlay(Drawable defaultMarker, MapView mapView) { super(defaultMarker); this.mapView = mapView; viewOffset = 0; mc = mapView.getController(); } /** * Set the horizontal distance between the marker and the bottom of the * information balloon. The default is 0 which works well for center bounded * markers. If your marker is center-bottom bounded, call this before adding * overlay items to ensure the balloon hovers exactly above the marker. * * @param pixels *- The padding between the center point and the bottom of the *information balloon. */ public void setBalloonBottomOffset(int pixels) { viewOffset = pixels; } /** * Override this method to handle a tap on a balloon. By default, does * nothing and returns false. * * @param index *- The index of the item whose balloon is tapped. * @return true if you handled the tap, otherwise false. */ protected boolean onBalloonTap(int index) { id = index; Toast.makeText(mapView.getContext(), IDDD + index, Toast.LENGTH_LONG).show(); return false; } /* * (non-Javadoc) * * @see com.google.android.maps.ItemizedOverlay#onTap(int) */ @Override protected final boolean onTap(int index) { boolean isRecycled; final int thisIndex; GeoPoint point; thisIndex = index; point = createItem(index).getPoint(); if (balloonView == null) { balloonView = new BalloonOverlayView(mapView.getContext(), viewOffset); clickRegion = (View) balloonView .findViewById(R.id.balloon_inner_layout); isRecycled = false; } else { isRecycled = true; } balloonView.setVisibility(View.GONE); ListOverlay mapOverlays = mapView.getOverlays(); if (mapOverlays.size() 1) { hideOtherBalloons(mapOverlays); } balloonView.setData(createItem(index)); MapView.LayoutParams params = new MapView.LayoutParams( LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, point, MapView.LayoutParams.BOTTOM_CENTER); params.mode = MapView.LayoutParams.MODE_MAP; setBalloonTouchListener(thisIndex); balloonView.setVisibility(View.VISIBLE); if (isRecycled) { balloonView.setLayoutParams(params); } else { mapView.addView(balloonView, params); } mc.animateTo(point); /*Toast.makeText(mapView.getContext(), indexdss + index, Toast.LENGTH_LONG).show();*/ return true; } /** * Sets the visibility of this overlay's balloon view to GONE. */ private void hideBalloon() { if (balloonView != null) { balloonView.setVisibility(View.GONE); } } /** * Hides the balloon view for any other BalloonItemizedOverlay instances * that might be present on the MapView. * * @param overlays *- list of overlays (including this) on the MapView. */ private void hideOtherBalloons(ListOverlay overlays) { for (Overlay overlay : overlays) { if (overlay instanceof BalloonItemizedOverlay? overlay != this) { ((BalloonItemizedOverlay?)
[android-developers] Re: Adventures with LVL
If you have published an app including LVL, what are your experiences? 99.9% no problem. Has it caused bad feedback from your users? Once or twice, a long time ago. But my implementation is very forgiving. It doesn't care if the licence can't be verified for the first 7 days, and only needs one positive response (per install). It validates in the background so most people don't even notice it. I also have a backup licence-code system they can use if all else fails (I needed it for paypal sales). Pent -- 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] Intent resolution: supplying action+data where filter had only action, causes it to fail
On Sun, Oct 31, 2010 at 10:25 AM, longingtoadopt.com anil.r...@gmail.com wrote: I thought that Action was preeminent during intent resolution and if the intent had the same action as the intent filter, it would be considered a match regardless of data, if the filter did not specify anything. Quoting the IntentFilter object documentation: For actions, the field will not be tested if no values have been given (treating it as a wildcard); if no data characteristics are specified, however, then the filter will only match intents that contain no data. I suspect that you are confusing intent-filter characteristics with IntentFilter characteristics. To get it to work with the data (an id that is simply a String), what mime type should I specify in the intent filter? Data is not an id that is simply a String. Data is a Uri. Please use a string extra for an arbitrary string. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Android 2.2 Programming Books: http://commonsware.com/books -- 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: Content Service Crash
the triggering code is: getContentResolver().registerContentObserver(Uri.parse(refreshChange), false, _refreshObserver); On Oct 31, 11:38 am, oriharel ori.ha...@gmail.com wrote: I get weird exception: 10-31 09:09:51.308: ERROR/ContentService(59): Content Service Crash 10-31 09:09:51.308: ERROR/ContentService(59): java.lang.NullPointerException 10-31 09:09:51.308: ERROR/ContentService(59): at android.content.ContentService $ObserverNode.collectObserversLocked(ContentService.java:620) 10-31 09:09:51.308: ERROR/ContentService(59): at android.content.ContentService.notifyChange(ContentService.java:134) 10-31 09:09:51.308: ERROR/ContentService(59): at android.content.IContentService$Stub.onTransact(IContentService.java: 91) 10-31 09:09:51.308: ERROR/ContentService(59): at android.content.ContentService.onTransact(ContentService.java:83) 10-31 09:09:51.308: ERROR/ContentService(59): at android.os.Binder.execTransact(Binder.java:288) 10-31 09:09:51.308: ERROR/ContentService(59): at dalvik.system.NativeStart.run(Native Method) after that - only a restart of the emulator helps. anyone knows what is this? Ori -- 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] broadcast message leave activity in the background
Hari, My app's main activity listens to a broadcast message. When it receives the message it brings the activity to the front. I want to update the activity if it is in the front, so the user is playing with it, but otherwise I do not want to bring the activity to the front. How should I do it? Is there a flag for invoking the intent, or what? rrd -- 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] broadcast message leave activity in the background
On Sun, Oct 31, 2010 at 11:27 AM, rrd r...@1108.cc wrote: My app's main activity listens to a broadcast message. When it receives the message it brings the activity to the front. That sounds like you used startActivity(), not sendBroadcast(). -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Android 2.2 Programming Books: http://commonsware.com/books -- 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: broadcast message leave activity in the background
Yes the receiver calls startActivity(). I think sending broadcast would not help me as the message already sent and received by the receiver. -- 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: broadcast message leave activity in the background
On Sun, Oct 31, 2010 at 11:51 AM, rrd r...@1108.cc wrote: Yes the receiver calls startActivity(). Then don't do that, since the complete and entire purpose of that is to put the activity in the foreground, which you do not want. I think sending broadcast would not help me as the message already sent and received by the receiver. Send a different broadcast, targeted to your activity. Or register the first BroadcastReceiver via registerReceiver() from the activity in the first place. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Android 2.2 Programming Books: http://commonsware.com/books -- 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: How to get the selected Overlay index
On Sun, Oct 31, 2010 at 9:35 AM, Donald hasitharand...@gmail.com wrote: but why it's always giving the index of 0? I don't know and I don't have time to review and make sense of you code, but printing log statements and stepping through the debugger should yield an answer pretty quickly. - 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] button click
Your question is difficult to understand. You should try to clarify and rephrase so we can better understand the problem you're having. - 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] Can u help me to find the mistake? i can't run this program.
The mistake is you posted a bunch of code with no context and have not even explained what problem it is you're having. - 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] Re: Collecting my Market installation statistics
David, I'm in the process of developing a website that collects market statistics and developer statistics, and one of the features I'm adding is a utility to collect my own market download numbers daily so I can put them into a spreadsheet and chart/graph them so I can easily spot trends. I thought about adding this for use by any developer, but the problem with it is that to automatically collect the actual download numbers, we would have to store your Google login information, and I don't think many developers would want to give that information... I could be wrong, but that's my opinion. Maybe I should ask... How many developers would be willing to have a website (a trustworthy website) store their login information to be able to automatically collect the download/installed numbers so they could collect them? Without the login information the only way to get the actual download and installed numbers would be for the developer to visit a page and manually start the download information, and I'm not sure many developers would do that consistently enough to get good information. Let me know if you are interested in having this... I can add it fairly easily... but I'd need to know exactly what would be acceptable to the developers. Sincerely, Brad Gies --- Bistro Bot - Bistro Blurb http://bgies.comhttp://nocrappyapps.com http://bistroblurb.com http://forcethetruth.com http://ihottonight.com --- Everything in moderation, including abstinence (paraphrased) Every person is born with a brain... Those who use it well are the successful happy ones - Brad Gies Adversity can make or break you... It's your choice... Choose wisely - Brad Gies Never doubt that a small group of thoughtful, committed people can change the world. Indeed. It is the only thing that ever has - Margaret Mead On 31/10/2010 3:16 AM, deg wrote: Thanks. In what ways have you found the numbers to be untrustworthy? Are the numbers exposed via the API any different? Also, can you point me to the API you recommend? A quick search just now found several unofficial APIs, but no official support. Thanks, David On Oct 28, 5:50 pm, TreKingtreking...@gmail.com wrote: On Thu, Oct 28, 2010 at 4:40 AM, degd...@degel.com wrote: Is this info available anywhere on the Market site? Nope. And don't trust the numbers you see there anyway. If not, has anyone written a screen-scraping utility (or equivalent) that can harvest the data into a spreadsheet? I don't know, but there a Market API you could use for yourself. Or use some kind of analytics library. --- -- TreKinghttp://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] deprecating Display#getOrientation() not such a good idea
I'm not sure what the motivation was to deprecate Display#getOrientation() in SDK 8 is, since I haven't had a chance to read the changeset description. The decision made the API a little less humanistic. I propose it be brought back in SDK 9 for these reasons: 1) The community has two+ years of discovery and documentation around Display#getOrientation. 2) There's no clear reason why applications which don't distinguish between a 90/270 degree rotation should have to implement extra work for forwards/backwards compatibility. 3) The system already decides which side is top whether the rotation is 90 or 270 degrees. 4) android.view.Surface has no setRotation(...) method, it uses setOrientation(...). Thus, if Display#getOrientation() was to be deprecated, the same should have happened to Surface#getOrientation for architectural symmetry. 5) Using Display#getOrientation() will always be desired by some applications, whereas Display#getRotation() will always be desired by others. The frustrating factor here is that on top of the confusion caused by the SDK having different classes/methods to get runtime orientation versus configured orientation, this deprecation is poorly motivated. Yours Truly, Free -- 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: for loop drawing first graphics to x0 y0 if more than 1 iteration
So, It has nothing to do with the loop if I add the images manually I get the very same result the first graphic is being drawn to x0 y0 in my code. what I have is a column of 7 graphics(_theGrid) and when I remove a graphic from it, a new graphic is created in _toAdd. What my code is doing taking what ever is in _toAdd array and adding it to _theGrid array. If I only add the first graphic, the graphic is drawn CORRECTLY to x63 y63 if I add both, the first is drawn INCORRECTLY to x0 y0, and the second graphic is drawn CORRECTLY to x63 y126 if I add a third, the the first TWO are drawn INCORRECTLY and the last is drawn correctly. I have tried invalidate and postInvalidate with no success and have hit a wall. Can anyone here help me remedy this problem, I am totally stumped here :? I am obviously missing something Im just not sure what. //FIRST GRAPHIC TO ADD FROM THE _toAdd ARRAY x=63; y=63; graphic.getGridCoordinates().setGrid1X(x); graphic.getGridCoordinates().setGrid1Y(y); _toMove.add(_toAdd.get(0)); _theGrid.add(0,_toAdd.get(0)); _theGrid.get(0).setAMT(_theGrid.get(0).getAMT()+2); _theGrid.get(0).setMV(11); _toAdd.remove(_theGrid.get(0)); //SECOND GRAPHIC TO ADD FROM THE _toAdd ARRAY x=63; y=126; graphic.getGridCoordinates().setGrid1X(x); graphic.getGridCoordinates().setGrid1Y(y); _toMove.add(_toAdd.get(0)); _theGrid.add(0,_toAdd.get(0)); _theGrid.get(0).setAMT(_theGrid.get(0).getAMT()+2); _theGrid.get(0).setMV(12); _toAdd.remove(_theGrid.get(0)); I have the following running in OnDraw(Canvas canvas) non stop bitmap = _theGrid.get(0).getBitmap(); gridcoords = _theGrid.get(0).getGridCoordinates(); canvas.drawBitmap(bitmap, gridcoords.getGrid1X(), gridcoords.getGrid1Y(), null); On Oct 31, 8:16 am, acr acr...@gmail.com wrote: Now I even tried to change my loop to go through the array and get the same EXACT result.. I have to be missing something here. Has ANYone else experienced this type of problem? or can give me some guidance. Thanks a bunch. int temp1Y=0; for(Graphic g1 : _toAdd1){ temp1Y+=1; x1=0; y1=temp1Y*-63; graphic.getGridCoordinates().setGrid1X(x1); graphic.getGridCoordinates().setGrid1Y(y1); _toMove.add(g1); _theGrid1.add(0,g1); _theGrid1.get(0).setAMT(_toAdd1.size()); _theGrid1.get(0).setMV(temp1Y+10); x1=0; y1=temp1Y*-63; graphic.getGridCoordinates().setGrid1X(x1); graphic.getGridCoordinates().setGrid1Y(y1); } _toAdd1.removeAll(_toAdd1); temp1Y=0; On Oct 31, 7:22 am, acr acr...@gmail.com wrote: invalidate and postInvalidate doesn't fix the problem, VERY desperate, but that's the type of response I was looking for much appreciated. I used logcat and looked at everything if i remove/add 3 items items from the array, the loop runs, it sets the coordinates through each iteration, just the first 2 graphics draw to x0,y0 and the third draws to the correct location. do you or ANYone else have ANYother suggestions? MUCH appreciated On Oct 31, 5:27 am, Peter Webb r.peter.w...@gmail.com wrote: I'm a newb as well. I offer my idiot suggestion purely on the basis you sound desperate. I know that feeling. Have you tried calling .invalidate to force a redraw between steps, so the display and your code stay in sync? On Oct 31, 4:43 pm, acr acr...@gmail.com wrote: I am totally stumped here, any insight from anyone would be greatly appreciated. I hit a wall and am not sure what else to do. On Oct 31, 12:00 am, acr acr...@gmail.com wrote: Thanks for the reply, I've done this and it looks like the loop is
Re: [android-developers] One process, two live Application objects?
Only one Application per-.apk-per-process is created, ever. If you use android:process to have multiple .apks sharing the same process, each .apk will have its own Application instantiated in the process. If you use android:process to have an .apk run in multiple processes, each process will get its own Application instance. Application.onTerminate() is *never* called. This function is there for environments where processes are emulated, which is not any production device or the emulator. But it doesn't matter that it isn't called because... well, Application lives for the lifetime of the process, and the process goes away by the OOM killer killing it, which cleans up Application and everything else related to the process without any user space code for it running. Now it is conceivable that there is some case where if a process is left completely empty (with no app components) for a while, and GCs, the data about the loaded process may get GCed as well and have to be recreated. I don't see how this can happen off-hand (there are a number of ways non-weak-references are held between these things), but I can't say for certain there is no such bug here. That said, my recommendation to everyone is to just not subclass Application. This gives you *nothing* you can't do in other, better ways. In particular, a singleton directly represents what is really going on (it lives for the life of the process after the first need for it) and helps keep code more modular. I regret that the Application class was ever introduced; it was a compromise to make people more comfortable with there being some kind of traditional main application concept, but in fact it doesn't really fit in with how Android works so ends up just causing problems. As far as using Application to clean up statics -- this simply doesn't really make sense, for the reasons above. For a legacy application with statics that can't be re-used again in the same process, your only choice is probably to just self-kill your process when the user leave the game. That is, when the game activity is finished. If you can reset your statics after the game is over, then at least instead of killing it you can do that when the activity is finished. But this needs to be driven by Activity, not Application. On Sun, Oct 31, 2010 at 12:34 AM, Mark Murphy mmur...@commonsware.comwrote: In a comment on an epic StackOverflow question-and-answer, a gentleman who I will call Tim has outlined a scenario he says he is running into, one I have some difficulty believing. Reading somewhat between the lines, the flow would appear to be this: 1. User taps on an activity icon in the launcher 2. Process starts up 3. Application object is put in that process -- and a custom Application object loads an NDK library which initializes some statics/singletons 4. User uses application 5. User abandons application (e.g., HOME) 6. Later, user returns to application, before the first process is killed or recycled for use with another app 7. A second Application object is created, in the same process, before the first Application object is called with onTerminate() This screws things up for Tim's app -- apparently, it does not deal with pre-initialized statics/singletons well. They were presumably counting on onTerminate() to let them clean up the NDK space. As a result, they are relying upon killProcess() (somehow...unclear under what conditions they might call this) to force their own process to go away, so their statics get cleaned up. Step #7 is what confuses me. I can see a new Application object being created, but only if the first Application object were terminated. I don't see any NDK-related bugs out on b.android.com that seem to match this complaint, though in principle it might cause problems for non-NDK apps as well. Has anyone encountered a new Application object being created in a process before the old one is terminated? Thanks! -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Android 2.2 Programming Books: http://commonsware.com/books -- 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
Re: [android-developers] One process, two live Application objects?
On Sun, Oct 31, 2010 at 2:07 PM, Dianne Hackborn hack...@android.com wrote: As far as using Application to clean up statics -- this simply doesn't really make sense, for the reasons above. For a legacy application with statics that can't be re-used again in the same process, your only choice is probably to just self-kill your process when the user leave the game. Wait, what? I was under the distinct impression we should not be killing processes this way. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Android 2.2 Programming Books: http://commonsware.com/books -- 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 can I create an aircraft-mounted-liked compass?
Is the lower part of the gauge textual or a pretty image? What part are you having problems with? -- 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] deprecating Display#getOrientation() not such a good idea
getOrientation() has never returned orientation, it returns rotation. So it is being renamed to getRotation(). This is *much* less confusing. In fact you were confused -- you thought it returned orientation, when it does not. If you want the current orientation, Resources.getConfiguration().orientation has that. Surface.setOrientation() is actually not available to applications (it is an accident it is in the SDK, but apps don't have permission to use it, so there is nothing they can actually do with it), so not really relevant here. The solution for that one is probably just to remove it from the SDK since apps can't use it anyway. This was done to better clarify the differences between orientations and screen rotations, which a lot of people have been confused about, and has resulted in a lot of incorrect use of sensors and such. It's worth noting that both Display.getOrientation() and Surface.setOrientation() work with the constants Surface.ROTATION_0, Surface.ROTATION_90, Surface.ROTATION_180, etc. Those APIs intrinsically have a naming conflict. On Sun, Oct 31, 2010 at 10:44 AM, tenacious fbeach...@gmail.com wrote: I'm not sure what the motivation was to deprecate Display#getOrientation() in SDK 8 is, since I haven't had a chance to read the changeset description. The decision made the API a little less humanistic. I propose it be brought back in SDK 9 for these reasons: 1) The community has two+ years of discovery and documentation around Display#getOrientation. 2) There's no clear reason why applications which don't distinguish between a 90/270 degree rotation should have to implement extra work for forwards/backwards compatibility. 3) The system already decides which side is top whether the rotation is 90 or 270 degrees. 4) android.view.Surface has no setRotation(...) method, it uses setOrientation(...). Thus, if Display#getOrientation() was to be deprecated, the same should have happened to Surface#getOrientation for architectural symmetry. 5) Using Display#getOrientation() will always be desired by some applications, whereas Display#getRotation() will always be desired by others. The frustrating factor here is that on top of the confusion caused by the SDK having different classes/methods to get runtime orientation versus configured orientation, this deprecation is poorly motivated. Yours Truly, Free -- 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
Re: [android-developers] One process, two live Application objects?
On Sun, Oct 31, 2010 at 11:12 AM, Mark Murphy mmur...@commonsware.comwrote: On Sun, Oct 31, 2010 at 2:07 PM, Dianne Hackborn hack...@android.com wrote: As far as using Application to clean up statics -- this simply doesn't really make sense, for the reasons above. For a legacy application with statics that can't be re-used again in the same process, your only choice is probably to just self-kill your process when the user leave the game. Wait, what? I was under the distinct impression we should not be killing processes this way. You should not be, but if you have a bunch of legacy code that can't cleanly work without doing so... well, sometimes you need to compromise. This does have other negative consequences, so nobody writing Android applications should do this. Games, though, games are sometimes so special. -- 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
Re: [android-developers] Intent resolution: supplying action+data where filter had only action, causes it to fail
On Sun, Oct 31, 2010 at 7:44 AM, Mark Murphy mmur...@commonsware.comwrote: I suspect that you are confusing intent-filter characteristics with IntentFilter characteristics. intent-filter and IntentFilter have the same characteristics. In fact intent-filter is just the XML syntax for creating an IntentFiler object. -- 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
Re: [android-developers] Re: render an activity to an image file.
On Sun, Oct 31, 2010 at 3:13 AM, Lance Nanek lna...@gmail.com wrote: Never tried it, but first thing I would try is to just make a Bitmap the size of the screen, construct a Canvas using the constructor that takes a Bitmap, then get the Window from the Activity, then get the decor View from that, and pass the Canvas to its onDraw. Yes, that works fine. -- 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
Re: [android-developers] Re: Content Service Crash
The system shouldn't crash, but your code is broken. Your Uri.parse(refreshChange) is creating a Uri that is not actually a content: URI. You need to provide a Uri that is a full content: URI (with authority) to the data you want to observe. On Sun, Oct 31, 2010 at 7:58 AM, oriharel ori.ha...@gmail.com wrote: the triggering code is: getContentResolver().registerContentObserver(Uri.parse(refreshChange), false, _refreshObserver); On Oct 31, 11:38 am, oriharel ori.ha...@gmail.com wrote: I get weird exception: 10-31 09:09:51.308: ERROR/ContentService(59): Content Service Crash 10-31 09:09:51.308: ERROR/ContentService(59): java.lang.NullPointerException 10-31 09:09:51.308: ERROR/ContentService(59): at android.content.ContentService $ObserverNode.collectObserversLocked(ContentService.java:620) 10-31 09:09:51.308: ERROR/ContentService(59): at android.content.ContentService.notifyChange(ContentService.java:134) 10-31 09:09:51.308: ERROR/ContentService(59): at android.content.IContentService$Stub.onTransact(IContentService.java: 91) 10-31 09:09:51.308: ERROR/ContentService(59): at android.content.ContentService.onTransact(ContentService.java:83) 10-31 09:09:51.308: ERROR/ContentService(59): at android.os.Binder.execTransact(Binder.java:288) 10-31 09:09:51.308: ERROR/ContentService(59): at dalvik.system.NativeStart.run(Native Method) after that - only a restart of the emulator helps. anyone knows what is this? Ori -- 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: Dialog not displayed properly in Landscape mode
You need a different layout for your dialog for the landscape mode. On Oct 31, 3:27 pm, Dilli dilliraomca...@gmail.com wrote: Hi all, @landscape mode In messaging application screen i am trying to attach a audio , it pop up a dialog and, at the same time some incoming call came, after disconnecting the call the popup dialog displayed (half) not full dialog ( only header of dialog visible no buttons are visible to select or cancel), It is not happening in the portraite mode, how to solve it. need help Regards, Dilli -- 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 do i create a donate menu button
You need to launch the default browser with your donation URL. After that, the browser app should take care of the further actions. To launch the Browser, you need to use a VIEW intent like this. http://developer.android.com/guide/appendix/g-app-intents.html Action - View Uri - Your donation URL On Oct 31, 12:42 pm, Raziel23x raziel...@gmail.com wrote: Can you explain more I am still new to this mixture I have not worked with browser activity On Oct 30, 11:26 am, Kumar Bibek coomar@gmail.com wrote: You need to have Internet permission. Instead of using thewebview, you are better off using the Bowser activity for this. On Sat, Oct 30, 2010 at 11:23 PM, Raziel23x raziel...@gmail.com wrote: I am having trouble creating a donate menu button but I am having trouble I tried doing it as a webview but my application is the use of the listview this Donation Menu item is the only item that requires the internet permission everything else is internal workings. [CODE]private static final int MENU_DONATE = 0;[/CODE] [CODE] /* Creates the menu items */ public boolean onCreateOptionsMenu(Menu menu) { menu.add(0, MENU_DONATE, 0, Home); return true; } /* Handles item selections */ �...@override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case MENU_DONATE: myweb.loadUrl( https://www.paypal.com/cgi-bin/webscr?cmd=_s- xclickhosted_button_id=A2L64XS44ZQ9S); return true; } return true; }[/CODE] but it is not working and giving me errors what do i need to fix this and get it to work correctly -- 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%2Bunsubs cr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Kumar Bibekhttp://techdroid.kbeanie.comhttp://www.kbeanie.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
[android-developers] Re: Adventures with LVL
I have only had one customer complain of a problem since I upgraded to LVL. And who knows why that is happening as they could have changed emails since the original purchase under the old system or part of the problem which seems to be going on with the Market these days. Also it was my understanding that the default policy was to check the first few days so authorization could be canceled if a refund was done. But my app is still checking after several weeks. Like a lot of Android documentation there needs to be more information on using LVL. And I also have an alternate third party system from my web site and haven't had any problems with it other than the eseller failing to tell me that the second try on a charge went through. Brian On Oct 31, 7:43 am, Pent tas...@dinglisch.net wrote: If you have published an app including LVL, what are your experiences? 99.9% no problem. Has it caused bad feedback from your users? Once or twice, a long time ago. But my implementation is very forgiving. It doesn't care if the licence can't be verified for the first 7 days, and only needs one positive response (per install). It validates in the background so most people don't even notice it. I also have a backup licence-code system they can use if all else fails (I needed it for paypal sales). Pent -- 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: device fingerprinting
Isn't LVL locked to the user's Google email? I thought that was the idea though they you can use device IDs as an option. Linked to the account it allows the user to install the app again if they get a different device. The ID option would be for a single device policy though they could stand to flesh out the documentation on LVL a bit more. On Oct 30, 3:01 pm, DanH danhi...@ieee.org wrote: Well, there's the IMEI, the IMSI, and the ANDROID_ID. Alas, the ANDROID_ID isn't unique (and is in fact identical on many Droid2 units). On Oct 30, 12:41 pm, bagelboy greg.do...@gmail.com wrote: Hello Devs, I'm working on an LVL implementation and I want to use as many different device identifiers as I can. I have considered using IMEI numbers but I've discarded that because a) it's intrusive and b) not all devices will have them. What might I use to fingerprint a phone for license verification? As an aside, how have your experiences with LVL been so far? Any pitfalls? I'm not asking for anyone to share their implementation details as that would give the hackers ideas. -BB -- 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 do i create a donate menu button
An alternative to this is to do my trick: Just create your own donation app and link to it on Market - no need for any permission, just: startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(market://details?id=se.petersson.freebeer))); Best / Jonas On 10/30/2010 05:27 PM, Mark Murphy wrote: +1 On Sat, Oct 30, 2010 at 11:26 AM, Kumar Bibekcoomar@gmail.com wrote: You need to have Internet permission. Instead of using thewebview, you are better off using the Bowser activity for this. On Sat, Oct 30, 2010 at 11:23 PM, Raziel23xraziel...@gmail.com wrote: I am having trouble creating a donate menu button but I am having trouble [...] myweb.loadUrl(https://www.paypal.com/cgi-bin/webscr?cmd=_s- xclickhosted_button_id=A2L64XS44ZQ9S); -- 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 create an aircraft-mounted-liked compass?
Does an Android 'sensor' have a compass built in? I thought it was just a motion sensor, portrait/landscape, etc., and not a true compass? And as far as I know, the gps device is a coordinate/point location thing, not a compass thing. How would the phone/device actually know its facing North? Finally, I'm not sure if this would help you out, but take a look at this article (its in three parts, link is part one), that describes a scrollable surface view: http://www.droidnova.com/create-a-scrollable-map-with-cells-part-i,654.html Not sure if it can help you or not, but maybe a place to start? On Oct 31, 1:51 am, josef.hardi josef.ha...@gmail.com wrote: I want to create a non-generic compass that uses rotating directions instead of a rotating needle as in the conventional compass. The drawing is like the illustration below. | ' ' W ' ' ' ' ' N ' ' ' ' ' E ' ' ' ' ' S ' ' ' (shift a bit to the east) | ' ' ' ' ' N ' ' ' ' ' E ' ' ' ' ' S ' ' ' ' ' W The needle (depict as |) is fixed and the direction string should have some sort of rotation effect that immediately relocates each sign or character from one tip of the edge to the opposite edge. Of course, the movement follows the reading of the Android sensor. Does anyone has an idea how to implement this? I stumbled with how I create the rotation effect and connect the string's movement with the sensor reading. Thanks /Joe -- 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: One process, two live Application objects?
From Dianne, That said, my recommendation to everyone is to just not subclass Application. This gives you *nothing* you can't do in other, better ways. In particular, a singleton directly represents what is really going on (it lives for the life of the process after the first need for it) and helps keep code more modular. I regret that the Application class was ever introduced; it was a compromise to make people more comfortable with there being some kind of traditional main application concept, but in fact it doesn't really fit in with how Android works so ends up just causing problems. As far as using Application to clean up statics -- this simply doesn't really make sense, for the reasons above. I confess to using an Application subclass to clean up statics in my application and I would be glad to repent if I knew how. Dianne, is there a sample application in the SDK (or elsewhere) showing the best practice for collecting statics in a static singleton? The SDK documentation about singletons at http://developer.android.com/resources/faq/framework.html seems to suggest the use of an Application subclass: There are advantages to using a static Singleton, such as you can refer to them without casting getApplication() to an application-specific class, or going to the trouble of hanging an interface on all your Application subclasses so that your various modules can refer to that interface instead. But, the life cycle of a static is not well under your control; so to abide by the life-cycle model, the application class should initiate and tear down these static objects in the onCreate() and onTerminate() methods of the Application Class. On Oct 31, 2:07 pm, Dianne Hackborn hack...@android.com wrote: Only one Application per-.apk-per-process is created, ever. If you use android:process to have multiple .apks sharing the same process, each .apk will have its own Application instantiated in the process. If you use android:process to have an .apk run in multiple processes, each process will get its own Application instance. Application.onTerminate() is *never* called. This function is there for environments where processes are emulated, which is not any production device or the emulator. But it doesn't matter that it isn't called because... well, Application lives for the lifetime of the process, and the process goes away by the OOM killer killing it, which cleans up Application and everything else related to the process without any user space code for it running. Now it is conceivable that there is some case where if a process is left completely empty (with no app components) for a while, and GCs, the data about the loaded process may get GCed as well and have to be recreated. I don't see how this can happen off-hand (there are a number of ways non-weak-references are held between these things), but I can't say for certain there is no such bug here. That said, my recommendation to everyone is to just not subclass Application. This gives you *nothing* you can't do in other, better ways. In particular, a singleton directly represents what is really going on (it lives for the life of the process after the first need for it) and helps keep code more modular. I regret that the Application class was ever introduced; it was a compromise to make people more comfortable with there being some kind of traditional main application concept, but in fact it doesn't really fit in with how Android works so ends up just causing problems. As far as using Application to clean up statics -- this simply doesn't really make sense, for the reasons above. For a legacy application with statics that can't be re-used again in the same process, your only choice is probably to just self-kill your process when the user leave the game. That is, when the game activity is finished. If you can reset your statics after the game is over, then at least instead of killing it you can do that when the activity is finished. But this needs to be driven by Activity, not Application. On Sun, Oct 31, 2010 at 12:34 AM, Mark Murphy mmur...@commonsware.comwrote: In a comment on an epic StackOverflow question-and-answer, a gentleman who I will call Tim has outlined a scenario he says he is running into, one I have some difficulty believing. Reading somewhat between the lines, the flow would appear to be this: 1. User taps on an activity icon in the launcher 2. Process starts up 3. Application object is put in that process -- and a custom Application object loads an NDK library which initializes some statics/singletons 4. User uses application 5. User abandons application (e.g., HOME) 6. Later, user returns to application, before the first process is killed or recycled for use with another app 7. A second Application object is created, in the same process, before the first Application object is called with onTerminate() This screws things up for
Re: [android-developers] button click
I'm going the crystal ball way here. You need to take the current content of text view (or save it somewhere) and when you press the button next time, take that content (or it's id or something like that, really depends on what you are trying to do and how) and then select next content based on current one. If you are trying to show, for example, tags from your xml, I would suggest parsing the whole file on first button press and save the tags along with their ids (reflecting their position in the file), then just selecting next id on next button presses. Best regards, Filip Havlicek 2010/10/31 TreKing treking...@gmail.com Your question is difficult to understand. You should try to clarify and rephrase so we can better understand the problem you're having. - 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.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://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] Re: Intent resolution: supplying action+data where filter had only action, causes it to fail
For actions, the field will not be tested if no values have been given (treating it as a wildcard); if no data characteristics are specified, however, then the filter will only match intents that contain no data. Thanks for your reply... If you look at the code, I did specify the action in both the Intent and the Intent filter: ALERT_ME_ACTION Correct me if I am mistaken but it is intuitive to expect that if the Actions match then that should be the overriding consideration. It is analogous to a message or a method call. If the name of the method matches, then the case no data is also valid and handled by the same method. I suspect that you are confusing intent-filter characteristics with IntentFilter characteristics. I think one is just a convenient way of specifying in XML and the other is a way of specifying the same thing dynamically. This is also true of Views. To get it to work with the data (an id that is simply a String), what mime type should I specify in the intent filter? Data is not an id that is simply a String. Data is a Uri. Please use a string extra for an arbitrary string. Yes, the data is a Uri Here is the value I was using: content://com.iovercomer/alerts/99 I meant that in the line Intent inte = registerReceiver(receiver, new IntentFilter(ALERT_ME_ACTION)); If I am now instead trying to specify public IntentFilter (String action, String dataType) http://developer.android.com/reference/android/content/IntentFilter.html#IntentFilter%28java.lang.String,%20java.lang.String%29 the MIME type is specified as a String. if it is to be lower case, what would I use to pass in? Diahn Hackborn mentioned that the data part is used to distinguish PendingIntents. Since I am using PendingIntent.FLAG_UPDATE_CURRENT, I want the PendingIntent associated with content://com.iovercomer/alerts/99 to be different from the PendingIntent for content://com.iovercomer/alerts/100 Hence I am not simply passing it in as an extra in the Bundle. 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
Re: [android-developers] Re: how do i create a donate menu button
On Sat, Oct 30, 2010 at 11:23 PM, Raziel23x raziel...@gmail.com wrote: I am having trouble creating a donate menu button but I am having trouble Try PayPal android library: https://www.x.com/community/ppx/xspaces/mobile/mobile_ec I've played with it a bit and it's far better than redirecting to website (as it uses native android UI) -- 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: Intent resolution: supplying action+data where filter had only action, causes it to fail
On Sun, Oct 31, 2010 at 3:01 PM, longingtoadopt.com anil.r...@gmail.comwrote: Thanks for your reply... If you look at the code, I did specify the action in both the Intent and the Intent filter: ALERT_ME_ACTION Correct me if I am mistaken but it is intuitive to expect that if the Actions match then that should be the overriding consideration. It is analogous to a message or a method call. If the name of the method matches, then the case no data is also valid and handled by the same method. Whether or not it is intuitive, this is the way it works. If you want an analogy to a method call, consider this to be overloading. A method call ACTION_SOMETHING with argument content://foo is a different method than ACTION_SOMETHING with no argument. Yes, the data is a Uri Here is the value I was using: content://com.iovercomer/alerts/99 I meant that in the line Intent inte = registerReceiver(receiver, new IntentFilter(ALERT_ME_ACTION)); If I am now instead trying to specify public IntentFilter (String action, String dataType) http://developer.android.com/reference/android/content/IntentFilter.html#IntentFilter%28java.lang.String,%20java.lang.String%29 the MIME type is specified as a String. if it is to be lower case, what would I use to pass in? If you don't have a MIME type, don't use anything. Let's back up... *why* are you doing this? Unless you need intent resolution to interact with other applications, my first suggestion would be to simply not use it. I also see a red flag in that you are talking about what looks like alarms but using registerReceiver(). Generally you wouldn't use these two together -- the only reason to use an alarm is to allow your application to execute at the time even if it is not currently running. Using registerReceiver() means that your application needs to be actively running with the registration to receive the broadcast. Generally it just doesn't make sense to mix both of these. If you are doing an alarm, usually the PendingIntent you create is an explicit Intent set to the ComponentName of a receiver component declared in your manifest. For that case, you don't need an intent-filter at all, and in fact anything you specify for it will be ignored (since you have already specified the exact component you want to receive it). Diahn Hackborn mentioned that the data part is used to distinguish PendingIntents. Since I am using PendingIntent.FLAG_UPDATE_CURRENT, I want the PendingIntent associated with content://com.iovercomer/alerts/99 to be different from the PendingIntent for content://com.iovercomer/alerts/100 Hence I am not simply passing it in as an extra in the Bundle. Explicitly specify the component to receive the intent. Or if you *really* need to have matching done to send to a registerReceiver(), register with an IntentFilter matching scheme content and authority com.iovercomer. But I suspect that is not actually what you want. -- 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 can I create an aircraft-mounted-liked compass?
Just to answer my own question, Compass functionality is built into some (all?) devices. I noticed that the up-coming T-Mobile Comet has compass functionality. On Oct 31, 2:06 pm, Adrian Romanelli adrian.romane...@gmail.com wrote: Does an Android 'sensor' have a compass built in? I thought it was just a motion sensor, portrait/landscape, etc., and not a true compass? And as far as I know, the gps device is a coordinate/point location thing, not a compass thing. How would the phone/device actually know its facing North? Finally, I'm not sure if this would help you out, but take a look at this article (its in three parts, link is part one), that describes a scrollable surface view:http://www.droidnova.com/create-a-scrollable-map-with-cells-part-i,65... Not sure if it can help you or not, but maybe a place to start? On Oct 31, 1:51 am, josef.hardi josef.ha...@gmail.com wrote: I want to create a non-generic compass that uses rotating directions instead of a rotating needle as in the conventional compass. The drawing is like the illustration below. | ' ' W ' ' ' ' ' N ' ' ' ' ' E ' ' ' ' ' S ' ' ' (shift a bit to the east) | ' ' ' ' ' N ' ' ' ' ' E ' ' ' ' ' S ' ' ' ' ' W The needle (depict as |) is fixed and the direction string should have some sort of rotation effect that immediately relocates each sign or character from one tip of the edge to the opposite edge. Of course, the movement follows the reading of the Android sensor. Does anyone has an idea how to implement this? I stumbled with how I create the rotation effect and connect the string's movement with the sensor reading. Thanks /Joe -- 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 create an aircraft-mounted-liked compass?
I do wonder how accurate it could possibly be, however. Your standard compass can be led astray by a steel belt buckle, so it's hard to see how a compass inside a phone, with batteries, printed circuits, electrons whizzing around, etc, could be very accurate at all. On Oct 31, 5:35 pm, Adrian Romanelli adrian.romane...@gmail.com wrote: Just to answer my own question, Compass functionality is built into some (all?) devices. I noticed that the up-coming T-Mobile Comet has compass functionality. On Oct 31, 2:06 pm, Adrian Romanelli adrian.romane...@gmail.com wrote: Does an Android 'sensor' have a compass built in? I thought it was just a motion sensor, portrait/landscape, etc., and not a true compass? And as far as I know, the gps device is a coordinate/point location thing, not a compass thing. How would the phone/device actually know its facing North? Finally, I'm not sure if this would help you out, but take a look at this article (its in three parts, link is part one), that describes a scrollable surface view:http://www.droidnova.com/create-a-scrollable-map-with-cells-part-i,65... Not sure if it can help you or not, but maybe a place to start? On Oct 31, 1:51 am, josef.hardi josef.ha...@gmail.com wrote: I want to create a non-generic compass that uses rotating directions instead of a rotating needle as in the conventional compass. The drawing is like the illustration below. | ' ' W ' ' ' ' ' N ' ' ' ' ' E ' ' ' ' ' S ' ' ' (shift a bit to the east) | ' ' ' ' ' N ' ' ' ' ' E ' ' ' ' ' S ' ' ' ' ' W The needle (depict as |) is fixed and the direction string should have some sort of rotation effect that immediately relocates each sign or character from one tip of the edge to the opposite edge. Of course, the movement follows the reading of the Android sensor. Does anyone has an idea how to implement this? I stumbled with how I create the rotation effect and connect the string's movement with the sensor reading. Thanks /Joe -- 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: One process, two live Application objects?
On Sun, Oct 31, 2010 at 2:08 PM, greg sep...@eduneer.com wrote: I confess to using an Application subclass to clean up statics in my application and I would be glad to repent if I knew how. Dianne, is there a sample application in the SDK (or elsewhere) showing the best practice for collecting statics in a static singleton? The SDK documentation about singletons at http://developer.android.com/resources/faq/framework.html seems to suggest the use of an Application subclass: There are advantages to using a static Singleton, such as you can refer to them without casting getApplication() to an application-specific class, or going to the trouble of hanging an interface on all your Application subclasses so that your various modules can refer to that interface instead. But, the life cycle of a static is not well under your control; so to abide by the life-cycle model, the application class should initiate and tear down these static objects in the onCreate() and onTerminate() methods of the Application Class. Gah I'll get that removed from the documentation. It is just totally wrong to rely on onTerminate. There is just fundamentally no reason to worry about cleaning up your statics when the way your process goes away is by killing it. There isn't anything to clean up. And anyway, onTerminate never gets called. Implementing a singleton is not special on Android; you just do it the same way you would elsewhere. Have a static method that returns the singleton: class Singleton { static final Object sLock = new Object(); static final Singleton sInstance; static getInstance() { synchronized (sLock) { if (sInstance == null) { sInstance = new Singleton(); } return sInstance; } } -- 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 can I create an aircraft-mounted-liked compass?
In answer to the original query, there are four conceptual ways I can think of to do the job: 1) Paint the letters and hash marks under program control 2) Have an image that goes, say W..N..E..S..W..N..E and slide it back and forth as needed 3) Have images W, N, E, S, and several .. images of different lengths, and tile together the desired image. 4) Have about 32 complete separate images and select one On Oct 31, 3:51 am, josef.hardi josef.ha...@gmail.com wrote: I want to create a non-generic compass that uses rotating directions instead of a rotating needle as in the conventional compass. The drawing is like the illustration below. | ' ' W ' ' ' ' ' N ' ' ' ' ' E ' ' ' ' ' S ' ' ' (shift a bit to the east) | ' ' ' ' ' N ' ' ' ' ' E ' ' ' ' ' S ' ' ' ' ' W The needle (depict as |) is fixed and the direction string should have some sort of rotation effect that immediately relocates each sign or character from one tip of the edge to the opposite edge. Of course, the movement follows the reading of the Android sensor. Does anyone has an idea how to implement this? I stumbled with how I create the rotation effect and connect the string's movement with the sensor reading. Thanks /Joe -- 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] One process, two live Application objects?
Given this strong recommendation against subclassing Application, I'll look to avoid doing so in future projects, but when you say [subclassing Application] gives you *nothing* you can't do in other, better ways. the main benefit that comes to my mind is that you can expose static accessors for singletons that need a basic context (nothing more than the application context provides), without being required to pass it in. This occurs frequently in my code - I often have a number of independent static classes that deal with things like image caching. These types of classes invariably need a context during initialization (eg. to open databases or files) even if they don't need them at any later time. Objects within the app that aren't tied to any particular component's lifecycle are often the very same objects that need to interact with caches - ensuring that every such object has access (possibly indirectly of course) to a suitable context with which to access the cache will be a lot of work. In this case, I'm pretty sure that subclassing the Application object is giving me something; it's reducing the amount state that my objects need to carry (state which is almost always redundant since only one call to the accessor will ever need to create the singleton; it also allows me to avoid a synchronized lazy instantiation that would otherwise be necessary for some singletons). I think what's essentially providing this benefit, isn't the subclass of Application per se, but the presence of an reliable event (the call to Application.onCreate in this case) that precedes the instantiation of all other components, and which signals that the availability of the Application context. Without this, everything else carries the burden of providing an initializing context. My understanding of application start-up very incomplete, perhaps it's the provision of such an event (in whatever form) that causes difficulties at a platform level, and/or maybe there's some better way that bypasses the Application class. Tom. -- 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] Vertex buffer object corruption on MSM720xa
Hi there, i was refactoring some of my code today and wanted to minimze buffer object binds. My use case is it to bind a vertex buffer/index buffer pair once and batch up rendering as much as possible. Each batch is uploaded to the currently bound vbo. This works as expected on all tested devices (Nexus One, Droid, Samsung Galaxy) but fails on the HTC Hero with stock Android 1.5. I haven't updated the Hero to test exactly that kind of problems. I have compiled a small in depth description with a reproduceable test example. Both can be found at: http://www.badlogicgames.com/wiki/index.php/Severe_Bug_Updating_Already_Bound_Buffer_Object#Sample_Code I consulted with a couple of people whom i consider OpenGL experts and they all agreed that the way i handle the vbo/ibo is indeed correct and standard compliant. It would help if some people with an update Hero could try it out and see whether the problem persists. Should i file a bug on the Android bug tracker? -- 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] Drag and Drop List Simple Example
I struggled with finding and using a simple drag and drop list. I figured others would be looking for the same type of thing since android doesn't currently provide one. A simple Drag and Drop List Example can be found at http://ericharlow.blogspot.com/2010/10/experience-android-drag-and-drop-list.html. Hope this is helpful to others. -- 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 figure out who is causing GC on my device?
Thank you very much for the tip. I have restrasted my phone and made sure that my app is not running. Now I see two processes causing the GC. system1103 1013 221560 49288 S system_server app_381872 1013 146228 23724 R com.android.email D/dalvikvm( 1103): GC_EXPLICIT freed 3427 objects / 138696 bytes in 103ms D/dalvikvm( 1872): GC_FOR_MALLOC freed 9738 objects / 521552 bytes in 58ms D/dalvikvm( 1103): GC_EXPLICIT freed 3425 objects / 138488 bytes in 106ms D/dalvikvm( 1872): GC_FOR_MALLOC freed 9762 objects / 522360 bytes in 60ms D/dalvikvm( 1103): GC_EXPLICIT freed 3374 objects / 136712 bytes in 100ms D/dalvikvm( 1103): GC_EXPLICIT freed 3412 objects / 138048 bytes in 102ms D/dalvikvm( 1872): GC_FOR_MALLOC freed 9822 objects / 525296 bytes in 60ms D/dalvikvm( 1103): GC_EXPLICIT freed 3393 objects / 137328 bytes in 101ms D/dalvikvm( 1872): GC_FOR_MALLOC freed 9912 objects / 528128 bytes in 60ms D/dalvikvm( 1103): GC_EXPLICIT freed 3399 objects / 137480 bytes in 102ms D/dalvikvm( 1872): GC_FOR_MALLOC freed 9730 objects / 522016 bytes in 60ms D/dalvikvm( 1103): GC_EXPLICIT freed 3483 objects / 141184 bytes in 102ms D/dalvikvm( 1872): GC_FOR_MALLOC freed 9747 objects / 520984 bytes in 59ms On Oct 28, 4:24 pm, William Ferguson william.ferguson...@gmail.com wrote: Other than the fact that it consumes CPU that could be used by your app. On Oct 29, 6:27 am, Kostya Vasilyev kmans...@gmail.com wrote: Run adb shell and then ps to get the list of running processes. Then you just need to match by process id's - 1344 and 1103. However - each process has its own copy of Dalvik Java VM, and its own memory address space, so GC in other applications should not be affecting yours. -- Kostya 29.10.2010 0:06, dipu пишет: I am getting GC on my device (moto original Droid with 2.2) continuously, even when I am not using it for a while. How can I figure out which application is causing such continuous GC. D/dalvikvm( 1344): GC_FOR_MALLOC freed 9881 objects / 527000 bytes in 57ms D/dalvikvm( 1103): GC_EXPLICIT freed 3407 objects / 138696 bytes in 104ms D/dalvikvm( 1344): GC_FOR_MALLOC freed 9838 objects / 525944 bytes in 58ms D/dalvikvm( 1103): GC_EXPLICIT freed 3400 objects / 137904 bytes in 104ms D/dalvikvm( 1344): GC_FOR_MALLOC freed 9723 objects / 521272 bytes in 59ms D/dalvikvm( 1103): GC_EXPLICIT freed 3381 objects / 137344 bytes in 104ms D/dalvikvm( 1344): GC_FOR_MALLOC freed 9750 objects / 521624 bytes in 58ms D/dalvikvm( 1103): GC_EXPLICIT freed 3342 objects / 135624 bytes in 105ms D/dalvikvm( 1344): GC_FOR_MALLOC freed 9861 objects / 527728 bytes in 58ms D/dalvikvm( 1103): GC_EXPLICIT freed 3402 objects / 138024 bytes in 106ms Thanks, Dipu -- Kostya Vasilyev -- WiFi Manager + pretty widget --http://kmansoft.wordpress.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
Re: [android-developers] Re: How to figure out who is causing GC on my device?
Try putting your phone in airplane mode and see what happens. On Oct 31, 2010 5:39 PM, dipu contac...@gmail.com wrote: Thank you very much for the tip. I have restrasted my phone and made sure that my app is not running. Now I see two processes causing the GC. system1103 1013 221560 49288 S system_server app_381872 1013 146228 23724 R com.android.email D/dalvikvm( 1103): GC_EXPLICIT freed 3427 objects / 138696 bytes in 103ms D/dalvikvm( 1872): GC_FOR_MALLOC freed 9738 objects / 521552 bytes in 58ms D/dalvikvm( 1103): GC_EXPLICIT freed 3425 objects / 138488 bytes in 106ms D/dalvikvm( 1872): GC_FOR_MALLOC freed 9762 objects / 522360 bytes in 60ms D/dalvikvm( 1103): GC_EXPLICIT freed 3374 objects / 136712 bytes in 100ms D/dalvikvm( 1103): GC_EXPLICIT freed 3412 objects / 138048 bytes in 102ms D/dalvikvm( 1872): GC_FOR_MALLOC freed 9822 objects / 525296 bytes in 60ms D/dalvikvm( 1103): GC_EXPLICIT freed 3393 objects / 137328 bytes in 101ms D/dalvikvm( 1872): GC_FOR_MALLOC freed 9912 objects / 528128 bytes in 60ms D/dalvikvm( 1103): GC_EXPLICIT freed 3399 objects / 137480 bytes in 102ms D/dalvikvm( 1872): GC_FOR_MALLOC freed 9730 objects / 522016 bytes in 60ms D/dalvikvm( 1103): GC_EXPLICIT freed 3483 objects / 141184 bytes in 102ms D/dalvikvm( 1872): GC_FOR_MALLOC freed 9747 objects / 520984 bytes in 59ms On Oct 28, 4:24 pm, William Ferguson william.ferguson...@gmail.com wrote: Other than the fact that it consumes CPU that could be used by your app. On Oct 29, 6:27 am,... -- 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: for loop drawing first graphics to x0 y0 if more than 1 iteration
Are you sure you are not modifying any of those values from another thread. On Oct 31, 2010 11:07 AM, acr acr...@gmail.com wrote: So, It has nothing to do with the loop if I add the images manually I get the very same result the first graphic is being drawn to x0 y0 in my code. what I have is a column of 7 graphics(_theGrid) and when I remove a graphic from it, a new graphic is created in _toAdd. What my code is doing taking what ever is in _toAdd array and adding it to _theGrid array. If I only add the first graphic, the graphic is drawn CORRECTLY to x63 y63 if I add both, the first is drawn INCORRECTLY to x0 y0, and the second graphic is drawn CORRECTLY to x63 y126 if I add a third, the the first TWO are drawn INCORRECTLY and the last is drawn correctly. I have tried invalidate and postInvalidate with no success and have hit a wall. Can anyone here help me remedy this problem, I am totally stumped here :? I am obviously missing something Im just not sure what. //FIRST GRAPHIC TO ADD FROM THE _toAdd ARRAY x=63; y=63; graphic.getGridCoordinates().setGrid1X(x); graphic.getGridCoordinates().setGrid1Y(y); _toMove.add(_toAdd.get(0)); _theGrid.add(0,_toAdd.get(0)); _theGrid.get(0).setAMT(_theGrid.get(0).getAMT()+2); _theGrid.get(0).setMV(11); _toAdd.remove(_theGrid.get(0)); //SECOND GRAPHIC TO ADD FROM THE _toAdd ARRAY x=63; y=126; graphic.getGridCoordinates().setGrid1X(x); graphic.getGridCoordinates().setGrid1Y(y); _toMove.add(_toAdd.get(0)); _theGrid.add(0,_toAdd.get(0)); _theGrid.get(0).setAMT(_theGrid.get(0).getAMT()+2); _theGrid.get(0).setMV(12); _toAdd.remove(_theGrid.get(0)); I have the following running in OnDraw(Canvas canvas) non stop bitmap = _theGrid.get(0).getBitmap(); gridcoords = _theGrid.get(0).getGridCoordinates(); canvas.drawBitmap(bitmap, gridcoords.getGrid1X(), gridcoords.getGrid1Y(), null); On Oct 31, 8:16 am, acr acr...@gmail.com wrote: Now I even tried to change my loop to go throu... -- 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 u help me to find the mistake? i can't run this program.
I'm going to guess that asking for the SEARCH_SERVICE and casting it to a SensorManager is not going to go well for you. You're probably getting a NoSuchMethodException, yes? - dave www.androidbook.com On Oct 29, 12:01 am, 菠菜冬 huabeiyipil...@gmail.com wrote: package com.android.CirclingCounter; import java.util.List; import android.app.Activity; import android.content.Context; import android.hardware.Sensor; import android.hardware.SensorEvent; import android.hardware.SensorEventListener; import android.hardware.SensorManager; import android.os.Bundle; import android.util.Log; import android.widget.TextView; public class CirclingCounter extends Activity { private SensorManager mSensorManager01; private TextView displayTextView; int i=0; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); displayTextView=(TextView)findViewById(R.id.display); displayTextView.setText(i); mSensorManager01=(SensorManager)getSystemService(Context.SEARCH_SERVICE); } private final SensorEventListener mSensorListener= new SensorEventListener() { @Override public void onAccuracyChanged(Sensor sensor,int accuracy) { } @Override public void onSensorChanged(SensorEvent event) { if(event.sensor.getType()==Sensor.TYPE_ORIENTATION) { float fPitchAngle=event.values[SensorManager.DATA_Y]; if(fPitchAngle-120) { i++; displayTextView.setText(i); } else { } } } }; @Override protected void onResume() { ListSensor sensors=mSensorManager01.getSensorList(Sensor.TYPE_ORIENTATION); mSensorManager01.registerListener(mSensorListener, sensors.get(0),SensorManager.SENSOR_DELAY_NORMAL); super.onResume(); } @Override protected void onPause() { mSensorManager01.unregisterListener(mSensorListener); super.onPause(); } } -- 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: Drag and Drop List Simple Example
Thanks for sharing. Can also look at http://stackoverflow.com/questions/2909311/android-list-view-drag-and-drop-sort http://github.com/commonsguy/cwac-touchlist for another example On Nov 1, 8:33 am, ericharlow eric.b.har...@gmail.com wrote: I struggled with finding and using a simple drag and drop list. I figured others would be looking for the same type of thing since android doesn't currently provide one. A simple Drag and Drop List Example can be found athttp://ericharlow.blogspot.com/2010/10/experience-android-drag-and-dr Hope this is helpful to others. -- 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: for loop drawing first graphics to x0 y0 if more than 1 iteration
Thanks for the reply Miguel, Im positive I went through all of the lines just to double check. its getting the incorrect coordinates from the initial values of x and y where graphic.getGridCoordinates().setGrid1Y(y) sets to. but when I print lines via logcat to show the current getGridCoordinates().setGrid1Y(y) they show correct coordinates when I add the graphic but only the second graphic draws to the correct coordinates. I feel like I tried everything and keep going in circles. On Oct 31, 9:19 pm, Miguel Morales therevolti...@gmail.com wrote: Are you sure you are not modifying any of those values from another thread. On Oct 31, 2010 11:07 AM, acr acr...@gmail.com wrote: So, It has nothing to do with the loop if I add the images manually I get the very same result the first graphic is being drawn to x0 y0 in my code. what I have is a column of 7 graphics(_theGrid) and when I remove a graphic from it, a new graphic is created in _toAdd. What my code is doing taking what ever is in _toAdd array and adding it to _theGrid array. If I only add the first graphic, the graphic is drawn CORRECTLY to x63 y63 if I add both, the first is drawn INCORRECTLY to x0 y0, and the second graphic is drawn CORRECTLY to x63 y126 if I add a third, the the first TWO are drawn INCORRECTLY and the last is drawn correctly. I have tried invalidate and postInvalidate with no success and have hit a wall. Can anyone here help me remedy this problem, I am totally stumped here :? I am obviously missing something Im just not sure what. //FIRST GRAPHIC TO ADD FROM THE _toAdd ARRAY x=63; y=63; graphic.getGridCoordinates().setGrid1X(x); graphic.getGridCoordinates().setGrid1Y(y); _toMove.add(_toAdd.get(0)); _theGrid.add(0,_toAdd.get(0)); _theGrid.get(0).setAMT(_theGrid.get(0).getAMT()+2); _theGrid.get(0).setMV(11); _toAdd.remove(_theGrid.get(0)); //SECOND GRAPHIC TO ADD FROM THE _toAdd ARRAY x=63; y=126; graphic.getGridCoordinates().setGrid1X(x); graphic.getGridCoordinates().setGrid1Y(y); _toMove.add(_toAdd.get(0)); _theGrid.add(0,_toAdd.get(0)); _theGrid.get(0).setAMT(_theGrid.get(0).getAMT()+2); _theGrid.get(0).setMV(12); _toAdd.remove(_theGrid.get(0)); I have the following running in OnDraw(Canvas canvas) non stop bitmap = _theGrid.get(0).getBitmap(); gridcoords = _theGrid.get(0).getGridCoordinates(); canvas.drawBitmap(bitmap, gridcoords.getGrid1X(), gridcoords.getGrid1Y(), null); On Oct 31, 8:16 am, acr acr...@gmail.com wrote: Now I even tried to change my loop to go throu... -- 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 u help me to find the mistake? i can't run this program.
No, assuming he doesn't get an error even earlier, I'm sure he gets a ClassCastException on that line. That happens before it even checks for the method. NoSuchMethodException is somewhat more esoteric The advice he actually needs is beyond the scope of this group. But I'll sum it up: Learn to use the debugger. Running it under the debugger, set up to stop on RuntimeException and Error, would leave it stopped at the problem line, with a ClassCastException on the stack, and thus neatly answer your question for you, in far less time than it took to ask this group. And that skill will pay off many times a day. On Oct 31, 6:39 pm, davemac davemac...@gmail.com wrote: I'm going to guess that asking for the SEARCH_SERVICE and casting it to a SensorManager is not going to go well for you. You're probably getting a NoSuchMethodException, yes? - davewww.androidbook.com On Oct 29, 12:01 am, 菠菜冬 huabeiyipil...@gmail.com wrote: package com.android.CirclingCounter; import java.util.List; import android.app.Activity; import android.content.Context; import android.hardware.Sensor; import android.hardware.SensorEvent; import android.hardware.SensorEventListener; import android.hardware.SensorManager; import android.os.Bundle; import android.util.Log; import android.widget.TextView; public class CirclingCounter extends Activity { private SensorManager mSensorManager01; private TextView displayTextView; int i=0; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); displayTextView=(TextView)findViewById(R.id.display); displayTextView.setText(i); mSensorManager01=(SensorManager)getSystemService(Context.SEARCH_SERVICE); } private final SensorEventListener mSensorListener= new SensorEventListener() { @Override public void onAccuracyChanged(Sensor sensor,int accuracy) { } @Override public void onSensorChanged(SensorEvent event) { if(event.sensor.getType()==Sensor.TYPE_ORIENTATION) { float fPitchAngle=event.values[SensorManager.DATA_Y]; if(fPitchAngle-120) { i++; displayTextView.setText(i); } else { } } } }; @Override protected void onResume() { ListSensor sensors=mSensorManager01.getSensorList(Sensor.TYPE_ORIENTATION); mSensorManager01.registerListener(mSensorListener, sensors.get(0),SensorManager.SENSOR_DELAY_NORMAL); super.onResume(); } @Override protected void onPause() { mSensorManager01.unregisterListener(mSensorListener); super.onPause(); } } -- 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: Linkify
Hi, Thanks for the reply.. I am trying to do what you said. I defined a string: string name= support_requestSupport Request: a href= supp...@unl.com?subject=commentssupp...@unl.com/a/string In my .java code, I created a textview and called the setMovementmethod like this: TextView emailLink; emailLink = (TextView) this.findViewById(R.id.support_request); emailLink.setMovementMethod(LinkMovementMethod.getInstance()); I am getting the error below when I run the app and click on the email text: 11-01 02:44:42.431: ERROR/AndroidRuntime(1870): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=supp...@unl.com?subject=comments(has extras) } I think I am missing something in the manifest file. I am not sure what I need to fill there. Whar do I enter in the data field in the intent filter? Here is my intent filter I have defined in the corresponding activity: intent-filter action android:name=android.intent.action.VIEW/ category android:name=android.intent.category.DEFAULT/ category android:name=android.intent.category.BROWSABLE/ data android:scheme=http android:host=supp...@unl.com/ /intent-filter I think I am doing something wrong here. Please Help. Thanks, Priyank On Sat, Oct 30, 2010 at 7:31 PM, Lance Nanek lna...@gmail.com wrote: I haven't gotten autoLink/Linkify to work with subjects, but I have used explicit mailto href values that included the subject parameter in TextView views successfully. The way I did it the string in the strings XML has a literal anchor tag in it with the mailto href including a subject parameter. I set the string via the text attribute on the TextView in XML and the HTML link gets converted properly. Then I also call: setMovementMethod(LinkMovementMethod.getInstance()); On the TextView from code. The amount of HTML a TextView will parse is limited, but apparently it is enough for mailto links with subject parameters, at least. On Oct 30, 5:55 pm, Priyank priyankvma...@gmail.com wrote: Hi, I am stuck at a place when I was using Linkify to create Link an email id to the Android email app. I have a large sentence in a textview which has an email id. On clicking on it, it opens my android email app. But The problem is that, I cannot add any subject or message in the mail. Is there any way of doing this using linkify ? Or do I have to use any other way for doing this. I initially used a textview which had just the email id, from which I could add the subject and message, but i will have to keep the email id in a separate line. I want the entire line in the textview where the email id comes in the middle of the sentence. I am currently doing like this: TextView emailLink; emailLink = (TextView) this.findViewById(R.id.support_request); Linkify.addLinks(emailLink,Linkify.EMAIL_ADDRESSES); Thanks, Priyank -- 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 -- 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: One process, two live Application objects?
Well, I've never expected onTerminate to be useful, but subclassing Application is. The Application's onCreate() method (and any static and instance initializers) are called before ANY application component is created or loaded. There's no other way to make this guaranty that I am aware of. You can come close if you put a reference to a singleton in every single component, and remember to always do so. But that's not a good approach -- it violates once-and-only-once. And if you're using third- party code as part of your app, it may not be possible. Although, admittedly, such code reuse is rare and problematic on Android, so it's nearly always possible. But why campaign against Application? It's a perfectly fine singleton itself, it's just misunderstood. Fix the documentation. Deprecate onTerminate. Suggest to people that their modularity would benefit if they group related statics into their own singleton, and their memory use might even improve if they then reference this singleton only where it's needed. On Oct 31, 3:39 pm, Dianne Hackborn hack...@android.com wrote: It is just totally wrong to rely on onTerminate. There is just fundamentally no reason to worry about cleaning up your statics when the way your process goes away is by killing it. There isn't anything to clean up. And anyway, onTerminate never gets called. -- 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 create an aircraft-mounted-liked compass?
I may know more about magnetic compasses than some of the engineers putting them in devices...but of course, I don't know what those engineers are doing. But let me try to address the question in general terms anyway. Consider that traditionally, huge iron ships could use magnetic compasses with fair accuracy. How did they do this? Well, you may have seen pictures of a ship's compass, with two big iron balls on either side of it? The purpose of those balls is to allow the local magnetic field to be flattened, so the effect of all that iron, much of it magnetized by arc welding, would be balanced out and made more uniform in all directions. They are placed side-by-side, to compensate for the fore-and-aft alignment of the ship, and independently adjustable for compasses not on the ship's centerline. Then once the field was flattened, the compass would be calibrated by a specialist. As best I recall the procedure, the ship would be run back and forth in calm waters on each heading, and the discrepancies recorded, to be applied to headings and bearings taken using the compass. The ship's compass is filled with a fluid, with vanes attached below, to provide damping and to keep it level. All of this could better be done electronically, in software, working from the raw sensor data. But, of course nobody actually calibrates a phone this way. The manufacturer's could, but I seriously doubt they do. But I don't think there's any real reason for them to do so -- because how accurately can you judge the orientation of your phone relative to your heading? And without the little pin in the middle for you to sight against the distant object, how well can you peer over your phone and just the bearing of the distant object? I expect that details like this outweigh any sensor accuracy issues. As for batteries -- those should have no effect. They generally won't have ferrous metals. The currents involved are small -- and so long as they are relatively constant, on a reasonable timescale, at most they'd be something that could be taken care of in the calibration process, were there such a process. But I wouldn't be surprised to see something like a camera flash LED being lit, or the battery being charged, making a noticeable difference. That could also be addressed in software, but could also be addressed by carefully separating the sensor from the LED current. The bottom line is, that while I think phones could be quite accurate, I see no advantage in doing so, because if you need that kind of accuracy, you will be better served by a compass with a physical package designed for the purpose. These days, many of those are electronic using the same technologies as are found in the phone. You can get them built into binoculars, even. On Oct 31, 3:39 pm, DanH danhi...@ieee.org wrote: I do wonder how accurate it could possibly be, however. Your standard compass can be led astray by a steel belt buckle, so it's hard to see how a compass inside a phone, with batteries, printed circuits, electrons whizzing around, etc, could be very accurate at all. On Oct 31, 5:35 pm, Adrian Romanelli adrian.romane...@gmail.com wrote: Just to answer my own question, Compass functionality is built into some (all?) devices. I noticed that the up-coming T-Mobile Comet has compass functionality. On Oct 31, 2:06 pm, Adrian Romanelli adrian.romane...@gmail.com wrote: Does an Android 'sensor' have a compass built in? I thought it was just a motion sensor, portrait/landscape, etc., and not a true compass? And as far as I know, the gps device is a coordinate/point location thing, not a compass thing. How would the phone/device actually know its facing North? Finally, I'm not sure if this would help you out, but take a look at this article (its in three parts, link is part one), that describes a scrollable surface view:http://www.droidnova.com/create-a-scrollable-map-with-cells-part-i,65... Not sure if it can help you or not, but maybe a place to start? On Oct 31, 1:51 am, josef.hardi josef.ha...@gmail.com wrote: I want to create a non-generic compass that uses rotating directions instead of a rotating needle as in the conventional compass. The drawing is like the illustration below. | ' ' W ' ' ' ' ' N ' ' ' ' ' E ' ' ' ' ' S ' ' ' (shift a bit to the east) | ' ' ' ' ' N ' ' ' ' ' E ' ' ' ' ' S ' ' ' ' ' W The needle (depict as |) is fixed and the direction string should have some sort of rotation effect that immediately relocates each sign or character from one tip of the edge to the opposite edge. Of course, the movement follows the reading of the Android sensor. Does anyone has an idea how to implement this? I stumbled with how I create the rotation effect and connect the string's movement with the sensor reading. Thanks /Joe -- You received this message
Re: [android-developers] Re: One process, two live Application objects?
On Sun, Oct 31, 2010 at 8:20 PM, Bob Kerns r...@acm.org wrote: The Application's onCreate() method (and any static and instance initializers) are called before ANY application component is created or loaded. There's no other way to make this guaranty that I am aware of. You can come close if you put a reference to a singleton in every single component, and remember to always do so. But that's not a good approach -- it violates once-and-only-once. And if you're using third- party code as part of your app, it may not be possible. Although, admittedly, such code reuse is rare and problematic on Android, so it's nearly always possible. Hm, so when do you need to just have code start running in your process first thing? Generally it needs to run for something else -- and that something else needs to make a call somewhere to get what it wants. Having that call Singleton.getInstance(context) (at which point you can do init for the first call) isn't any harder that ((Singleton)context.getApplication()), and it has some significant benefits: - Does lazy initialization so that you don't end up doing more stuff than needed when launching the process (important for first launch speed, and if you do things like receive broadcasts in the background). - Avoids Application is basically a big global. This also is far better for third party code, since if that code wants to have some global state it would be a pain to require modifying Application or having the app call into the library to init it. I don't understand your comment about violating once-and-only-once -- the whole point of a singleton is that it is one instance that is initialized the first time it is needed. There isn't actually any extra code you need to write to have it initialized, because by definition there is something there your other code needs, so the initialization can happen as a side-effect of getting access to it. But why campaign against Application? It's a perfectly fine singleton itself, it's just misunderstood. Fix the documentation. Deprecate onTerminate. Suggest to people that their modularity would benefit if they group related statics into their own singleton, and their memory use might even improve if they then reference this singleton only where it's needed. I will fix the documentation. But conceptually, it just doesn't match with how you should be thinking about designing your app. -- 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: Extending SimpleCursorAdapter
Thankyou, thankyou, thankyou to both of you. Exactly what I needed. -- 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