[android-developers] Re: Notification details Activity never receives Intent used to fire it
I'm pretty sure I used FLAG_CANCEL_CURRENT to no avail... passing different request codes each time was the only way to create a new intent. I spent a whole day on this combining flags to no avail, until I tried the workaround by Guillaume. On 25 Nov., 19:24, Dianne Hackborn [EMAIL PROTECTED] wrote: It may or may not be the right thing to do. If you are not going to use the old intent, you should just use FLAG_CANCEL_CURRENT to first cancel the existing one so it can be replaced with your new one. On Tue, Nov 25, 2008 at 12:29 AM, Guillaume Perrot [EMAIL PROTECTED] wrote: Yes using request codes is the right thing to do, this is just a documentation bug in the end. 2008/11/25 alex [EMAIL PROTECTED] Ok, so I ran into this exact issue too. I need to send different data via the extras of the intent, but the old intent with the old extras keeps getting delivered unless I pass unique values into the mysterious requestCode parameter. So this begs the question: is using the requestCode in this way kosher? Is there a better way? BTW, I'm using PendingIntents for alarms and notifications. On Nov 21, 2:47 pm, Guillaume Perrot [EMAIL PROTECTED] wrote: Thanks for your answer, it eventually solves the mystery \o/ I quoted it in the Issue 863. http://code.google.com/p/android/issues/detail?id=863 On 21 nov, 23:38, Dianne Hackborn [EMAIL PROTECTED] wrote: Ah you are right, the request code is also part of its identity. For the nitty gritty details, this file defines a PendingIntent maintained by the system and the full key used to match them: http://android.git.kernel.org/?p=platform/frameworks/base.git;a=blob;. .. On Fri, Nov 21, 2008 at 3:07 AM, Matthias [EMAIL PROTECTED] wrote: And to further clear up my intentions: I have a model class called Event. It represents user activity in my system (such as rating items or writing messages). These events are delivered to the user through NotificationManager. For every such event, the NM calls Event.toNotification() and delivers the notification. Furthermore, I have an activity called EventDetailsActivity. This is triggered whenever the user taps on the notification to read the event info in full length. This implies primarily two things: 1. I must be able to pass an Event model object to EventDetailsActivity whenever the user taps the corresponding notification 2. I must be able to reuse EventDetailsActivity even it is already displaying another event (e.g. update it via onNewIntent()) Thus, in Event.toNotification(), I do this: public final Notification toNotification(Context context) { Intent intent = new Intent(context, EventDetailsActivity.class); intent.putExtra(event, this); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_SINGLE_TOP); configureIntent(intent); // template method for subclasses PendingIntent contentIntent = PendingIntent.getActivity (context, requestCode++, intent, 0); Notification notification = new Notification (getNotificationIcon(), getTickerText(), getDate().getTime()); notification.setLatestEventInfo(context, getTitle(), getText (), contentIntent); return notification; } Hope that clears up my intentions. On 21 Nov., 11:14, Matthias [EMAIL PROTECTED] wrote: Well, when /do/ PendingIntents match? All I can say is that calling PendingActivity.getActivity() created a new PendingIntent each time I called it (I checked the OID in the debugger), and in this new object, I always store a new Intent object. As Guillaume suggested, I solved the problem by calling getActivity() like this: private static int requestCode; ... pi = PendingIntent.getActivity(context, requestCode++, intent, 0) and now everything works as expected. As for the intent itself, I instantiated it using FLAG_ACTIVITY_NEW_TASK and FLAG_ACTIVITY_SINGLE_TOP. On 20 Nov., 22:55, Dianne Hackborn [EMAIL PROTECTED] wrote: I am really not clear on exactly what you are doing or expecting, but one thing to watch out for -- when you get a PendingIntent, if there is already a PendingIntent matching the Intent you have been given (NOT including the extras), then you get that PendingIntent, NOT a new one. So if you want to change the extras you will either need to cancel the existing one, or modify something in the action, type, data, or category so that it doesn't match the existing one. This is covered (not very well) in the last paragraph of the PendingIntent documentation: http
[android-developers] Re: Notification details Activity never receives Intent used to fire it
Dianne, On 5 Dez., 00:45, Dianne Hackborn [EMAIL PROTECTED] wrote: FLAG_CANCEL_CURRENT will almost certainly work. If you look at the code, if you have the flag set it just removes any existing intent and creates a whole new pending intent with the intent you provide. The returned PendingIntent can't contain the old intent data. Now that you mention it, I have to revise my last post: As I already mentioned in my post from 21 Nov., 11:14, a new PendingIntent object is created indeed (the object IDs differ each time), but still, as soon as the activity is fired, the data from Intent No. 1 will be passed, always. So yes and no. Yes, a new PendingObject is indeed created, but no, it *does* contain the old intent data. I could check it one last time just to be 100% sure, but since I already spent a whole day on this, I'd rather not touch the code again, now that it's working... :-/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] ListActivity.onListItemClick() only responds to trackball/dpad clicks
Hi, I have been struggling for over two hours now getting a custom ListActivity to respond to touch/click events directly on its list items. However, onListItemClick() is only called when first focusing a list element and then pressing the trackball or dpad-center button. The odd thing is that it works in another custom ListActivity I wrote... any general ideas when this can actually happen? I tried playing around with the focusable und clickable attributes on all the list entry views and the list view itself. I think I tried every possible combination, but it never works it simply looks as if the list items views are consuming the click event, so the list view never gets to it, but then again, why would it work using the dpad then?? Any help greatly appreciated. Best, Matthias --~--~-~--~~~---~--~~ 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: ListActivity.onListItemClick() only responds to trackball/dpad clicks
Hi, On Mar 23, 7:52 pm, droozen droozenr...@gmail.com wrote: Have you tried following the Notepad tutorial and this line in your onCreate method? registerForContextMenu(getListView()); Why would I want to do that, I do not need a context menu. Maybe I didn't make myself clear enough about the problems I run into. It's really simple actually: I have a ListActivity, and in the list that is hosted by this activity I render list items using a custom RelativeLayout. Nothing fancy at all. Now, of course I want those items to be selectable and clickable by the user. And that doesn't work. The user has to scroll to an item first using the dpad/trackball to focus it, and only then is able to click it. I want the item to be directly pressable, however, using a touch motion. But that event never reaches the list view, and thus onListItemClick() is not called. It seems that for some reason, my list items consume all touch gestures before they are able to propagate up to the view and be able to be interpreted as a click. But that's just a wild guess. I have absolutely no idea how this is even possible, especially since it works in other ListActivities I use. --~--~-~--~~~---~--~~ 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: ListActivity.onListItemClick() only responds to trackball/dpad clicks
I found the problem: Removing the call to textView.setMovementMethod (LinkMovementMethod.getInstance()); in a TextView I use in the list item layout fixed the problem. Is that expected behavior? I think about raising a bug about this. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] android:ellipsize for multi-line text?
Hi, I noticed that android:ellipsize will always ellipsize a single line as soon as it doesn't fit the width of a TextView. That makes no sense however for multi-line TextViews, since you will then get something like this: some very long tex... this line fits. this one does not f... you get the idea. What I want instead is this: some very long text. this line fits. this one does not f... the ellipsis should always be at the end of the *text*, not at the end of the current line. Is this possible with Android or do I have to write something myself (which I am not particularly eager to do to be honest)? Thanks for you input. --~--~-~--~~~---~--~~ 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] Bundles and serializable objects - what is actually stored?
Hi, I was wondering about the behavior of Bundles and serializable objects. If I put a serializable object into a bundle, what is serialized then, the reference to the object or the object itself? I always assumed that the object itself would be serialized to a byte stream when calling putExtra() and re-created from that representation when calling getSerializableExtra(), but I recently stumbled upon a piece of code that put an entire view into a Bundle in thread A, retrieved it from that bundle in thread B, performed a modification on it and this modification actually became visible. This can only happen if the reference to that view was stored, not the view itself, right? Otherwise, the modification had been applied to a copy of that view and would be meaningless. --~--~-~--~~~---~--~~ 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: Bundles and serializable objects - what is actually stored?
Thanks for your in-depth answer, that was really helpful. Cheers, Matthias --~--~-~--~~~---~--~~ 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] File size column in image database is always 0 for the newest image
Hi, I am uploading images to our webservice from the phone, and thus I need to know the exact size of an image. I noticed that with some photos from the G1, the webservice always failed, and found out that it's due to the file size always being 0 for the latest image in the database. Is this a known bug? What else can I do to find out the size of an image on the phone without going through the DB? I want to avoid writing the whole image to a byte buffer just to find out its size... here is some code to play with: ContentResolver contentResolver = getContentResolver (); Cursor c = contentResolver.query( Uri.parse(content://media/external/images/ media), new String[] { Images.ImageColumns._ID, Images.ImageColumns.DISPLAY_NAME, Images.ImageColumns.SIZE }, null, null, null); while (c.moveToNext()) { Log.d(PHOTO, c.getLong(0) + + c.getString(1) + + c.getLong(2)); } c.close(); This gives me 0 in the third column for the last entry (that's the newest photo). --~--~-~--~~~---~--~~ 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: File size column in image database is always 0 for the newest image
Hi, thanks for the swift reply! Hm, if the workaround you suggest is slow, maybe I am better off with writing the image to a byte buffer and taking its size after all? I just tested that solution, and it was much faster than I expected. Since I upload images in a background service, it may not even be a noticeable overhead to the user. But still, this is an annoyance, did you already raise a bug for this? Cheers, Matthias --~--~-~--~~~---~--~~ 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: File size column in image database is always 0 for the newest image
Hi, On Mar 26, 4:04 pm, Streets Of Boston flyingdutc...@gmail.com wrote: You still may need to do this, though. With my application; if i don't do the MediaScanner thing, the 'Pictures' application will crash! You may find the same problem. Try to insert an image (with the SIZE being 0), then close your app and start the stock 'Pictures' application. Check if it crashes or not. If it does, you should do the MediaScanner thing. You don't want to get angry customers :-) I see. I do not insert images into the database myself though. I only load them; but if the user takes a picture and then wants to select it from the gallery app, then its size is also 0, that's why I was having these problems. --~--~-~--~~~---~--~~ 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: File size column in image database is always 0 for the newest image
I raised a bug for this: http://code.google.com/p/android/issues/detail?id=2311 By the way, I wonder what ContentResolver.startSync() does? Maybe one has to call this in order to see an up-to-date media DB? (Its documentation is, as usual, a bit lacking.) --~--~-~--~~~---~--~~ 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: File size column in image database is always 0 for the newest image
Oh and, how did you resolve a content URI to an image path? I realized that the read into memory approach does not work for me, because sometimes when I go through an open-read-close-open-read cycle for the image stream, I get an IOException (funny enough, not always). --~--~-~--~~~---~--~~ 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: File size column in image database is always 0 for the newest image
okay, one solution is to do something like this: String path = Environment.getExternalStorageDirectory ().getAbsolutePath() + /dcim/Camera/ + [value of DISPLAY_NAME column for this image]; and then do a new File(path).length() but I'm not sure if that path value is portable between Android devices. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: File size column in image database is always 0 for the newest image
ah my bad, I missed that. Very confusing tho, since the documentation says about that column: public static final String DATA The data stream for the file Type: DATA STREAM Constant Value: _data that sounds to me more like a BLOB than a path! On Mar 27, 2:45 pm, Streets Of Boston flyingdutc...@gmail.com wrote: Read my post from yesterday at 10am again :-) Execute a query using your content-uri, and use the returned cursor to obtain the physical file-path (use the ImageColumns.DATA). On Mar 27, 9:27 am, matthias m.kaepp...@googlemail.com wrote: okay, one solution is to do something like this: String path = Environment.getExternalStorageDirectory ().getAbsolutePath() + /dcim/Camera/ + [value of DISPLAY_NAME column for this image]; and then do a new File(path).length() but I'm not sure if that path value is portable between Android devices. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: No callback when list item is touched.
I have a similar problem: When putting different widgets in a listview, things get out of hand. I had three custom relative layouts and a spinner in that listview, and everything worked fine. I then added another spinner and a button, and now the spinners do not update their focused/clicked state anymore (they respond to click/touch events, but they do not visually appear as being clicked). The button however, still behaves normally but only until I select an item from a spinner; after that, the button also stops updating its state when being clicked. Is there any general rule to obey to when putting things with custom click handlers in listviews? --~--~-~--~~~---~--~~ 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: custom progress indicator ?
that's a good question; unfortunately, drawable resources are poorly documented. You can always take a look at the Android implementation though... there should be plenty of examples. I usually simply copy over drawables from the framework and modify them to suit my needs. Android's drawables (including the progress indicators) are located in frameworks/base/core/res/res/drawable. --~--~-~--~~~---~--~~ 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: testing using EasyMock
Hi, On Mar 26, 4:15 pm, gyuri gyorgy.tar...@gmail.com wrote: Can EasyMock be used with Android SDK to test my code? ... How did you run that test case? You cannot run tests against Android classes (or tests which stub them) just by running your tests as a Junit program or whatever. You cannot access Android classes from outside the emulator, so you will have to use Android's Instrumentation mechanisms to run your tests. Doing so should get rid of weird class loader errors. Cheers, Matthias --~--~-~--~~~---~--~~ 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: Fling on ListView
Well, you can set a OnTouchListener on any view, including ListView, and use a GestureDetector to detect horizontal flings. So, yes, I guess. The problem with this whole touch mechanism in Android is that child views can silently consume the touch gesture, so your fling will not even propagate up to your ListView when it happened on a list element. Doesn't look like fling support as known from the iPhone was ever meant to be part of Android's UI design. Making your app react to flings (or even detect them properly) is a messy and fragile procedure in Android. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Performance: pre-instantiate activities on app launch? Good practice or not?
Hi guys, our app is getting bigger and more complicated lately, and I definitely noticed a loss in responsiveness and overall snappy-ness. Besides onCreate handlers becoming slower (we use lots of custom view drawables now, because the Android stock styles don't work for us anymore), sometimes, when a class is used for the first time, the Android class loader lazy loads that class which significantly slows down activity load times. I was therefore wondering if you know whether it's possible and common practice to load activities and classes which are anticipated to be loaded anyway during application start, e.g. by using Class.forName or even explicitly calling Activity.onCreate simply to already have it readily constructed as soon as the user actually wants to use it? A loading screen would be shown meanwhile. I have never seen an Android app doing this, but on the iPhone, almost any application goes through a loading process when starting up. Any thoughts on best practices and solutions here? Thanks for your input, Matthias --~--~-~--~~~---~--~~ 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] ListView elements in Dialogs never expand to full width
Hi, I am rendering a ListView inside a dialog. The ListView elements are very simple TextView objects. The problem: whatever I do, they never take the full width in the list view, which has the side effect that the list view selector only covers the actual text, not the whole list entry (i.o.w., if the text of the entry is much smaller than the width of the listview/dialog, then only a tiny portion of the list element is highlighted when focusing it). Setting layout_width to FILL_PARENT on the text view layout didn't help. So didn't layout_gravity = fill_horizontal. Why doesn't this work? The TextView (list element): ?xml version=1.0 encoding=utf-8? TextView xmlns:android=http://schemas.android.com/apk/res/android; android:id=@+id/list_dialog_item android:layout_width=fill_parent android:layout_height=wrap_content android:minHeight=?android:attr/listPreferredItemHeight android:textAppearance=?android:attr/textAppearanceLarge android:gravity=center_vertical android:paddingLeft=14dip android:paddingRight=15dip / The dialog layout: ListView xmlns:android=http://schemas.android.com/apk/res/android; android:id=@+id/list_dialog_list android:layout_width=wrap_content android:layout_height=wrap_content / Any ideas? Cheers, Matthias --~--~-~--~~~---~--~~ 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: Long click on list activity item
Hi, On Feb 22, 9:53 pm, an...@akapost.com wrote: ... The standard onListItemClick() will still fire as well; my best guess there is to keep a suppression boolean around, which isn't pretty. Any other thoughts on this? just return true from onItemLongClick(); this means you have consumed the event, so it won't propagate up to the normal click handler. Cheers, Matthias --~--~-~--~~~---~--~~ 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] Discussion on localizing-android-apps-draft
Setting the locale in /data/locale as described here doesn't work for me in 1.1 R1. Has the process changed? This used to work for me in pre-1.1 releases. --~--~-~--~~~---~--~~ 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: ListView elements in Dialogs never expand to full width
anyone? I still cannot sort this one out. --~--~-~--~~~---~--~~ 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 make a ListView adapt to dynamic element sizes?
Hi, I am struggling over another layouting problem again. I render a ListView with ellipsized TextView elements, but those text views can expand in size when the user clicks it. The problem is: If the ListView doesn't already take the whole screen (e.g. because the total height of all visible elements is smaller than the screen height), then when expanding an element, the ListView's size doesn't also expand accordingly, still obscuring most parts of the now taller text view. I have tried practically everything that seemed reasonable to me to make the ListView get aware of the new height of its children, including calls to: invalidate() measure() recomputeViewAttributes(textView) on all participating views (the list view and its elements), but nothing works. What am I missing? How can I programmatically tell a container view to look at its children again in order to resize if necessary? Thanks! Matthias --~--~-~--~~~---~--~~ 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: Performance: pre-instantiate activities on app launch? Good practice or not?
Thanks for your reply Dianne. As to profiling, I looked at traceview, but seems to be a bit overly simplistic to actually profile a whole app. What I understand from the documentation, what it actually does is measuring the time it takes for a single method to complete. That's not a terribly useful information if you want to see the big picture, however (i.e. get answers to questions such as: how much time does the app spend in which parts of the code base?). Are there any plans to make traceview a tad more capable? That would be great news! Cheers, Matthias --~--~-~--~~~---~--~~ 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: Fling on ListView
Romain, thanks for pointing out onInterceptTouchEvent()! I'll take a look at that method ASAP. As to the it was meant to be part of the UI design, I really wonder why practically none of the apps shipped with Android use gestures then (I mean, apart from scrolling up or down of course)? I can only think of the home app right now. In contrast, the iPhone makes very consistent use of flings to navigate back and forth between app screens. We tried to implement this for our app, but as I said, it wasn't actually an easy thing to do, because, for example, Android doesn't actually define what a left or right fling is (in terms of velocity and so forth). So, another app may have a different understanding of this, and react differently to left and right flings (in terms of when to interpret it as such, not in terms of the resulting action, which of course may be different), giving navigation in the platform an inconsistent feel. That's what I meant with messy and fragile. Cheers, Matthias On Mar 29, 8:16 pm, Romain Guy romain...@google.com wrote: Doesn't look like fling support as known from the iPhone was ever meant to be part of Android's UI design. Making your app react to flings (or even detect them properly) is a messy and fragile procedure in Android. It was meant to be part of the UI design. And it's not messy nor fragile, you just need to use onInterceptTouchEvent(). -- Romain Guy Android framework engineer romain...@android.com Note: please don't send private questions to me, as I don't have time to provide private support. All such questions should be posted on public forums, where I and others can see and answer them --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: How to make a ListView adapt to dynamic element sizes?
Well, I found a really ugly workaround. That workaround is based on my observation that the problem described does only occur if the ListView's layout height is set to WRAP_CONTENT. So, since I use a custom list adapter, I now call listView.getLayoutParams().height = LayoutParams.FILL_PARENT whenever a text view is about to be expanded... the reason I do not statically set its height to FILL_PARENT is because then it will draw line separators below the last element, which looks ugly if it doesn't expand to the bottom of the screen. It works... but, yuck! --~--~-~--~~~---~--~~ 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: ListView elements in Dialogs never expand to full width
Okay, I found (once again), a rather ugly workaround for this: Putting the textview in layout object does the job. Like this: ?xml version=1.0 encoding=utf-8? RelativeLayout xmlns:android=http://schemas.android.com/apk/res/ android android:layout_width=fill_parent android:layout_height=wrap_content android:paddingLeft=14dip android:paddingRight=15dip TextView android:id=@+id/list_dialog_item android:layout_width=fill_parent android:layout_height=wrap_content android:minHeight=?android:attr/listPreferredItemHeight android:textAppearance=?android:attr/textAppearanceLarge android:gravity=center_vertical / /RelativeLayout But, that layout object is unnecessary overhead of course Is this a bug maybe? --~--~-~--~~~---~--~~ 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] Discussion on localizing-android-apps-draft
Xavier, very helpful! thanks for sharing, works perfectly. --~--~-~--~~~---~--~~ 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] Speed difference between DOM and SAX parser for small documents
Hi, currently, we use the SAX parser bundled with Android to parse XML coming from our servers. We found however that parsing the XML using a SAX handler is prone to errors and difficult to maintain. Therefore I thought about switiching to a DOM parser, and probably also a wrapper around it (like JDOM) for convenience. But, does anyone know how big the performance impact will be? Is it negligible for documents that are merely 10-50k in size? I remember that in early alphas of Android, the DOM parser was noticeably slower, but I also heard that this has become better meanwhile. Thanks, Matthias --~--~-~--~~~---~--~~ 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] Discussion on localizing-android-apps-draft
in case not everyone noticed, this article has been updated and now contains the correct instructions. Thanks Justin! --~--~-~--~~~---~--~~ 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] Managing background uploads
Hi, in our app we're doing background photo uploads. The current implementation works using a combination of a Service and an AsyncTask. The former will trigger the latter, which will do the actual network I/O. My question is: since the user can trigger many uploads in parallel, is this the correct implementation pattern? The problem is that I can never call Service.stopSelf() from an upload task when it finishes, because those tasks don't know anything about each other or the service that triggered them (because of the very nature of AsyncTask). Do I even need a Service here at all? I always thought services were meant for long running background tasks, but their documentation clearly states that one must execute blocking operations in a separate thread. What's the purpose of Services then? You could just fork an AsyncTask from an Activity, it would make no difference at all. What would you suggest doing in my case? Cheers, Matthias --~--~-~--~~~---~--~~ 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: Managing background uploads
Hey James, good to know, thanks! -Matthias On Oct 21, 9:30 pm, James Yum j...@google.com wrote: Hi Matthias, Thank you for the good question (shows you're thinking). Check the Application Fundamentals dev guidehttp://developer.android.com/guide/topics/fundamentals.html Near the bottom: Because a process running a service is ranked higher than one with background activities, an activity that initiates a long-running operation might do well to start a service for that operation, rather than simply spawn a thread — particularly if the operation will likely outlast the activity. Examples of this are playing music in the background and uploading a picture taken by the camera to a web site. Using a service guarantees that the operation will have at least service process priority, regardless of what happens to the activity. Also from the Service class doc: Note this means that most of the time your service is running, it may be killed by the system if it is under heavy memory pressure. If this happens, the system will later try to restart the service. An important consequence of this is that if you implement onStart()http://developer.android.com/reference/android/app/Service.html#onSta..., int) to schedule work to be done asynchronously or in another thread, then you may want to write information about that work into persistent storage during the onStart() call so that it does not get lost if the service later gets killed. As far as the tasks, you can probably devise a simple (and try to keep it simple) way to track the different tasks. I'd probably add some sort of timeout check to clear out threads that never terminated for whatever reason. Cheers, James On Wed, Oct 21, 2009 at 8:27 AM, Matthias m.kaepp...@googlemail.com wrote: Hi, in our app we're doing background photo uploads. The current implementation works using a combination of a Service and an AsyncTask. The former will trigger the latter, which will do the actual network I/O. My question is: since the user can trigger many uploads in parallel, is this the correct implementation pattern? The problem is that I can never call Service.stopSelf() from an upload task when it finishes, because those tasks don't know anything about each other or the service that triggered them (because of the very nature of AsyncTask). Do I even need a Service here at all? I always thought services were meant for long running background tasks, but their documentation clearly states that one must execute blocking operations in a separate thread. What's the purpose of Services then? You could just fork an AsyncTask from an Activity, it would make no difference at all. What would you suggest doing in my case? Cheers, Matthias --~--~-~--~~~---~--~~ 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] Multipart file uploads using Apache Mime4J still not working
Hi, I raised this ticket a long while ago: http://code.google.com/p/android/issues/detail?id=2357 I am still running into this problem. In fact, since I upgraded to the latest http-mime and mim4j JARs, it has become worse. I always get this exception when trying to upload a file received using ContentResolver.openInputStream(): IOException: at java.io.FileInputStream.openCheck(FileInputStream.java:389) My code: photoData = context.getContentResolver().openInputStream( photoUri); MultipartEntity payload = new MultipartEntity (HttpMultipartMode.STRICT); payload.addPart(uploaded_data, new PhotoStreamBody (photoData, photoSize)); HttpPost request = new HttpPost(url); request.setEntity(payload); request.setHeader(HTTP_CONTENT_TYPE_HEADER, payload.getContentType().getValue()); response = httpClient.execute(request); PhotoStreamBody inherits from InputStreamBody. The only thing it does is overwriting the getContentLength() method, because Android has another bug which reports wrong content sizes... Does anyone know what is causing this? Thanks, Matthias --~--~-~--~~~---~--~~ 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] Animating ViewStub
Hi, I am trying to animate a ViewStub -- without success. My code: stub.setVisibility(View.VISIBLE); // inflate the stub Animation anim = AnimationUtils.makeInAnimation(this, true); stub.startAnimation(anim); No animation is played, the ViewStub simply appears. How come? --~--~-~--~~~---~--~~ 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: M3 SDK: Click events on Map Overlays?
anyone? still found no solution to this. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: MapActivity - Couldn't get connection factory client
I have the same problem. Any ideas yet? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Mock Location Providers in 1.0
Still doesn't work for me. Playing a GPX file from that tramper site, but my app doesn't seem to receive any location updates; LocationManager.getLastKnownLocation() always returns null when using the GPS provider. I have enabled app permissions for fine grained location access (i.e. using GPS), so that can't be the problem. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Getting GPS Location in Android 1.0 SDK
anyone found a solution? I am still struggling over this... --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: How to query for my current location?
Well, in other words, this whole location manager thing is pretty broken in Android 1.0? From what I've read and experienced myself so far, it's pretty much like this: 1) LocationManager cannot be subclassed anymore, instead you use the debug bridge to send location fixes. Unfortunately, this thing is broken in two ways: Firstly, it only works on systems with a US locale (?? sounds odd, but I can definitely tell it does not work for me...), and secondly, the proclaimed geo command from the tools/ folder isn't even there...! 2) In order for LocationManager.getLastKnownLocation() to actually work, one has to register a listener, although this may not even what the programmer needs -- I surely don't want it, I want to poll for updates only on well-defined occasions. In fact, I believe this whole location listener thing is a bad idea, because it will result in each and every location-aware Android app running its own ListenForLocationUpdatesService, in order to always have access to the latest known location... yuck. Is that correct so far? If so, I have to say I am pretty much disappointed with the progress Android makes. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Problem with MapView
darn, nevermind... the Maps demo in ApiDemos is also missing that file, produces the same error, but it does show a map. this is getting more obscure with every minute. On Oct 17, 3:56 pm, Matthias [EMAIL PROTECTED] wrote: Yes, I do have a location set. I think I know where the problem originates from though. As has appeared in the log traces before, the gray map thing seems to happen when the error Couldn't find file /data/data/your-app-package/ DATA_Tiles occurs; from my understanding, this file holds the map tile data from which a map is constructed. If that file is missing, well, then no map will be rendered of course. I don't know why my application package is missing that file. This should be handled by the runtime of course. I will now try to manually copy that file over from another (working) package to my package and check if that'll fix it. On Oct 17, 3:10 pm, Ludwig [EMAIL PROTECTED] wrote: Do you actually have a location set? I vaguely remember that I once had the grey screen, where it was not the permission to get the data off the net, but the fact that the view did not know what/where to view. Ludwig 2008/10/17 Matthias [EMAIL PROTECTED] That didn't work for me. I am still getting a grey plane where the map should be. :-/ Any other ideas? On Aug 20, 9:32 pm, Megha Joshi [EMAIL PROTECTED] wrote: Move the uses-permission tags above the application tag: uses-permission android:name=android.permission.ACCESS_COARSE_LOCATION / uses-permission android:name=android.permission.INTERNET / application android:icon=@drawable/icon android:label=@string/app_name uses-library android:name=com.google.android.maps / On Wed, Aug 20, 2008 at 3:44 AM, dapper [EMAIL PROTECTED] wrote: Hi there, I am just starting out with android and for my first app after the tutorial I would like to display a Map. I have basically taken the Sample code and put it into my own project. However I only seem to get the grey grid and no map. Can anyone help (banging my head here). I am using 0.9. I know it is something stupid but can't see it. Thanks This is my main.xml ?xml version=1.0 encoding=utf-8? LinearLayout xmlns:android=http://schemas.android.com/apk/res/ android android:layout_width=fill_parent android:layout_height=fill_parent com.google.android.maps.MapView android:id=@+id/map android:layout_width=fill_parent android:layout_height=fill_parent android:enabled=true android:clickable=true android:apiKey=mymapkey / /LinearLayout My code public class HotelCompanion extends MapActivity { MapView mMapView; [EMAIL PROTECTED] public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); MapView map = (MapView) findViewById(R.id.map); MapController mc = map.getController(); mc.setZoom(9); } [EMAIL PROTECTED] protected boolean isRouteDisplayed() { return false; } } and my manifest ?xml version=1.0 encoding=utf-8? manifest xmlns:android=http://schemas.android.com/apk/res/android; package=dharmesh.android.hotel application android:icon=@drawable/icon android:label=@string/ app_name uses-library android:name=com.google.android.maps / uses-permission android:name=android.permission.ACCESS_COARSE_LOCATION / uses-permission android:name=android.permission.INTERNET / activity android:name=.HotelCompanion android:label=@string/app_name intent-filter action android:name=android.intent.action.MAIN / category android:name=android.intent.category.LAUNCHER / /intent-filter /activity /application /manifest --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Problem with MapView
oh boy... I have figured out what went wrong... I used the geo command to send location fixes, but this thing takes GPS coordinates as lon/lat pairs, not as lat/lon (like any GEO-related API that I have ever seen does), so the map dropped me in some uncharted lands (which were gray...). Great, one more wasted day thanks to terrible user interface design. :-/ On Oct 17, 4:08 pm, Matthias [EMAIL PROTECTED] wrote: darn, nevermind... the Maps demo in ApiDemos is also missing that file, produces the same error, but it does show a map. this is getting more obscure with every minute. On Oct 17, 3:56 pm, Matthias [EMAIL PROTECTED] wrote: Yes, I do have a location set. I think I know where the problem originates from though. As has appeared in the log traces before, the gray map thing seems to happen when the error Couldn't find file /data/data/your-app-package/ DATA_Tiles occurs; from my understanding, this file holds the map tile data from which a map is constructed. If that file is missing, well, then no map will be rendered of course. I don't know why my application package is missing that file. This should be handled by the runtime of course. I will now try to manually copy that file over from another (working) package to my package and check if that'll fix it. On Oct 17, 3:10 pm, Ludwig [EMAIL PROTECTED] wrote: Do you actually have a location set? I vaguely remember that I once had the grey screen, where it was not the permission to get the data off the net, but the fact that the view did not know what/where to view. Ludwig 2008/10/17 Matthias [EMAIL PROTECTED] That didn't work for me. I am still getting a grey plane where the map should be. :-/ Any other ideas? On Aug 20, 9:32 pm, Megha Joshi [EMAIL PROTECTED] wrote: Move the uses-permission tags above the application tag: uses-permission android:name=android.permission.ACCESS_COARSE_LOCATION / uses-permission android:name=android.permission.INTERNET / application android:icon=@drawable/icon android:label=@string/app_name uses-library android:name=com.google.android.maps / On Wed, Aug 20, 2008 at 3:44 AM, dapper [EMAIL PROTECTED] wrote: Hi there, I am just starting out with android and for my first app after the tutorial I would like to display a Map. I have basically taken the Sample code and put it into my own project. However I only seem to get the grey grid and no map. Can anyone help (banging my head here). I am using 0.9. I know it is something stupid but can't see it. Thanks This is my main.xml ?xml version=1.0 encoding=utf-8? LinearLayout xmlns:android=http://schemas.android.com/apk/res/ android android:layout_width=fill_parent android:layout_height=fill_parent com.google.android.maps.MapView android:id=@+id/map android:layout_width=fill_parent android:layout_height=fill_parent android:enabled=true android:clickable=true android:apiKey=mymapkey / /LinearLayout My code public class HotelCompanion extends MapActivity { MapView mMapView; [EMAIL PROTECTED] public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); MapView map = (MapView) findViewById(R.id.map); MapController mc = map.getController(); mc.setZoom(9); } [EMAIL PROTECTED] protected boolean isRouteDisplayed() { return false; } } and my manifest ?xml version=1.0 encoding=utf-8? manifest xmlns:android=http://schemas.android.com/apk/res/android; package=dharmesh.android.hotel application android:icon=@drawable/icon android:label=@string/ app_name uses-library android:name=com.google.android.maps / uses-permission android:name=android.permission.ACCESS_COARSE_LOCATION / uses-permission android:name=android.permission.INTERNET / activity android:name=.HotelCompanion android:label=@string/app_name intent-filter action android:name=android.intent.action.MAIN / category android:name=android.intent.category.LAUNCHER / /intent-filter /activity /application /manifest --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http
[android-developers] Re: MapView and Zoom Control in 0.9 SDK
Just to get this straight, one has to *subclass* MapView in order to enable simple things such as zooming? I can't help it, but to me it seems that with every step forward, Android takes two steps backwards. On Aug 28, 8:42 pm, marcel-182 [EMAIL PROTECTED] wrote: Hi all, I extended the MapActivity with some basic functionality for my project to avoid redundant work. Zoom controls are also working fine. So if anyone is interested, you can get a demo here:http://www.marcelp.info/files/BasicMapDemo.zip Feel free to use it in your applications. On 27 Aug., 16:28, Guillaume Perrot [EMAIL PROTECTED] wrote: How to controlzoomsteps: In my application when Izoomin and out, I can't control how much this willzoombut in the standard map application zooms less at each step than in my application. I tried setZoomSpeed on ZoomControls but it deals with the animation speed, not thezoomstep. On 27 août, 08:00, Amos [EMAIL PROTECTED] wrote: I think you're right. It's probably a better idea to add the mapview to the relativelayout. The layout is not necessary. On Aug 27, 3:29 am, jokochi [EMAIL PROTECTED] wrote: That's a neat solution. It works! Thank you, Amos. I really know how to use RelativeLayout. It's just a small question comes to me, why mapview was stacked on layer layout? I think mapview is able to be on top layer like as before. On 8月26日, 午後9:38, Amos [EMAIL PROTECTED] wrote: Hi All, There's no need to manually handle touch events for displaying the zoomcontrols. The following works for me: My layout xml file is... ?xml version=1.0 encoding=utf-8? RelativeLayout xmlns:android=http://schemas.android.com/apk/res/ android android:layout_width=fill_parent android:layout_height=fill_parent LinearLayout android:id=@+id/layout android:layout_width=fill_parent android:layout_height=fill_parent / LinearLayout android:id=@+id/layout_zoom android:layout_width=wrap_content android:layout_height=wrap_content android:layout_alignParentBottom=true android:layout_centerHorizontal=true / /RelativeLayout ... And in my onCreate I do: //... LinearLayout lay=(LinearLayout)findViewById(R.id.layout); LinearLayoutzoom=(LinearLayout)findViewById(R.id.layout_zoom); _map= new MapView(this, MyConstants.GOOGLE_MAPS_API_KEY); _map.setClickable(true); _map.setEnabled(true); _map.displayZoomControls(true); lay.addView(_map, new LinearLayout.LayoutParams( LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT)); View zoomView = _map.getZoomControls(); zoom.addView(zoomView, new LinearLayout.LayoutParams( LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); //... Hope this helps. Amos --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: MapView and Zoom Control in 0.9 SDK
that's still way too much code just to enable map zoom IMHO... a map.showZoomControls(true) should be all that's needed, but thanks for sharing, appreciated :-) On Oct 17, 5:06 pm, shailesh prakash [EMAIL PROTECTED] wrote: Guys let me end the discussion with this, //--- final ZoomControls zoomControls = (ZoomControls) findViewById(R.id.ZoomControls); zoomControls.setOnZoomInClickListener(new ZoomControls.OnClickListener() { public void onClick(View v) { zoomControls.setIsZoomInEnabled(tMapCtrl.zoomIn()); zoomControls.setIsZoomOutEnabled(true); } }); zoomControls.setOnZoomOutClickListener(new ZoomControls.OnClickListener() { public void onClick(View v) { zoomControls.setIsZoomOutEnabled(tMapCtrl.zoomOut()); zoomControls.setIsZoomInEnabled(true); } }); On Fri, Oct 17, 2008 at 8:26 PM, Mark Murphy [EMAIL PROTECTED] wrote: Matthias wrote: Just to get this straight, one has to *subclass* MapView in order to enable simple things such as zooming? No. Step #1: Put a spot for the zoom controls in your layout (e.g., a LinearLayout named R.id.zoom) Step #2: Tell Android where the zoom controls go: ViewGroup zoom=(ViewGroup)findViewById(R.id.zoom); zoom.addView(map.getZoomControls()); Step #3: There is no Step #3. -- Mark Murphy (a Commons Guy) http://commonsware.com _The Busy Coder's Guide to Android Development_ Version 1.3 Published! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Problem with MapView
you need a valid Google Maps API key for your app as of today. Look for the official announcement on the Android Developers blog. On Oct 22, 4:32 pm, Sudha [EMAIL PROTECTED] wrote: hi all I was using the Mapview and was getting the map and the application was working fine till to 3 pm today.. then after it started to show the grey grid... no map those who are having the map application plz chek that agian.. is it the problem with the google server ? On Oct 17, 7:33 pm, Matthias [EMAIL PROTECTED] wrote: oh boy... I have figured out what went wrong... I used the geo command to send location fixes, but this thing takes GPS coordinates as lon/lat pairs, not as lat/lon (like any GEO-related API that I have ever seen does), so the map dropped me in some uncharted lands (which were gray...). Great, one more wasted day thanks to terrible user interface design. :-/ On Oct 17, 4:08 pm, Matthias [EMAIL PROTECTED] wrote: darn, nevermind... the Maps demo in ApiDemos is also missing that file, produces the same error, but it does show a map. this is getting more obscure with every minute. On Oct 17, 3:56 pm, Matthias [EMAIL PROTECTED] wrote: Yes, I do have a location set. I think I know where the problem originates from though. As has appeared in the log traces before, the gray map thing seems to happen when the error Couldn't find file /data/data/your-app-package/ DATA_Tiles occurs; from my understanding, this file holds the map tile data from which a map is constructed. If that file is missing, well, then no map will be rendered of course. I don't know why my application package is missing that file. This should be handled by the runtime of course. I will now try to manually copy that file over from another (working) package to my package and check if that'll fix it. On Oct 17, 3:10 pm, Ludwig [EMAIL PROTECTED] wrote: Do you actually have a location set? I vaguely remember that I once had the grey screen, where it was not the permission to get the data off the net, but the fact that the view did not know what/where to view. Ludwig 2008/10/17 Matthias [EMAIL PROTECTED] That didn't work for me. I am still getting a grey plane where the map should be. :-/ Any other ideas? On Aug 20, 9:32 pm, Megha Joshi [EMAIL PROTECTED] wrote: Move the uses-permission tags above the application tag: uses-permission android:name=android.permission.ACCESS_COARSE_LOCATION / uses-permission android:name=android.permission.INTERNET / application android:icon=@drawable/icon android:label=@string/app_name uses-library android:name=com.google.android.maps / On Wed, Aug 20, 2008 at 3:44 AM, dapper [EMAIL PROTECTED] wrote: Hi there, I am just starting out with android and for my first app after the tutorial I would like to display a Map. I have basically taken the Sample code and put it into my own project. However I only seem to get the grey grid and no map. Can anyone help (banging my head here). I am using 0.9. I know it is something stupid but can't see it. Thanks This is my main.xml ?xml version=1.0 encoding=utf-8? LinearLayout xmlns:android=http://schemas.android.com/apk/res/ android android:layout_width=fill_parent android:layout_height=fill_parent com.google.android.maps.MapView android:id=@+id/map android:layout_width=fill_parent android:layout_height=fill_parent android:enabled=true android:clickable=true android:apiKey=mymapkey / /LinearLayout My code public class HotelCompanion extends MapActivity { MapView mMapView; [EMAIL PROTECTED] public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); MapView map = (MapView) findViewById(R.id.map); MapController mc = map.getController(); mc.setZoom(9); } [EMAIL PROTECTED] protected boolean isRouteDisplayed() { return false; } } and my manifest ?xml version=1.0 encoding=utf-8? manifest xmlns:android=http://schemas.android.com/apk/res/android; package=dharmesh.android.hotel application android:icon=@drawable/icon android:label=@string/ app_name uses-library android:name=com.google.android.maps / uses-permission android:name=android.permission.ACCESS_COARSE_LOCATION / uses-permission
[android-developers] Re: Getting GPS Location in Android 1.0 SDK
Hi, no, it still doesn't work as expected. It only works when going through telnet and sending manual fixes using the geo command, but it never works via ADB and Eclipse GUI. Bummer. I run Linux though, and I have seen it working on my friend's Windows machine. Is that feature platform dependent by any chance? On Oct 16, 8:40 pm, Gautam [EMAIL PROTECTED] wrote: Thanks Ludwig for pointing me in the right direction :) I've got it working now and this is how it works for me: For getLastKnownLocation() to work, the best way is to telnet into the emulator geo fix command or DDMS controls using Eclipse. Without using one of these options above to set the location, the method will return null. A better way is to get the LocationAPISample and geo_sample_data fromhttp://groups.google.com/group/android-developers/files The LocationSample registers a LocationListener so we keep getting location updates instead of just one location value plus the .gpx file can be used to set locations or simulate a path (cool!) @Matthias Let me know if my pointers help you or we can continue working to get this working for you as well. Thanks everyone, Gautam On Oct 16, 1:36 pm, Ludwig [EMAIL PROTECTED] wrote: There has been a recent exchange over this:http://groups.google.com/group/android-developers/browse_thread/threa... Apologies if I missed a more specific problem in your question. Ludwig 2008/10/16 Matthias [EMAIL PROTECTED] anyone found a solution? I am still struggling over this... --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Screen Only Numeric Input
I'm wandering through the interwebs and the discussion boards looking for a way to input numeric text only without having to flip open the keyboard. I've fumbled my way across several options, including the NumberKeyListener, the DigitsKeyListener and the DialerKeyListener. These are all helpful and everything, but what I've been hoping for is for some kind of dialer-ish input widget. Scanning the android jar file, I can see that there is a number_picker.xml and a number_picker_edit.xml, (in the res.layout section) but I don't see a way of accessing these UI nuggets. Am I missing something in particular? I can write my own numeric widget if there is none available, but I'd feel really stupid writing one if there is already one in the android jar. Thanks in advance. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: How to use buildin email intent
I have the same problem. Any ideas? On 24 Okt., 20:54, Jake Maui [EMAIL PROTECTED] wrote: I'm trying to use the builtin email intent and so far I haven't found enough information to use it correctly. When I execute the following code, I get the message No applications can perform this action. This happens on emulator as well as real hardware. Can anyone tell me what piece is missing? Thx private OnSelectionHandler onEmailMenu = new OnSelectionHandler() { public void handleSelection() { Intent intent = new Intent(Intent.ACTION_SEND); Bundle bundle=new Bundle(); bundle.putString(Intent.EXTRA_EMAIL , [EMAIL PROTECTED]); bundle.putString(Intent.EXTRA_TEXT , This is a test); startActivity(Intent.createChooser(intent, Send Mail)); } }; --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: How to use buildin email intent
I see, thanks. However, when using Linkify to turn email adresses into mailto: links, I get the same error message. Doesn't that mean that handling email intents simply isn't yet supported? User will probably find it awkward when they cannot send emails when clicking an address, but only through custom buttons configured with correct Intents... On 18 Nov., 15:33, john [EMAIL PROTECTED] wrote: Right. You need to set the correct MIME type, in this case message/ rfc822. Anybody know when we're going to start seeing support for sending attachments? It's going to make my life a lot easier when we do. On Nov 17, 8:59 am, Peli [EMAIL PROTECTED] wrote: Your intent is missing the correct type. Have a look here:http://www.openintents.org/en/node/121 Intent sendIntent = new Intent(Intent.ACTION_SEND); sendIntent.putExtra(Intent.EXTRA_TEXT, email text); sendIntent.putExtra(Intent.EXTRA_SUBJECT, Subject); sendIntent.setType(message/rfc822); startActivity(Intent.createChooser(sendIntent, Title:)); Peliwww.openintents.org On Nov 17, 11:12 am, Matthias [EMAIL PROTECTED] wrote: I have the same problem. Any ideas? On 24 Okt., 20:54, Jake Maui [EMAIL PROTECTED] wrote: I'm trying to use the builtin email intent and so far I haven't found enough information to use it correctly. When I execute the following code, I get the message No applications can perform this action. This happens on emulator as well as real hardware. Can anyone tell me what piece is missing? Thx private OnSelectionHandler onEmailMenu = new OnSelectionHandler() { public void handleSelection() { Intent intent = new Intent(Intent.ACTION_SEND); Bundle bundle=new Bundle(); bundle.putString(Intent.EXTRA_EMAIL , [EMAIL PROTECTED]); bundle.putString(Intent.EXTRA_TEXT , This is a test); startActivity(Intent.createChooser(intent, Send Mail)); } }; --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Notification details Activity never receives Intent used to fire it
Hi, I have the following problem: When posting a new Notification, I pass along a PendingIntent used to fire up an Activity that shows details about this Notification. These details are passed as a Serializable Extra. However, the Intent holding the Extra is only updated once, when the Activity was started for the first time. If a new Notification arrives however, although I instantiate a new Intent, neither getIntent() nor onNewIntent() of said Activity deliver this new intent, instead they always deliver the Intent that was active when the Activity was started for the first time. I tried combining many of the flags that can be passed to Intents and PendingIntents (in particular FLAG_ACTIVITY_SINGLE_TOP which is said to do exactly what I need, namely calling onNewIntent() with the new intent, but that's not the case), but no luck. So, how can I update my Activity with the Intent used to fire it, whenever the Activity is already running? Thanks, Matthias --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Notification details Activity never receives Intent used to fire it
I think this may be a bug in Android. I also tried following the instructions from the docs under section Launch Modes and Launch Flags with no success. That section suggested to declare any Activity launched from NotificationManager to set the taskAffinitity to and finishOnTaskLaunch to true, so that the Activity does a clean start everytime it is called. Even though the Activity is completely restarted now (onStart() is called), getIntent() always yields the same intent, the one it was started with for the very first time... On 20 Nov., 14:17, Matthias [EMAIL PROTECTED] wrote: Hi, I have the following problem: When posting a new Notification, I pass along a PendingIntent used to fire up an Activity that shows details about this Notification. These details are passed as a Serializable Extra. However, the Intent holding the Extra is only updated once, when the Activity was started for the first time. If a new Notification arrives however, although I instantiate a new Intent, neither getIntent() nor onNewIntent() of said Activity deliver this new intent, instead they always deliver the Intent that was active when the Activity was started for the first time. I tried combining many of the flags that can be passed to Intents and PendingIntents (in particular FLAG_ACTIVITY_SINGLE_TOP which is said to do exactly what I need, namely calling onNewIntent() with the new intent, but that's not the case), but no luck. So, how can I update my Activity with the Intent used to fire it, whenever the Activity is already running? Thanks, Matthias --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Notification details Activity never receives Intent used to fire it
This gets weirder every minute. Just out of curiosity I just called setIntent(null) in onPause() to make sure the Intent the Activity was started with is always reset. As soon as I start the Activity again though, getIntent() will AGAIN return the Intent I supposedly set to null before.. this Intent it returns even exists across re-deployments of the whole application (not across emulator reboots tho)! Am I the only one having these problems? ^^ This whole thing looks completely broken to me. None of the functionalities I used exposed the behavior that was documented. On 20 Nov., 17:03, Matthias [EMAIL PROTECTED] wrote: I think this may be a bug in Android. I also tried following the instructions from the docs under section Launch Modes and Launch Flags with no success. That section suggested to declare any Activity launched from NotificationManager to set the taskAffinitity to and finishOnTaskLaunch to true, so that the Activity does a clean start everytime it is called. Even though the Activity is completely restarted now (onStart() is called), getIntent() always yields the same intent, the one it was started with for the very first time... On 20 Nov., 14:17, Matthias [EMAIL PROTECTED] wrote: Hi, I have the following problem: When posting a new Notification, I pass along a PendingIntent used to fire up an Activity that shows details about this Notification. These details are passed as a Serializable Extra. However, the Intent holding the Extra is only updated once, when the Activity was started for the first time. If a new Notification arrives however, although I instantiate a new Intent, neither getIntent() nor onNewIntent() of said Activity deliver this new intent, instead they always deliver the Intent that was active when the Activity was started for the first time. I tried combining many of the flags that can be passed to Intents and PendingIntents (in particular FLAG_ACTIVITY_SINGLE_TOP which is said to do exactly what I need, namely calling onNewIntent() with the new intent, but that's not the case), but no luck. So, how can I update my Activity with the Intent used to fire it, whenever the Activity is already running? Thanks, Matthias --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Notification details Activity never receives Intent used to fire it
Guillaume, you're my hero. Thanks! Works like a champ now. Curse Google and their terrible documentation, I spent the whole day hunting down a bug that ain't there... great. Now I'll go home and bang my head at the wall for the rest of the day. On 20 Nov., 17:59, Guillaume Perrot [EMAIL PROTECTED] wrote: I have this bug too, It works better when I put a requestCode in the PendingIntent, but according to the documentation, this parameter is not used... Strange... Even by doing that it sometimes fail, but without that, it surely fails as you both noticed. Here is the way I post my notification: Notification notification = new Notification (R.drawable.public_post_icon, text, post.getPublishedDate().getTime()); notification.flags = Notification.FLAG_AUTO_CANCEL; notification.setLatestEventInfo(mContext, authorDisplayName + + PUBLISHED_A_POST, text, PendingIntent.getActivity(mContext, mRequestCodeIncrementor++, postIntent, 0)); I already filed a bug some months ago but no one at google read it...http://code.google.com/p/android/issues/detail?id=863 On Nov 20, 5:38 pm, Matthias [EMAIL PROTECTED] wrote: This gets weirder every minute. Just out of curiosity I just called setIntent(null) in onPause() to make sure the Intent the Activity was started with is always reset. As soon as I start the Activity again though, getIntent() will AGAIN return the Intent I supposedly set to null before.. this Intent it returns even exists across re-deployments of the whole application (not across emulator reboots tho)! Am I the only one having these problems? ^^ This whole thing looks completely broken to me. None of the functionalities I used exposed the behavior that was documented. On 20 Nov., 17:03, Matthias [EMAIL PROTECTED] wrote: I think this may be a bug in Android. I also tried following the instructions from the docs under section Launch Modes and Launch Flags with no success. That section suggested to declare any Activity launched from NotificationManager to set the taskAffinitity to and finishOnTaskLaunch to true, so that the Activity does a clean start everytime it is called. Even though the Activity is completely restarted now (onStart() is called), getIntent() always yields the same intent, the one it was started with for the very first time... On 20 Nov., 14:17, Matthias [EMAIL PROTECTED] wrote: Hi, I have the following problem: When posting a new Notification, I pass along a PendingIntent used to fire up an Activity that shows details about this Notification. These details are passed as a Serializable Extra. However, the Intent holding the Extra is only updated once, when the Activity was started for the first time. If a new Notification arrives however, although I instantiate a new Intent, neither getIntent() nor onNewIntent() of said Activity deliver this new intent, instead they always deliver the Intent that was active when the Activity was started for the first time. I tried combining many of the flags that can be passed to Intents and PendingIntents (in particular FLAG_ACTIVITY_SINGLE_TOP which is said to do exactly what I need, namely calling onNewIntent() with the new intent, but that's not the case), but no luck. So, how can I update my Activity with the Intent used to fire it, whenever the Activity is already running? Thanks, Matthias --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Notification details Activity never receives Intent used to fire it
Well, when /do/ PendingIntents match? All I can say is that calling PendingActivity.getActivity() created a new PendingIntent each time I called it (I checked the OID in the debugger), and in this new object, I always store a new Intent object. As Guillaume suggested, I solved the problem by calling getActivity() like this: private static int requestCode; ... pi = PendingIntent.getActivity(context, requestCode++, intent, 0) and now everything works as expected. As for the intent itself, I instantiated it using FLAG_ACTIVITY_NEW_TASK and FLAG_ACTIVITY_SINGLE_TOP. On 20 Nov., 22:55, Dianne Hackborn [EMAIL PROTECTED] wrote: I am really not clear on exactly what you are doing or expecting, but one thing to watch out for -- when you get a PendingIntent, if there is already a PendingIntent matching the Intent you have been given (NOT including the extras), then you get that PendingIntent, NOT a new one. So if you want to change the extras you will either need to cancel the existing one, or modify something in the action, type, data, or category so that it doesn't match the existing one. This is covered (not very well) in the last paragraph of the PendingIntent documentation: http://code.google.com/android/reference/android/app/PendingIntent.html On Thu, Nov 20, 2008 at 8:38 AM, Matthias [EMAIL PROTECTED] wrote: This gets weirder every minute. Just out of curiosity I just called setIntent(null) in onPause() to make sure the Intent the Activity was started with is always reset. As soon as I start the Activity again though, getIntent() will AGAIN return the Intent I supposedly set to null before.. this Intent it returns even exists across re-deployments of the whole application (not across emulator reboots tho)! Am I the only one having these problems? ^^ This whole thing looks completely broken to me. None of the functionalities I used exposed the behavior that was documented. On 20 Nov., 17:03, Matthias [EMAIL PROTECTED] wrote: I think this may be a bug in Android. I also tried following the instructions from the docs under section Launch Modes and Launch Flags with no success. That section suggested to declare any Activity launched from NotificationManager to set the taskAffinitity to and finishOnTaskLaunch to true, so that the Activity does a clean start everytime it is called. Even though the Activity is completely restarted now (onStart() is called), getIntent() always yields the same intent, the one it was started with for the very first time... On 20 Nov., 14:17, Matthias [EMAIL PROTECTED] wrote: Hi, I have the following problem: When posting a new Notification, I pass along a PendingIntent used to fire up an Activity that shows details about this Notification. These details are passed as a Serializable Extra. However, the Intent holding the Extra is only updated once, when the Activity was started for the first time. If a new Notification arrives however, although I instantiate a new Intent, neither getIntent() nor onNewIntent() of said Activity deliver this new intent, instead they always deliver the Intent that was active when the Activity was started for the first time. I tried combining many of the flags that can be passed to Intents and PendingIntents (in particular FLAG_ACTIVITY_SINGLE_TOP which is said to do exactly what I need, namely calling onNewIntent() with the new intent, but that's not the case), but no luck. So, how can I update my Activity with the Intent used to fire it, whenever the Activity is already running? Thanks, Matthias -- Dianne Hackborn Android framework engineer [EMAIL PROTECTED] Note: please don't send private questions to me, as I don't have time to provide private support. All such questions should be posted on public forums, where I and others can see and answer them. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Notification details Activity never receives Intent used to fire it
And to further clear up my intentions: I have a model class called Event. It represents user activity in my system (such as rating items or writing messages). These events are delivered to the user through NotificationManager. For every such event, the NM calls Event.toNotification() and delivers the notification. Furthermore, I have an activity called EventDetailsActivity. This is triggered whenever the user taps on the notification to read the event info in full length. This implies primarily two things: 1. I must be able to pass an Event model object to EventDetailsActivity whenever the user taps the corresponding notification 2. I must be able to reuse EventDetailsActivity even it is already displaying another event (e.g. update it via onNewIntent()) Thus, in Event.toNotification(), I do this: public final Notification toNotification(Context context) { Intent intent = new Intent(context, EventDetailsActivity.class); intent.putExtra(event, this); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_SINGLE_TOP); configureIntent(intent); // template method for subclasses PendingIntent contentIntent = PendingIntent.getActivity (context, requestCode++, intent, 0); Notification notification = new Notification (getNotificationIcon(), getTickerText(), getDate().getTime()); notification.setLatestEventInfo(context, getTitle(), getText (), contentIntent); return notification; } Hope that clears up my intentions. On 21 Nov., 11:14, Matthias [EMAIL PROTECTED] wrote: Well, when /do/ PendingIntents match? All I can say is that calling PendingActivity.getActivity() created a new PendingIntent each time I called it (I checked the OID in the debugger), and in this new object, I always store a new Intent object. As Guillaume suggested, I solved the problem by calling getActivity() like this: private static int requestCode; ... pi = PendingIntent.getActivity(context, requestCode++, intent, 0) and now everything works as expected. As for the intent itself, I instantiated it using FLAG_ACTIVITY_NEW_TASK and FLAG_ACTIVITY_SINGLE_TOP. On 20 Nov., 22:55, Dianne Hackborn [EMAIL PROTECTED] wrote: I am really not clear on exactly what you are doing or expecting, but one thing to watch out for -- when you get a PendingIntent, if there is already a PendingIntent matching the Intent you have been given (NOT including the extras), then you get that PendingIntent, NOT a new one. So if you want to change the extras you will either need to cancel the existing one, or modify something in the action, type, data, or category so that it doesn't match the existing one. This is covered (not very well) in the last paragraph of the PendingIntent documentation: http://code.google.com/android/reference/android/app/PendingIntent.html On Thu, Nov 20, 2008 at 8:38 AM, Matthias [EMAIL PROTECTED] wrote: This gets weirder every minute. Just out of curiosity I just called setIntent(null) in onPause() to make sure the Intent the Activity was started with is always reset. As soon as I start the Activity again though, getIntent() will AGAIN return the Intent I supposedly set to null before.. this Intent it returns even exists across re-deployments of the whole application (not across emulator reboots tho)! Am I the only one having these problems? ^^ This whole thing looks completely broken to me. None of the functionalities I used exposed the behavior that was documented. On 20 Nov., 17:03, Matthias [EMAIL PROTECTED] wrote: I think this may be a bug in Android. I also tried following the instructions from the docs under section Launch Modes and Launch Flags with no success. That section suggested to declare any Activity launched from NotificationManager to set the taskAffinitity to and finishOnTaskLaunch to true, so that the Activity does a clean start everytime it is called. Even though the Activity is completely restarted now (onStart() is called), getIntent() always yields the same intent, the one it was started with for the very first time... On 20 Nov., 14:17, Matthias [EMAIL PROTECTED] wrote: Hi, I have the following problem: When posting a new Notification, I pass along a PendingIntent used to fire up an Activity that shows details about this Notification. These details are passed as a Serializable Extra. However, the Intent holding the Extra is only updated once, when the Activity was started for the first time. If a new Notification arrives however, although I instantiate a new Intent, neither getIntent() nor onNewIntent() of said Activity deliver this new intent, instead they always deliver the Intent that was active when the Activity was started for the first time. I tried combining many
[android-developers] Re: Notification details Activity never receives Intent used to fire it
that's exactly the behavior I am noticing, too. On 21 Nov., 11:38, Guillaume Perrot [EMAIL PROTECTED] wrote: I retested my application, I can post two notifications with two pending intents with the same action (but different extra args) and this works only if put different request codes each time... I tested to click them in different orders to check it this really works: it works, the correct extra args values are received by my activity which handle these intents. This activity is in singleTop launch mode, I received these intents via the onNewIntent() method. 2008/11/21 Matthias [EMAIL PROTECTED] Well, when /do/ PendingIntents match? All I can say is that calling PendingActivity.getActivity() created a new PendingIntent each time I called it (I checked the OID in the debugger), and in this new object, I always store a new Intent object. As Guillaume suggested, I solved the problem by calling getActivity() like this: private static int requestCode; ... pi = PendingIntent.getActivity(context, requestCode++, intent, 0) and now everything works as expected. As for the intent itself, I instantiated it using FLAG_ACTIVITY_NEW_TASK and FLAG_ACTIVITY_SINGLE_TOP. On 20 Nov., 22:55, Dianne Hackborn [EMAIL PROTECTED] wrote: I am really not clear on exactly what you are doing or expecting, but one thing to watch out for -- when you get a PendingIntent, if there is already a PendingIntent matching the Intent you have been given (NOT including the extras), then you get that PendingIntent, NOT a new one. So if you want to change the extras you will either need to cancel the existing one, or modify something in the action, type, data, or category so that it doesn't match the existing one. This is covered (not very well) in the last paragraph of the PendingIntent documentation: http://code.google.com/android/reference/android/app/PendingIntent.html On Thu, Nov 20, 2008 at 8:38 AM, Matthias [EMAIL PROTECTED] wrote: This gets weirder every minute. Just out of curiosity I just called setIntent(null) in onPause() to make sure the Intent the Activity was started with is always reset. As soon as I start the Activity again though, getIntent() will AGAIN return the Intent I supposedly set to null before.. this Intent it returns even exists across re-deployments of the whole application (not across emulator reboots tho)! Am I the only one having these problems? ^^ This whole thing looks completely broken to me. None of the functionalities I used exposed the behavior that was documented. On 20 Nov., 17:03, Matthias [EMAIL PROTECTED] wrote: I think this may be a bug in Android. I also tried following the instructions from the docs under section Launch Modes and Launch Flags with no success. That section suggested to declare any Activity launched from NotificationManager to set the taskAffinitity to and finishOnTaskLaunch to true, so that the Activity does a clean start everytime it is called. Even though the Activity is completely restarted now (onStart() is called), getIntent() always yields the same intent, the one it was started with for the very first time... On 20 Nov., 14:17, Matthias [EMAIL PROTECTED] wrote: Hi, I have the following problem: When posting a new Notification, I pass along a PendingIntent used to fire up an Activity that shows details about this Notification. These details are passed as a Serializable Extra. However, the Intent holding the Extra is only updated once, when the Activity was started for the first time. If a new Notification arrives however, although I instantiate a new Intent, neither getIntent() nor onNewIntent() of said Activity deliver this new intent, instead they always deliver the Intent that was active when the Activity was started for the first time. I tried combining many of the flags that can be passed to Intents and PendingIntents (in particular FLAG_ACTIVITY_SINGLE_TOP which is said to do exactly what I need, namely calling onNewIntent() with the new intent, but that's not the case), but no luck. So, how can I update my Activity with the Intent used to fire it, whenever the Activity is already running? Thanks, Matthias -- Dianne Hackborn Android framework engineer [EMAIL PROTECTED] Note: please don't send private questions to me, as I don't have time to provide private support. All such questions should be posted on public forums, where I and others can see and answer them. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group
[android-developers] Is TextView supposed to be able to scroll its contents?
It was my understanding that even though TextView is not a ScrollView, it has scrolling functionality built-in. However, I'm not able to scroll the contents of a TextView (that's on 1.6). I've reduced my code to the most trivial example: ?xml version=1.0 encoding=utf-8? LinearLayout xmlns:android=http://schemas.android.com/apk/res/ android android:layout_height=fill_parent android:layout_width=fill_parent android:orientation=vertical TextView android:layout_width=fill_parent android:layout_height=fill_parent android:inputType=text|textMultiLine android:singleLine=false / /LinearLayout I then defined a really long string for testing, which I set on this text view using setText(). The text is too long for the TextView, but there is no way to scroll it. So do I need to wrap it in a ScrollView after all? Cheers, Matthias -- 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] Droid-Fu: A shared library for Android application developers
Hey folks, I have been working on a utility library for Android for some while now, and I believe it has now enough cool things to offer to make it public. An introduction on my blog: http://brainflush.wordpress.com/2009/11/16/introducing-droid-fu-for-android-betteractivity-betterservice-and-betterasynctask/ Source code is here: http://github.com/kaeppler/droid-fu There's more in the lib of course, most of which I will cover in upcoming blog posts. Contributions and feedback welcome! Cheers, Matthias -- 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: PNG optimization on packaging process
how did you do the pre-dithering? our designer created a host of images with dithering enabled, but it didn't have any effect. The artifacts would only disappear when setting setDither(true) on EVERY SINGLE drawable having a gradient. This seems like a major framework fail... 16Bit graphics? It's 2009, I'd sort of expect better image rendering than that of Window 3.11. On Oct 30, 3:55 am, Ian iangm...@gmail.com wrote: The pre-dithering of the images worked fine (I've had to download a dithering plugin to photoshop). On Oct 29, 3:52 pm, Ian Guedes Maia iangm...@gmail.com wrote: Thanks. I've checked it and the optimization do not affect the colors the way that is shown on the emulator/device. I've tried to define a proxy XML for the PNG and set its dither to true, but it didn't worked. I'll try to change the png image settings on photoshop or something. I've found some previous discussion on the subject, but nothing conclusive i guess:http://osdir.com/ml/AndroidBeginners/2009-06/msg00017.html(I'lltry that)http://groups.google.com/group/android-developers/browse_thread/threa.. 2009/10/29 webmonkey webmonke...@gmail.com: To do a true comparison of what the PNG is like after 'optimization' take it out of the final APK, it is just a zip archive. The banding artifacts you see are because the device and the emulator are displaying in 16-bit 565 pixel format, they can't display all the colors. Have you tried painting the image with Paint.setDither(true) turned on: http://developer.android.com/reference/android/graphics/Paint.html#se... On Oct 28, 9:20 pm, Ian iangm...@gmail.com wrote: Hi all, I've noticed that the PNGs of my application with some gradients effects looked terribly bad at the device (a Samsung Galaxy) and at the emulator, and I've found the following note at the documentation (http://developer.android.com/guide/topics/graphics/2d- graphics.html): Note: Image resources placed in res/drawable/ may be automatically optimized with lossless image compression by the aapt tool. For example, a true-color PNG that does not require more than 256 colors may be converted to an 8-bit PNG with a color palette. This will result in an image of equal quality but which requires less memory. So be aware that the image binaries placed in this directory can change during the build. If you plan on reading an image as a bit stream in order to convert it to a bitmap, put your images in the res/raw/ folder instead, where they will not be optimized. I've tried the res/raw suggestion, but it didn't worked. I've tried to use the image as JPEG as a workaround, but I couldn't use 9-patch. I've uploaded a comparison between the original png and the optimized png that is shown on the emulator or devices:http://www.weka.com.br/temp/img/comparison.jpg One workaround would be put the images at /assets/ and manually load and set the image on the ImageViews, but it requires a lot of code changes. Any ideas? Is there any way to disable this optimization? Thanks in advance, Ian -- 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: PNG optimization on packaging process
On Nov 24, 5:28 pm, Romain Guy romain...@google.com wrote: This seems like a major framework fail... 16Bit graphics? It's 2009, I'd sort of expect better image rendering than that of Window 3.11. Except that phone displays do not display more than 16 bits of colors. The displays are natively 565. You mean /Android/ phones? The iPhone supports 6 Bits per color, that's 18 Bits you have to render e.g. a gradient. That's 4 times the color richness of Android. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: PNG optimization on packaging process
On Nov 24, 5:28 pm, Romain Guy romain...@google.com wrote: This seems like a major framework fail... 16Bit graphics? It's 2009, I'd sort of expect better image rendering than that of Window 3.11. Except that phone displays do not display more than 16 bits of colors. The displays are natively 565. You mean /Android/ phones? AFAIK the iPhone uses 6 Bits per color, that's 18 Bits you got for image rendering. While it's also not True Color, it's still 4 times the color richness of Android. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: no title bar
call requestWindowFeature(Window.FEATURE_NO_TITLE) before calling setContentView() OR set it as part of a style definition (android:windowNoTitle=true). On Nov 25, 5:16 pm, Jags jag...@gmail.com wrote: I dont want title bar in my application, how to remove that ? in my activity ? Jagat -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] java.net.HttpURLConnection throws Received authentication challenge is null
I am using HttpURLConnection to send a GET request to a server. Upon reading the response code, the Android implementation of HttpURLConnection.doRequestInternal() throws an exception: java.io.IOException: Received authentication challenge is null I don't even get what the error is trying to tell me. I write an OAuth param string to the Authorization header, but this works fine on other occasions. There is nothing peculiar about my request apart from that. Any idea what this means, what is causing this and how to get around it? This works fine with Sun's Java implementation, so I guess it's a problem with Apache Harmony? Thanks! Matthias --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: java.net.HttpURLConnection throws Received authentication challenge is null
Hi Mark, you were right: it was a 401 causing this. The odd thing being, I got this exception *before* I was actually able to check for a 401 (it was thrown in getResponseCode()). But now knowing this error represents a 401, I was able to fix it in my code (I was not sending the OAuth verifier code which was required at this point). Thanks! On Aug 31, 3:33 pm, Mark Murphy mmur...@commonsware.com wrote: I am using HttpURLConnection to send a GET request to a server. Upon reading the response code, the Android implementation of HttpURLConnection.doRequestInternal() throws an exception: java.io.IOException: Received authentication challenge is null I don't even get what the error is trying to tell me. Off the cuff, it would seem as though you're getting a 401 Unauthorized error, due to a malformed Authorization header. This works fine with Sun's Java implementation, so I guess it's a problem with Apache Harmony? That's a distinct possibility. -- Mark Murphy (a Commons Guy)http://commonsware.com Android App Developer Books:http://commonsware.com/books.html --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] What's the meaning of obtainStyledAttributes() and a custom attrs.xml?
I've seen this in the Gallery API Demo shipping with the SDK. There is an attrs.xml holding declare-stylable tags, and the gallery adapter then does this: in attrs.xml: declare-styleable name=Gallery1 attr name=android:galleryItemBackground / /declare-styleable in Gallery1.java: // See res/values/attrs.xml for the declare-styleable that defines // Gallery1. TypedArray a = obtainStyledAttributes (R.styleable.Gallery1); mGalleryItemBackground = a.getResourceId( R.styleable.Gallery1_android_galleryItemBackground, 0); a.recycle(); ... // The preferred Gallery item background i.setBackgroundResource(mGalleryItemBackground); I couldn't find any point in the code where the background resource is set to an actual value. There is a gallery_background_1 drawable defined, but it's nowhere used (at least Eclipse search didn't find any references to it). --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Resizing dialog window does not work
In one of my activities, I use the Theme.Dialog style, and I can't get the window to launch at full size. What I do is this: protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); WindowManager.LayoutParams lp = new WindowManager.LayoutParams (); lp.width = WindowManager.LayoutParams.FILL_PARENT; lp.height = WindowManager.LayoutParams.FILL_PARENT; getWindow().setAttributes(lp); ... } why does that not work? I also tried setting the size in pixels, but that has no effect whatsoever. --~--~-~--~~~---~--~~ 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: Resizing dialog window does not work
additional note: I even added a LinearLayout with FILL_PARENT for width and height to the activity view root, but still, the activity window is not resizing. --~--~-~--~~~---~--~~ 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: Customing the lookfeel of DatePicker and TimePicker widgets
Just out of curiosity, why are you hijacking this thread? On Sep 1, 1:25 pm, Armond Avanes armond...@yahoo.com wrote: Hi Guys, I'm seeking a way to customize the lookfeel of DatePicker and TimePicker. But I couldn't find any theme attribute to be related to these two widgets... Any help is greatly appreciated! Cheersss, Armond --~--~-~--~~~---~--~~ 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 make a RotateDrawable actually rotate?
Hi, I've been struggling to find out how Android's animation framework works, as it's basically undocumented. What I want to do is create a custom rotating spinner graphic (similar to an ajax loader). Now, I looked at how the framework uses RotateDrawable, and basically copied the XML used to define such a drawable. But, when I set this drawable as an image resource or background, it remains static rather that performing the rotation. So how to I trigger the rotation? There is a class called RotateAnimation, but it asks the same things off me (e.g. rotation degrees, pivot) that I already defined in the RotateDrawable... that can't be right I guess? So how do I trigger the rotation of a RotateDrawable? Thanks in advance, Matthias --~--~-~--~~~---~--~~ 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 cannot fill whole screen
Hi, I am also trying to find a solution to this... On Jul 31, 4:41 pm, nEx.Software email.nex.softw...@gmail.com wrote: Just out of curiosity, why are you using a dialog if you want it to fill the screen? simply because there are occasions where you need to replace content in the dialog dynamically and you don't want the dialog to resize but remain at full width and height. For instance, I need to display images of different width and height in the dialog, and I don't want the dialog to change size with every image the user looks at. --~--~-~--~~~---~--~~ 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 cannot fill whole screen
Hi Dianne, this is what I did, and it didn't work: WindowManager.LayoutParams lp = new WindowManager.LayoutParams(); lp.width = WindowManager.LayoutParams.FILL_PARENT; lp.height = WindowManager.LayoutParams.FILL_PARENT; getWindow().setAttributes(lp); that has no effect whatsoever (I called it in onCreate(), tried calling it before and after the super.onCreate(), but no luck). What I do now is implement a custom LinearLayout for the activity where I override onMeasure() and set the width and height to the screen width and height. But that's incorrect of course, because that size is larger than the actual canvas (it doesn't account for menu and toolbars). Can you help me out here? Why is there no simple way to fix a dialog's size? Cheers, Matthias On Sep 1, 6:55 pm, Dianne Hackborn hack...@android.com wrote: The dialog theme, as part of its nature, sets the top-level window layout to be WRAP_CONTENT. You could try manually setting the Window layout width and height to FILL_PARENT, though this is going to make for a kind-of weird dialog (especially if one day you find yourself running on a large screen...). On Tue, Sep 1, 2009 at 7:18 AM, matthias m.kaepp...@googlemail.com wrote: Hi, I am also trying to find a solution to this... On Jul 31, 4:41 pm, nEx.Software email.nex.softw...@gmail.com wrote: Just out of curiosity, why are you using a dialog if you want it to fill the screen? simply because there are occasions where you need to replace content in the dialog dynamically and you don't want the dialog to resize but remain at full width and height. For instance, I need to display images of different width and height in the dialog, and I don't want the dialog to change size with every image the user looks at. -- Dianne Hackborn Android framework engineer hack...@android.com Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: How to make a RotateDrawable actually rotate?
Still looking for an answer, thanks! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: How to reference (icon) drawables delivered with Android in XML
android:icon=@android:drawable/iconfile Cheers, Matthias On Sep 4, 11:10 am, f_heft delphik...@gmail.com wrote: Hello, I'm defining my options menu in an XML file and I want to add an icon to the menu items. Normally, this would be sth like -- (...) android:icon=@drawable/iconfile / -- But I want to use the drawables that are already stored in the android.jar (as listed here:http://www.screaming-penguin.com/info/android_drawables/android_drawa... ). As the website says, I can access them via -- myMenuItem.setIcon(android.R.drawable.ic_menu_save); -- But how can I do that in XML? I tried several things but none worked for me... Best regards, F Heft --~--~-~--~~~---~--~~ 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: Announcing RoboGuice 1.0
I was thinking about using Guice myself before, but hesitated fearing to make the overall sluggishness of the platform even worse. How much of an overhead are talking about in terms of memory footprint and size of bundled libraries? Any noticeable impacts on speed or battery life? How often does Guice kick in in the background? I'm currently stepping back from overly abstract programming models on Android because of exactly these issues. On Mar 29, 8:53 pm, Michael Burton m...@niskala.org wrote: Hello Android developers, I'd like to announce the final release of RoboGuice 1.0! http://code.google.com/p/roboguice RoboGuice is a framework that brings the simplicity and ease of Dependency Injection to Android, using Google's own Guice library. If you've ever used Spring (the #1 enterprise framework on Java, now more popular than J2EE itself) or Guice, you already know how convenient this style of programming can be. To give you an idea, take a look at this simple example of a typical Android activity: class AndroidWay extends Activity { TextView name; ImageView thumbnail; LocationManager loc; Drawable icon; String myName; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); name = (TextView) findViewById(R.id.name); thumbnail = (ImageView) findViewById(R.id.thumbnail); loc = (LocationManager) getSystemService(Activity.LOCATION_SERVICE); icon = getResources().getDrawable(R.drawable.icon); myName = getString(R.string.app_name); name.setText( Hello, + myName ); } } This example is 18 lines of code. If you're trying to read through onCreate(), you have to skip over 5 lines of boilerplate initialization to find the only one that really matters: name.setText(). And complex activities can end up with a lot more of this sort of initialization code. Compare this to the same app, written using RoboGuice: class RoboWay extends GuiceActivity { @InjectView(R.id.name) TextView name; @InjectView(R.id.thumbnail) ImageView thumbnail; @InjectResource(R.drawable.icon) Drawable icon; @InjectResource(R.string.app_name) String myName; @Inject LocationManager loc; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); name.setText( Hello, + myName ); } } In this example, onCreate() is much easier to take in at a glance. All the platform boilerplate is stripped away and you're left with just your own app's business logic. Do you need a SystemService? Inject one. Do you need a View or Resource? Inject those, too, and RoboGuice will take care of the details. RoboGuice's goal is to make your code be about your app, rather than be about all the initialization and lifecycle code you typically have to maintain in Android. RoboGuice has been in development since August 2009, and 0.9 entered release candidacy in December and has been stabilizing ever since. After three months and a few finishing touches, we now believe it's ready to expose to a larger audience. We know that RoboGuice won't be for everybody. Although RoboGuice never prevents you from doing things the Android way, some people will still prefer seeing everything spelled out explicitly in their code. And other people who write extremely high performance applications such as games may not want to incur the small overhead imposed by yet another framework. But for people who want to build simple and straightforward code that's easily testable and easy to read, I encourage you to give RoboGuice a try. We hope you like it. Stop by our discussion forums if you'd like to have any help getting started. Cheers, Mike PS. We're beginning work on RoboGuice 1.1 now, which will include more injectible objects, better unit testing support, and hopefully some general usability improvements as well. I'd love to hear your thoughts on other things you'd like to see in the next release. -- 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 To unsubscribe, reply using remove me as the subject.
[android-developers] onConfigurationChanged whielk splash scrren i shown
Hi, I implemented a splash screen activity in the following way. [...] public class Splash extends Activity { private final int SPLASH_DISPLAY_LENGHT = 3000; private Handler handler = new Handler(); @Override public void onCreate(Bundle bundle){ super.onCreate(bundle); setContentView(R.layout.splash); handler.postDelayed(new Runnable() { public void run() { Log.d(this.getClass().getName(), handler.postDelayed()); /* Create an intent that will start the main activity. */ Intent mainIntent = new Intent(Splash.this, MyListView.class); MyListView.this.startActivity(mainIntent); MyListView.this.finish(); } }, SPLASH_DISPLAY_LENGHT); } @Override public void onStart() { super.onStart(); } @Override public void onConfigurationChanged(Configuration newConfig) { Log.d(this.getClass().getName(), onConfigurationChanged newConfig: + newConfig.toString()); super.onConfigurationChanged(newConfig); } [...] Everythings works fine unless.. a configuration change event handeled while the splash screen is shown. In this case everytime the orientation change the handler add a new Runabel Object to queue. And the MyListActivity will be started X-times. i am thankfull for every advice. best regards matthias -- 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 To unsubscribe, reply using remove me as the subject.
[android-developers] ErrorHandler of VideoView component
Hi, I am currently working with a videoview to show live broadcasts. For this I want to adapt the error messages which are shown by the videoview component, when an error occures (connection error, video error etc..). Is it ist possible to register another error handler to a videoview? best regards Matthias -- 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: Emulator 2.1 2.2 reverse geocoding not available
any progress on this anyone? this is really annoying, I basically can't test our app on 2.2 since we heavily rely on the Geocoder. -- 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] InstrumentationTestCase.sendKeys() fails on headless emulators
Hi, before reporting this as a bug, I thought I'd ask here (I also posted on stackoverflow with no reply so far, but the Google developers don't seem to be actively posting there anyway -- http://stackoverflow.com/questions/3214531/how-to-send-key-events-to-a-headless-emulator-in-an-instrumentation-test). So the problem is: We run a build server in our company on a headless Linux, so we have to start the emulator with the -no-window flag when running the instrumentation tests. When this flag is set, however, the InstrumentationTestCase.sendKeys() method fails -- not with an exception, but there is an obscure message in the device log: Permission denied: injecting key event from pid 646 uid 10026 to window Window{43d55100 paused=false} owned by uid 1000 this works fine on a normal emulator which does have a window. We already tried fumbling with the INJECT_EVENTS permission, process affinity and sharedUserId, but nothing works. This basically makes our test suite useless on a build server, which are typically headless. Is this a bug or are we missing something? Thanks, Matthias -- 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: InstrumentationTestCase.sendKeys() fails on headless emulators
Anyone? -- 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] OAuth on Android
Hey guys, I have recently been working on an OAuth library that has been designed to play well with Apache HttpComponents 4 (and thus, Android of course). If you're looking for a straight forward way to do client- side OAuth on Android, check it out (literally) here: http://code.google.com/p/oauth-signpost I'd like to get feedback / suggestions / contributions from my fellow Android developers (that would be you!). Cheers, Matthias PS: there is also a slightly opinionated (hence missing on the project homepage) rationale for why I started this project on my blog: http://brainflush.wordpress.com/2009/05/03/introducing-signpost-easy-oauth-for-java-and-apache-httpcomponents-android-too/ --~--~-~--~~~---~--~~ 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: List All files in the directory
Hi, for accessing e.g. the shared_prefs directory, you would do something like this (in an Activity or Service): PackageManager pm = getPackageManager(); ApplicationInfo appInfo = pm.getApplicationInfo(getPackageName (), 0); final ListString list = Arrays.asList(files); File sharedPrefsDir = new File(appInfo.dataDir + / shared_prefs); FileFilter filter = new FileFilter() { public boolean accept(File pathname) { // in case you must filter files... [...] } }; File[] prefFiles = sharedPrefsDir.listFiles(filter); for (File f : prefFiles) { [...] } } HTH. Cheers, Matthias --~--~-~--~~~---~--~~ 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: List All files in the directory
Hi, not sure about the app dir, but for accessing e.g. the shared_prefs directory, you would do something like this (in an Activity or Service): PackageManager pm = getPackageManager(); ApplicationInfo appInfo = pm.getApplicationInfo(getPackageName (), 0); File sharedPrefsDir = new File(appInfo.dataDir + / shared_prefs); FileFilter filter = new FileFilter() { public boolean accept(File pathname) { // in case you must filter files... [...] } }; File[] prefFiles = sharedPrefsDir.listFiles(filter); for (File f : prefFiles) { [...] } } HTH. --~--~-~--~~~---~--~~ 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: Does anyone do XPath on Android?
anyone? --~--~-~--~~~---~--~~ 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: include/ in TableRow
I have the same problem with including an EditText into a RelativeLayout. All layout parameters are ignored, or at least not recognized properly. The width/height fix doesn't work for me, because the included view must not have fixed width or height. The included view: ?xml version=1.0 encoding=UTF-8? EditText xmlns:android=http://schemas.android.com/apk/res/android; android:id=@+id/location_field android:layout_width=wrap_content android:layout_height=wrap_content android:singleLine=true android:paddingLeft=10sp android:paddingRight=10sp android:layout_centerVertical=false android:layout_centerHorizontal=true android:inputType=text android:imeOptions=actionDone|flagNoEnterAction / And the layout where I include it: ?xml version=1.0 encoding=utf-8? RelativeLayout xmlns:android=http://schemas.android.com/apk/res/android; android:layout_width=fill_parent android:layout_height=fill_parent android:background=@android:color/transparent ... LinearLayout android:id=@+id/search_linear_layout_1 android:layout_below=@id/search_title_image android:layout_height=wrap_content android:layout_width=fill_parent ... /LinearLayout include layout=@layout/location_field android:id=@+id/search_edit_text android:layout_width=300px android:layout_below=@id/search_linear_layout_1 / LinearLayout android:id=@+id/search_linear_layout_2 android:layout_below=@id/search_edit_text android:layout_height=wrap_content android:layout_width=fill_parent ... /LinearLayout ... /RelativeLayout The edit box floats at the top of the screen instead of below the linear layout, and is also not 300 pixels wide. Any ideas? Thanks, Matthias --~--~-~--~~~---~--~~ 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: include/ in TableRow
Correction: Passing the layout_* params to include works, but you MUST provide them there, not in the included view. If you pre-define them in the included view, then they get ignored, so there is no point in defining defaults and only overriding the ones you need to change; you always have to pass all layout attributes in the include directive. :-/ Is this a bug? --~--~-~--~~~---~--~~ 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] gravity vs. layout_gravity? I'm lost.
Hi, I think I've lost enough hair over this, so now I'll ask. What is the difference between those attributes? According to the documentation of R.attr, there isn't any difference (doc text is exactly the same, see http://developer.android.com/reference/android/R.attr.html), but apparently, that's simply not true. For example, the gravity attribute can be used on EditText to set the text alignment (e.g. left, center, right). I often found that neither of them work to align a view at all. For example, I need to float two text views in a relative layout, one going to the left below a title bar, the other going to the right below the title bar. So what I did was this: RelativeLayout xmlns:android=http://schemas.android.com/apk/res/android; android:layout_width=fill_parent android:layout_height=fill_parent !-- the title bar -- ImageView ... /ImageView TextView android:id=@+id/left_text android:layout_below=@id/title_bar android:layout_gravity=left ... / TextView android:id=@+id/right_text android:layout_below=@id/title_bar android:layout_gravity=right ... / /RelativeLayout That doesn't work, however. The left text is indeed aligned to the left inside its parent (the relative layout), but the right text is not aligned to the right; instead, it's placed directly to the right of the left text. Why's that? Thanks, Matthias --~--~-~--~~~---~--~~ 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: gravity vs. layout_gravity? I'm lost.
Guys, thanks for clearing up! I'll file a bug against the documentation then, because there it says: public static final int gravity Specifies how to place an object, both its x and y axis, within a larger containing object. Which is true for layout_gravity, but not gravity. Apart from that, I solved my problem by wrapping the two TextViewS in a horizontal LinearLayout and setting the left text to have a larger weight than the right text, so that it pushes the right text to the edge of the container (which is a good solution for me, because the left text has dynamic length, while the right one is fixed). I suspected this would work, but I first refused to try it, because somewhere in the docs or on Romain's blog it was mentioned that using LinearLayoutS and weights would be more expensive than using e.g. a RelativeLayout, because of additional layout measurement cycles. It would be great though if things like these (i.e. that RelativeLayout ignores layout_gravity) would appear somewhere in the documentation. It's not immediately apparent to people why for some layouts the gravity is simply ignored, and for others it's not. Anyway, thanks! On May 14, 5:02 pm, Romain Guy romain...@google.com wrote: It used to be called something like that but we decided to unify the names across all widgets. On Thu, May 14, 2009 at 7:58 AM, Streets Of Boston flyingdutc...@gmail.com wrote: As a side-note: I think the TextView's (and EditText) 'gravity' should have been called 'alignment'. It's called that way in most UI's. :=) On May 14, 10:54 am, Romain Guy romain...@google.com wrote: Hi, Well, first of all RelativeLayout ignores layout_gravity. Then you need to know that gravity means apply gravity to the content of this view whereas layout_gravity means apply gravity to this view within its parent. So on a TextView, gravity will align the text within the bounds of the TextView whereas layout_gravity will align the TextView within the bounds of its parent. On Thu, May 14, 2009 at 5:31 AM, Matthias m.kaepp...@googlemail.com wrote: Hi, I think I've lost enough hair over this, so now I'll ask. What is the difference between those attributes? According to the documentation of R.attr, there isn't any difference (doc text is exactly the same, see http://developer.android.com/reference/android/R.attr.html), but apparently, that's simply not true. For example, the gravity attribute can be used on EditText to set the text alignment (e.g. left, center, right). I often found that neither of them work to align a view at all. For example, I need to float two text views in a relative layout, one going to the left below a title bar, the other going to the right below the title bar. So what I did was this: RelativeLayout xmlns:android=http://schemas.android.com/apk/res/android; android:layout_width=fill_parent android:layout_height=fill_parent !-- the title bar -- ImageView ... /ImageView TextView android:id=@+id/left_text android:layout_below=@id/title_bar android:layout_gravity=left ... / TextView android:id=@+id/right_text android:layout_below=@id/title_bar android:layout_gravity=right ... / /RelativeLayout That doesn't work, however. The left text is indeed aligned to the left inside its parent (the relative layout), but the right text is not aligned to the right; instead, it's placed directly to the right of the left text. Why's that? Thanks, Matthias -- Romain Guy Android framework engineer romain...@android.com Note: please don't send private questions to me, as I don't have time to provide private support. All such questions should be posted on public forums, where I and others can see and answer them- Hide quoted text - - Show quoted text - -- Romain Guy Android framework engineer romain...@android.com Note: please don't send private questions to me, as I don't have time to provide private support. All such questions should be posted on public forums, where I and others can see and answer them --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] include-ing views into RelativeLayouts
Hi, I have a problem with including a view hierarchy into a RelativeLayout: all layout parameters provided when including it are ignored, or at least not recognized properly. More precisely: I want to position the included hierarchy (root is a LinearLayout) below another LinearLayout in the including file. Like this: ?xml version=1.0 encoding=utf-8? RelativeLayout ... ... LinearLayout android:id=@+id/search_linear_layout_1 ... ... /LinearLayout include layout=@layout/location_bar ... android:layout_below=@id/search_linear_layout_1 / ... /RelativeLayout That doesn't work. The included LinearLayout is NOT positioned below the given view, but is simply attached to the top edge of the screen. What am I missing? Thanks, Matthias --~--~-~--~~~---~--~~ 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] XML+XPath on Android using dom4j and Jaxen
Hey guys, in case you're looking for easy and powerful XML parsing on Android, you may be interested in this: http://brainflush.wordpress.com/2009/05/19/the-force-unleashed-xmlxpath-on-android-using-dom4j-and-jaxen/ Cheers, Matthias --~--~-~--~~~---~--~~ 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: XML+XPath on Android using dom4j and Jaxen
I found that it works well for us... I didn't profile the memory consumption but I also didn't experience any noticeable system or app slow downs, so I didn't feel it was necessary. At the end of the day, it's pretty clear that you're trading in some performance for stability and ease of use here. I found that it was well worth it, but that probably depends on the app you're developing. The point is: If you need a full fledged XML parser that does things such as text node merging an entity ref resolution (at least the former you will almost certainly want to have for ANY XML document), you don't have much of a choice: you either use existing, well proven solutions (such as dom4j), or you use the bare XML tools Android gives you and write everything else yourself on top of that. If the latter approach will arrive at a result which performs better than say, dom4j, AND does everything you actually need, then that's cool. I didn't see myself re- inventing the wheel though. On May 19, 5:14 pm, Zero zeroo...@googlemail.com wrote: as much as i love dom4j (and i do!), how is performance on the hardware ? dom4j tends to suck in a lot of memory, so..uh..dunno. On May 19, 2:17 pm, Matthias m.kaepp...@googlemail.com wrote: Hey guys, in case you're looking for easy and powerful XML parsing on Android, you may be interested in this:http://brainflush.wordpress.com/2009/05/19/the-force-unleashed-xmlxpa... Cheers, Matthias --~--~-~--~~~---~--~~ 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] Application.onPause()? Is there a hook like this?
Hi, I want to unregister my location listeners whenever the app is hidden by another application. I cannot use the onPause() hook in my main activity, because that hook will also be called when an activity of my app is hidden by another activity of my own app (in which case I do not want to disable location listeners -- going through a disable/ enable cycle for two location listeners is pretty expensive). In other words, is there a thing like App.onPause(), which gets triggered when the whole app is paused (i.e., no activities of the same app are visible anymore), e.g. when bringing up the home application or when a call comes in? Thanks, Matthias --~--~-~--~~~---~--~~ 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: Application.onPause()? Is there a hook like this?
Hm, so I just peeked at the source code of the Google Maps app on Android, because they seem to get it right: if you have GPS enabled, then it will stay on if the main Maps activity is hidden by another activity of the same app, e.g. the Maps history screen, but it will turn off when pausing the app via the Home button. NMapActivity.onPause() looks like this: protected void onPause() { super.onPause(); if(sActivityReference.get() == this) { ... // stop location services } else { android.util.Log.d(MapActivity, (new StringBuilder ()).append(onPause leaving the lights on for ).append (sActivityReference.get()).toString()); } } but what is sActivityReference? I suppose it's some static field with package level visibility, but it's not declared in that activity... seems to be some Android internal magic, so I cannot use it. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Application.onPause()? Is there a hook like this?
okay, so sActivityReference is a java.lang.ref.WeakReference, so apparently this is related to something else (memory management stuff I guess?). Any other ideas? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Application.onPause()? Is there a hook like this?
I found a workaround, but it's a hack, so I'm still open for better ideas. I found this to do exactly what I need: in the main activity of my app: @Override protected void onPause() { super.onPause(); ActivityManager am = (ActivityManager) getSystemService (ACTIVITY_SERVICE); ListRunningTaskInfo taskInfo = am.getRunningTasks(1); if (!taskInfo.isEmpty()) { ComponentName topActivity = taskInfo.get(0).topActivity; if (!topActivity.getPackageName().equals(getPackageName ())) { // disable listeners ... } } } what this does is find out what the most recently triggered activity is when the current activity is paused (i.e., it yields the name of the activity that caused the pause, e.g. the home app), and checks whether it's an activity of the same package or not (in the latter case, I unregister the listeners to save battery life). An app.onPause() hook or a simple isApplicationVisible() would be a lot nicer of course... --~--~-~--~~~---~--~~ 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: Application.onPause()? Is there a hook like this?
Well, I need to disable the listeners when the app goes into the background, not only when it terminates. I also tested this use of WeakReference, simply to see how it behaves, and it didn't work for me at all. Regardless of whether the app was paused to display another application or to display another activity of the same app, the identity test for 'this' always succeeded. Frankly, I do not understand how this would work at all. In onCreate (), the reference is set to 'this' (the current activity), otherwise it is set to null. So the test for 'this' in onPause is only true, if onPause() is called on the same activity instance that created the weak reference in onCreate. But how could those ever be two distinct objects? Is it possible that resuming an activity will not resurrect the old one, but create a new activity object? But wouldn't that be the same as simply doing an onCreate? I'm confused. --~--~-~--~~~---~--~~ 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: Application.onPause()? Is there a hook like this?
... It's a static reference, ie global to the process. So as activities are started the ref points to the new activity. That said, I agree the right thing to do here isn't obvious. But it's also not obvious to me why you think it's bad to unregister the listener in your apps onDestroy. I am skeptical battery life would be that badly harmed? If GPS keeps running for no reason when the user is on the home screen, users will complain, and rightfully so. GPS is probably the largest battery sucker on Android. Anyway, I guess I'll just stick with my hack, it works well (although I hate that I have to call it in EVERY SINGLE activity the user could potentially exit the app from). Frankly, I already thought about putting together a library with support classes that take care of all those things. I more and more find myself writing boilerplate code for things that really should already be handled by Android... best example is long running operations support (threads spawning from a context), which is very difficult to get right on Android with all the lifecycle states your app can be in, but that's a different story. --~--~-~--~~~---~--~~ 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] IME options behavior is inconsistent across different devices
Hi, I noticed that the imeOptions attribute on TextViews behaves inconsistently across different devices. For instance, setting imeOptions to normal has the following effects: 1) On the emulator and G1s running 1.5: The OSK will have a Done key and clicking it will simply close the OSK with no further action taken (this is exactly what I need) 2) On my HTC Magic (G2), also running 1.5 (of course): The OSK will have an enter key (showing the enter symbol instead of Done) and when clicking it, the OSK will close and bring up the context menu of the text view... I mean, seriously. That is the last thing any user or developer would expect it to do. There seems to be no way to simply close the OSK after entering some text on the G2, *except* when specifying flagNoEnterAction in imeOptions, which on the G2 does what normal does on the G1, but on the G1, this will lead to the OSK to not respond at all to the enter key (user has to hit back to close the OSK). This is a complete mess, is there any way to have the OSK behave in a sane manner without resorting to hacks (like checking for device models and setting imeOptions programmatically)? Didn't Google say they cared about backwards compatibility before releasing Cupcake? I have nothing but trouble getting my app to look and behave identical on different Android models. --~--~-~--~~~---~--~~ 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: IME options behavior is inconsistent across different devices
This is even more messed up than I thought: It seems as if on the HTC Magic, the constant values backing the different IME options are shifted to the right by one (so to speak). That is, if you look at the different options as described in the API docs, then for example setting actionSearch on the text view will do exactly that on a G1, but will result in actionNext on the G2. Similarly, setting actionSearch will result in actionSend on the Magic being activated... weirdness! Is this a known bug? --~--~-~--~~~---~--~~ 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: What's the deal with onRetainNonConfigurationInstance()?
Hi Mark, On Jun 4, 5:57 pm, Mark Murphy mmur...@commonsware.com wrote: onSaveInstanceState() is called in cases other than screen rotations (e.g., activity is being closed up due to low memory), and in those other cases, onRetainNonConfigurationInstance() is not used at all. yes, but wouldn't it be more clever to have onRetainLastNonConfigurationInstance() be called *before* onSaveInstanceState(), because then one could determine whether it's necessary to have the latter actually do something. For those cases I mentioned (which I suppose are the more typical use cases), this would be very helpful, because you could do something like this: protected Object onRetainLastNonConfigurationInstance() { return expensiveObject; } protected void onSaveInstanceState(Bundle out) { if (getLastNonConfigurationInstance() == null) { // serialize expensiveObject to bundle } } protected void onCreate(Bundle in) { Object expensiveObject = getLastNonConfigurationInstance(); if (expensiveObject == null) { // deserialize expensiveObject } } using that approach, one could benefit from that method in, what, 99.9% of all situations in which onSaveInstanceState() is called? (by which I mean orientation changes, not low memory scenarios). --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---