Re: [android-developers] Using ACTION_OPEN_DOCUMENT for editing files
Yep, you're right that checking FLAG_SUPPORTS_WRITE is the best way to check if a write is allowed. If you're really looking to focus on writing data, then ACTION_CREATE_DOCUMENT might be a better fit, since it also lets the user select an existing file, and it filters to only allow selection of documents that have FLAG_SUPPORTS_WRITE set. I'm thinking that allowing an app to request filtering of read-only documents during a OPEN_DOCUMENT request would lead to user confusion because of the inconsistency between apps. (For example, a user would still expect to open a read-only document for viewing purposes.) If a user then tried saving changes to a read-only document, it makes sense for the app to use CREATE_DOCUMENT to ask them to save the modifications somewhere else. Hope this helps. :) j On Wed, Jan 1, 2014 at 9:05 PM, Dave Smith dasmith1...@gmail.com wrote: As far as I can tell from the documentation and testing with the new Storage Access Framework and Intent.ACTION_OPEN_DOCUMENT, there doesn't seem to be a way (via an extra or otherwise) to pass with the Intent request to open a document to only return documents from providers that support writing (i.e. have FLAG_SUPPORTS_WRITE set). Instead, we are forced to check a document selection made by the user (via a metadata query) to determine if the document supports write before we attempt to open an OutputStream or ParcelFileDescriptor in w mode. Is this correct, or have I overlooked something? This seems to be a large missing piece in the new Storage Access Framework when attempting to allow a user to open an existing document to be edited as it forces the user to make a selection first, then have us check if they can write, throw and error if they cannot, and force them to pick again. Furthermore, we cannot say that it is uncommon for documents providers not to support writing, because even the system media documents provider (i.e. the source for images/videos) does not support write and will throw and IllegalArgumentException (Media is read-only) when one attempts to write to one of its files (as an image editing app, the most common example used in the docs, would attempt to do). Is there a proper method with the new SAF of limiting selections to writable providers only? Feedback appreciated for anything I may have missed here. As it stands, suggesting that developers use ACTION_OPEN_DOCUMENT for in-place editing doesn't seem like a viable approach. Dave Smith @devuwired -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Jeff Sharkey jshar...@android.com -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [android-developers] Re: MediaPlayer suddenly stopped working in Android 4.2
Starting in Android 4.2, processes may have different views of the filesystem depending on which user they're running as. For example, /sdcard/foo.mp3 could refer to different files for different users. To correctly disambiguate filesystem paths, you'll need to open the file in your app process and pass the FileDescriptor to the mediaserver (which is shared between all users on a device). Something like this should work: MediaPlayer player; FileInputStream fis = new FileInputStream(myFile); try { player.setDataSource(fis.getFD()); } finally { fis.close(); } It sounds like the setDataSource(String path) method needs to be fixed; tracking in 7962739. j On Fri, Feb 15, 2013 at 8:43 AM, Brill Pappin br...@pappin.ca wrote: So I've now tested many different ways to try and figure this out and I need to reset the code (as I've introduced some silly errors). That error is most definitely a path problem which I need to retest and make sure I didn't introduce with my own hacking :) I *do* know that what was working in 4.1.1 does not work in 4.2.1. FYI - I'm also now seeing error 19, which is Error due to general port processing whatever that means. -- -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Jeff Sharkey jshar...@android.com -- -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [android-developers] AIDL, Binder, ResultReceiver, and Performance
If the purpose of this code (and I haven't looked at it to know) is to send a command to the service and get told later when it is done, then this is a reasonable approach. Yep, that's exactly what I'm using it for. I'm kicking off a heavy background sync, and use an optional ResultReceiver to pass back success/failure along with any Exception text for Toast'ing to the user. Not my team's app... I've not looked at the code, either. :} The app was written by two engineers on the Android team, but not anyone specifically working on the framework. -- Jeff Sharkey jshar...@android.com -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] How to work with ContactsContract.Contacts.CONTENT_VCARD_URI
The openAssetFile() call should have thrown before that, since only reading r is supported. Also, keep in mind that the Uri structure that provides vCards in this formant is not part of public API. You should be treating the Uri handed to you by ACTION_SEND as an opaque Uri, as its format may change in the future. j On Mon, Dec 7, 2009 at 8:26 PM, Molee leehc...@gmail.com wrote: I can successfully retrieve a FileInputStream with this uri as follows Uri myPerson = Uri.withAppendedPath (ContactsContract.Contacts.CONTENT_VCARD_URI, iLookKey); AssetFileDescriptor afd =this.getContentResolver ().openAssetFileDescriptor(myPerson, r); FileInputStream fis = afd.createInputStream(); However, when I wanna input a vcard to change the content of a contact as follows Uri myPerson = Uri.withAppendedPath (ContactsContract.Contacts.CONTENT_VCARD_URI, iLookKey); AssetFileDescriptor afd = this.getContentResolver ().openAssetFileDescriptor(myPerson, w); FileOutputStream fos = afd.createOutputStream(); IOException is caught in the line of FileOutputStream fos = afd.createOutputStream();. and it said that unable to seek I believe that that's no problem about Lookup key . Could anyone tell me what's wrong with the exception caught??? I need to restore some vcard in codes yet I dun wanna breakdown the content of vcard by categorys. Thank You~~ -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Jeff Sharkey jshar...@android.com -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Difference between ImageView.setImageBitmap() and RemoteView.setImageViewBitmap() ????
One alternative you can use is RemoteViews.setImageViewUri(), and then write your own ContentProvider that feeds images through openAssetFile(). j On Wed, Nov 18, 2009 at 8:55 PM, tedd jeevitha.jaya...@gmail.com wrote: Hi, I have seen that the ImageView.setImageBitmap() can process high resolution images(even of size greater than 480x640), but RemoteView.setImageViewBitmap() fails with FAILED BINDER TRANSCATION error Is there ary constraint on the bitmap size which RemoteView can handle Why is the difference in the behaviour Plz clarify this... Thanks, tedd -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Jeff Sharkey jshar...@android.com -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] ACTION_APPWIDGET_PICK , filtering the list
The current API doesn't allow for filtering of that list, and that ACTION is the only method of binding. A future API improvement might be to allow automatic binding of widgets if the certificates match between the requested provider and host. j On Thu, Nov 26, 2009 at 6:44 AM, daniel.benedykt daniel.bened...@gmail.com wrote: Hi I have my own widget container. I am running the intent 'ACTION_APPWIDGET_PICK' but I want only to show some items in the list and not all items. Is there a way to filter the list? if not, is there any way to let the user just add one widget to my container, and not have to select form the list? Thanks Daniel -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Jeff Sharkey jshar...@android.com -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: appwidget Image on Orientation Change Issue
Remember that widget RemoteViews updates are applied over a potentially-cached layout. You should always set all values on each update you send. For example, if the last update you passed only updated a TextView, that single update could potentially be applied over the top of a brand new layout (such as after an orientation change). j On Sun, Nov 29, 2009 at 3:20 AM, Ryan rgra...@gmail.com wrote: Ok I think I figured it out. In certain cases when the widget is clicked i updated the RemoteViews to hide some on screen controls/ views using setViewVisibility on the remoteview, however I did not re- set the setImageURI. When the screen rotated the Image dissappeared. However this is odd because I would expect the image to dissappear on updating the RemoteView without the ImageURI even without rotating the screen. But it would only dissappear after rotating. When I did not go through the routine that hid the controls/ did not set the setViewVisibility, the image did not dissappear on rotation. I am curious as to what happens to the RemoteView on orientation change and why sometimes it seems to retain the ImageURI and others it loses it. In any case I have my workaround. - Ryan On Nov 28, 12:12 am, Ryan rgra...@gmail.com wrote: I am building an appwidget that is displaying images from the sdcard. I am investigating how to get the appwidget to perform correctly on an orientation change. Currently I am setting the image on an image button in the remoteview from a Bitmap I created in the program. However it seems that when the orientation changes this bitmap is destroyed and the image won't display unless I update the remoteview of the appwidget after the orientation change. What should I do so that when the appwidget is remade after orientation change the image is able to be redisplayed automatically? The only thing I can think of is using a setImageViewURI() to point the remoteview to the image file itself using a URI (I am having issues getting this to work correctly thus far). It seems that none of my code is excecuted on this orientation change as it is only rebuilding the remoteview. Is there an accepted practice here? Thanks, - Ryan -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Jeff Sharkey jshar...@android.com -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: Safe way to get the My Contacts Group?
You're correct, the Google Contacts sync adapter could change the TITLE for this group in the future. However, it's more likely that we'll use RES_PACKAGE and TITLE_RES to set a custom, localized title in the future. j On Thu, Nov 19, 2009 at 12:11 PM, jak. koda...@gmail.com wrote: I'm a little worried about using the literal string 'System Group: My Contacts' to find the group. Can this differ on certain devices or locales? String where = ContactsContract.Groups.ACCOUNT_NAME + ==' + toAcct + ' AND + ContactsContract.Groups.TITLE + =='System Group: My Contacts'; -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Jeff Sharkey jshar...@android.com -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] android Contacts application theme/style
The default framework theme is dark. :) j On Thu, Nov 19, 2009 at 4:16 PM, n179911 n179...@gmail.com wrote: Hi, Can you please tell me why the android Contacts application theme/style is using 'dark' theme? For example, the activity's background is Black instead of White. I have looked at their Android Manifest xml file and their layout xml file (e.g. call details.xml) file, but i don't see how they specified using a 'dark' theme? Can you please tell me how do they do that? I have looked at http://developer.android.com/guide/topics/ui/themes.html, but I don't see Contacts app is doing that. Thank you for any help. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Jeff Sharkey jshar...@android.com -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Android 2.0 Bugs in ContactsContract.Intents.Insert
The Organization and Notes fields have been fixed in a future release, internal tracking #2256272. As for the Name field, our current splitting algorithm lives down in the provider, which is why it only assigns to the first-name field. Future API should probably be added to allow callers to specify first/last name separately. j On Wed, Nov 25, 2009 at 4:10 PM, wusch jwu...@gmail.com wrote: Hi all, so I am using the Android 2.0 intents to create contacts. Looks like several of the Constants when past as Extra's in the Intent objects do not properly map to the fields in the Add UI in the contacts app. Specifically the ones I am having issues with are: COMPANY JOB_TITLE do not seem to map to the Organization fields on the Add UI, and NAME seems to put the data into First Name field and leaves Family Name blank on the Add UI. I tried searching for a bug reporting mechanism for Android O/S, but didn't have much luck. Can someone point me at the bug repository? I can provide sample code that demonstrates the bug. Thanks, Jeff -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Jeff Sharkey jshar...@android.com -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: [Android 2.0] Contacts FAQ?
15) What is the best way to write the code so in case the API Level is below 5, some of the contacts actions can still be done correctly. Here's an excellent example that uses new ContactsContact APIs when available, or otherwise falls back to the original API: http://code.google.com/p/android-business-card/ -- Jeff Sharkey jshar...@android.com -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: [Android 2.0] Contacts FAQ?
4) What sort of identifier should I represent a contact with in my local data, so I can later get their most-current data? Use lookup-style Uris, as they are designed to help with fuzzy resolution when the contact changes, or is split/joined by the user. Contacts.getLookupUri() and Data.getContactLookupUri() can help you build these lookup Uris from columns when you already know them, or from normal ContentUris.withAppendedId()-style Uris. 6) How do I add a contact to the address book from within an app? One of the easiest ways is to use Intents.Insert, since it doesn't require adding the WRITE_CONTACTS permission to your app: http://d.android.com/reference/android/provider/ContactsContract.Intents.Insert.html 7) How do I add custom data to a contact? Pick a well-scoped MIME-type and just start using it as Data.MIMETYPE when inserting custom Data rows. For example, a row describing a VoIP profile might use something like vnd.android.cursor.item/vnd.com.example.voip.profile. 9) How do I /get/ the nifty status messages and the source for them (a'la 'Away for lunch' on 'Google Talk,' or 'eating a pie!' on 'Facebook'), so I can display them alongside a contact in my own app? (Alternatively, some ask how they can set the nifty status messages and have them appear in the QuickContact bar or in other apps.) Status messages like that can be read through StatusUpdates, and each row is strongly tied to a Data row. When status information is displayed across the system, there is logic that picks the best update based on timestamp. http://d.android.com/reference/android/provider/ContactsContract.StatusUpdates.html To add StatusUpdates you should attach them to a specific RawContact owned by your application. (This allows users to split and join the RawContact from your service to the correct person in their address book.) 10) How do I add an action to the QuickContact bar for a contact? This is partially covered in this thread: http://groups.google.com/group/android-developers/browse_thread/thread/fe814aa9149da1f0/ When Quick Contact encounters a custom Data row, it follows that row back to the owning sync adapter (through ACCOUNT_NAME and _TYPE) to look for XML metadata that describes how to render the row, both as a list item when viewing the contact, and as a Quick Contact icon. The Quick Contact case also performs PackageManager queries to find apps that support ACTION_VIEW on the custom MIME-type defined for that row, which means you'll need to add an intent-filter. 13) How do I add a contact to a group? 14) How do I remove a contact from a group? Similar to the original Contacts API, RawContacts can contain Data rows that indicate GroupMembership. -- Jeff Sharkey jshar...@android.com -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: My appwidget broken Donut when keyboard slide out/in
TextView.onSaveInstanceState() saves details about the TextView into a Bundle that is passed between the two Launcher instances when orientation is changed. By default, those values are keyed off View.getId(). This means if your id's collide with those of another widget, your views may overwrite the state of someone else widget. When restoring the state, that ClassCastException is triggered if it tries restoring the incorrect type of state. (For example, the state from a ImageView applied to a TextView.) -- Jeff Sharkey jshar...@android.com On Fri, Nov 6, 2009 at 10:55 PM, NewPa shiji...@gmail.com wrote: Hi Jeff, I add setting android:saveEnabled=false for all the views in the widget, then widget works well. Thanks for your kindly help. But I don't know why this setting can fix the problem, could you please explain to me? On Nov 3, 6:01 am, Jeff Sharkey jshar...@android.com wrote: For the views that have ids, try setting android:saveEnabled=false so that they don't bundle up their state. j On Sat, Oct 31, 2009 at 8:00 PM, NewPa shiji...@gmail.com wrote: Hi String, I use static var, i will test it. Hi Jeff, Here is my layout file content. it seems will cause confliction with others: Thanks for your kindly help. ?xml version=1.0 encoding=UTF-8? LinearLayout android:id=@+id/LinearLayout01 android:layout_width=72dp android:layout_height=72dp android:background=@drawable/bg android:orientation=vertical android:paddingTop=3dp xmlns:android=http://schemas.android.com/apk/res/android; TextView android:text=TextView01 android:layout_width=wrap_content android:textStyle=bold android:layout_height=14sp android:id=@+id/TVWeeks android:textSize=12sp android:paddingLeft=8dp android:textColor=#00 /TextView ImageView android:id=@+id/ImageView01 android:layout_width=65sp android:src=@drawable/line android:paddingLeft=5dp android:layout_height=2sp /ImageView TextView android:text=TextView01 android:paddingLeft=8dp android:textSize=12sp android:layout_width=wrap_content android:textColor=#00 android:layout_height=14sp android:id=@+id/TVHeight /TextView TextView android:text=TextView01 android:textSize=12sp android:paddingLeft=8dp android:layout_width=wrap_content android:textColor=#00 android:layout_height=16sp android:id=@+id/TVWeight /TextView ImageView android:id=@+id/ImageView02 android:layout_width=65sp android:src=@drawable/line android:paddingLeft=5dp android:layout_height=2sp /ImageView TextView android:text=TextView01 android:textColor=#00 android:textSize=12sp android:paddingLeft=8dp android:layout_width=wrap_content android:layout_height=16sp android:id=@+id/TVMomWeiAdded /TextView /LinearLayout On Oct 31, 4:13 am, Jeff Sharkey jshar...@android.com wrote: There can be issues if the android:id's in your layouts conflict with other widgets. This was fixed in Eclair by having Launcher create separate SparseArray jails for each widget to store their state into. It's change 09ddc08b... to be specific. Could you post your layout file, or describe how you're allocating ids? j On Thu, Oct 29, 2009 at 12:25 AM, String sterling.ud...@googlemail.com wrote: On Oct 29, 6:51 am, Eong eong.c...@gmail.com wrote: Yeap. My users reported this to me today. The OTA release has the same bug. They should push a fixed update right now. FWIW, I'm not convinced it's a bug in Donut. I'm not seeing the same issue in my widgets, and I do plenty in onUpdate. If you genuinely think it's a platform bug, produce a minimal test case and write it up, please. I'm assuming you're aware that keyboard open/close on an HTC Dream destroys and recreates the widget instance, so if (for example) you're referencing any static vars in your code, those will no longer exist. I'm also assuming that you're sending a complete set of views to the RemoteViews object every time, or you probably would have had trouble before now. But you might check those things. :^) String -- Jeff Sharkey jshar...@android.com -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Potential bug in the implementation of AppWidgets
There is a known issue where the class loader won't know about MapActivity from the uses-library tag in the case you described. Search this group for more details and possible workarounds. j On Tue, Nov 10, 2009 at 3:12 PM, Himanshu its.himan...@gmail.com wrote: Hi We have discovered a potential bug in the implementation of AppWidgets. Here is a simple reproducer. Attached is the code for an application containing a TestActivity and a TestWidget. TestActivity extends MapActivity and TestWidget is a simple widget provider which updates a TextView every 2 seconds. Now if the TestActivity is launched with no instance of TestWidget running, it works just fine. But if the TestActivity is launched after placing the TestWidget on the home, it results in ClassNotFoundException. Here is what we get: I/ActivityManager( 584): Starting activity: Intent { action=android.intent.action.MAIN categories= {android.intent.category.LAUNCHER} flags=0x1020 comp= {com.example.test/com.example.test.TestActivity} } W/dalvikvm( 1441): Unable to resolve superclass of Lcom/example/test/ TestActivity; (15) W/dalvikvm( 1441): Link of class 'Lcom/example/test/TestActivity;' failed D/AndroidRuntime( 1441): Shutting down VM W/dalvikvm( 1441): threadid=3: thread exiting with uncaught exception (group=0x4000fe70) E/AndroidRuntime( 1441): Uncaught handler: thread main exiting due to uncaught exception E/AndroidRuntime( 1441): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.test/ com.example.test.TestActivity}: java.lang.ClassNotFoundException: com.example.test.TestActivity in loader dalvik.system.pathclassloa...@49a52110 E/AndroidRuntime( 1441): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java: 2194) E/AndroidRuntime( 1441): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java: 2284) E/AndroidRuntime( 1441): at android.app.ActivityThread.access$1800 (ActivityThread.java:112) E/AndroidRuntime( 1441): at android.app.ActivityThread $H.handleMessage(ActivityThread.java:1692) E/AndroidRuntime( 1441): at android.os.Handler.dispatchMessage (Handler.java:99) E/AndroidRuntime( 1441): at android.os.Looper.loop(Looper.java: 123) E/AndroidRuntime( 1441): at android.app.ActivityThread.main (ActivityThread.java:3948) E/AndroidRuntime( 1441): at java.lang.reflect.Method.invokeNative (Native Method) E/AndroidRuntime( 1441): at java.lang.reflect.Method.invoke (Method.java:521) E/AndroidRuntime( 1441): at com.android.internal.os.ZygoteInit $MethodAndArgsCaller.run(ZygoteInit.java:782) E/AndroidRuntime( 1441): at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:540) E/AndroidRuntime( 1441): at dalvik.system.NativeStart.main(Native Method) E/AndroidRuntime( 1441): Caused by: java.lang.ClassNotFoundException: com.example.test.TestActivity in loader dalvik.system.pathclassloa...@49a52110 E/AndroidRuntime( 1441): at dalvik.system.PathClassLoader.findClass (PathClassLoader.java:243) E/AndroidRuntime( 1441): at java.lang.ClassLoader.loadClass (ClassLoader.java:573) E/AndroidRuntime( 1441): at java.lang.ClassLoader.loadClass (ClassLoader.java:532) E/AndroidRuntime( 1441): at android.app.Instrumentation.newActivity (Instrumentation.java:1097) E/AndroidRuntime( 1441): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java: 2186) E/AndroidRuntime( 1441): ... 11 more So it seems we have an inconsistency in the way the class loader works for the same apk. WORKS - Launch the application by itself, without invoking the Widget. DOES NOT WORK - Create a Widget on the Home screen and then launch the application from the launcher. The source code for this application (http://www.yousendit.com/ download/TzY3ZGVhZy96NE4zZUE9PQ) has been attached. Hope someone from the Android team can shed light on this behavior. BTW, this error is seen on the 1.5r3 SDK. Not sure if this has been addressed in 1.6 and 2.0 SDKs.. Thanks, Himanshu. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Jeff Sharkey jshar...@android.com -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: Widget Path
If you're talking about creating RemoteViews for AppWidgets, you're probably looking for Context.getPackageName(). j On Wed, Nov 11, 2009 at 8:11 PM, GPU gopuraj...@gmail.com wrote: Is it possible to find out the view is from widget or from normal application ? On Nov 12, 8:34 am, GPU gopuraj...@gmail.com wrote: Hi , Is widget views are handled by some system services ? not getting the getContext().getApplicationContext().getPackageCodePath () On Nov 11, 6:36 pm, GPU gopuraj...@gmail.com wrote: Hi , From View object how to get the application code path for WIdgets By using the getContext().getApplicationContext().getPackageCodePath (); i am able to get the apk path Its giving the path like data/app/appname.apk but for widget i am not getting the path Is widget views are handled by some system services ? -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Jeff Sharkey jshar...@android.com -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Read Phone Contact in Vcard Format in Android 2.0
If you add an intent-filter for the ACTION_SEND Intent with the text/x-vcard MIME-type, your app will appear in the Menu Share list when viewing a contact. Then you can use ContentResolver.openAssetFileDescriptor() on the getData() Uri provided through that Intent to open and read that contact pre-formatted as a vCard. :) j On Fri, Nov 6, 2009 at 4:12 AM, Safy sarfarazmad...@gmail.com wrote: Hi, How can I read all the contacts from Phone book and covert it in VCard format in Android OS 2.0 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 -- Jeff Sharkey jshar...@android.com -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] How to get all contact's name phone number, email for 2.0
Could you paste the exact query() that is returning empty for you? Since all data is now stored in a single table you should be able to query on Data.CONTENT_URI and filter by Data.MIMETYPE to match the two types you're looking for. j On Sun, Nov 8, 2009 at 7:52 PM, Henry hongpingli...@gmail.com wrote: For android 2.0, how to get a list of all contact's phone number and email? I have an app which works fine for 1.6. Now it is broken for 2.0 Droid. If you could point me an example to get all contact info, I really appreciate it. Previously, I used People.Contect_URI. now it is deprecated and return me nothing. I went through samples but failed to find how to do it in 2.0. Thanks in advance. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Jeff Sharkey jshar...@android.com -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Trap in TabHost when AsyncTask delays setContentView at activity startup
Instead of delaying the setContentView() call, can you inflate that layout and set its visibility to View.GONE temporarily until the actual content arrives? j On Tue, Nov 3, 2009 at 8:52 PM, Lee Laborczfalvi labor...@gmail.com wrote: I've got a tab host activity started from a home screen shortcut. When my application starts it downloads information from a server using an AsyncTask. In the onPostExecute method of the AsyncTask I call setContentView to display the TabHost. When I start the homescreen shortcut by tapping on the shortcut using my finger everything works as expected, I download the information from the server and display the TabHost with the information in the tabs. However starting the application by navigating to the shortcut with the mouse wheel and then clicking on the shortcut with the mouse wheel leads to a trap in the framework code as soon as my application starts. The stack trace is below: 11-04 15:45:40.113: ERROR/AndroidRuntime(3360): Uncaught handler: thread main exiting due to uncaught exception 11-04 15:45:40.213: ERROR/AndroidRuntime(3360): java.lang.NullPointerException 11-04 15:45:40.213: ERROR/AndroidRuntime(3360): at android.widget.TabHost.onTouchModeChanged(TabHost.java:179) 11-04 15:45:40.213: ERROR/AndroidRuntime(3360): at android.view.ViewTreeObserver.dispatchOnTouchModeChanged(ViewTreeObserver.java:591) 11-04 15:45:40.213: ERROR/AndroidRuntime(3360): at android.view.ViewRoot.ensureTouchModeLocally(ViewRoot.java:1877) 11-04 15:45:40.213: ERROR/AndroidRuntime(3360): at android.view.ViewRoot.performTraversals(ViewRoot.java:715) 11-04 15:45:40.213: ERROR/AndroidRuntime(3360): at android.view.ViewRoot.handleMessage(ViewRoot.java:1613) 11-04 15:45:40.213: ERROR/AndroidRuntime(3360): at android.os.Handler.dispatchMessage(Handler.java:99) 11-04 15:45:40.213: ERROR/AndroidRuntime(3360): at android.os.Looper.loop(Looper.java:123) 11-04 15:45:40.213: ERROR/AndroidRuntime(3360): at android.app.ActivityThread.main(ActivityThread.java:4203) 11-04 15:45:40.213: ERROR/AndroidRuntime(3360): at java.lang.reflect.Method.invokeNative(Native Method) 11-04 15:45:40.213: ERROR/AndroidRuntime(3360): at java.lang.reflect.Method.invoke(Method.java:521) 11-04 15:45:40.213: ERROR/AndroidRuntime(3360): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791) 11-04 15:45:40.213: ERROR/AndroidRuntime(3360): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549) 11-04 15:45:40.213: ERROR/AndroidRuntime(3360): at dalvik.system.NativeStart.main(Native Method) Looking at the code for the TabHost class I see the following code at the point where the trap occurs public void onTouchModeChanged(boolean isInTouchMode) { if (!isInTouchMode) { // leaving touch mode.. if nothing has focus, let's give it to // the indicator of the current tab TRAP ON THIS LINE if (!mCurrentView.hasFocus() || mCurrentView.isFocused()) { mTabWidget.getChildTabViewAt(mCurrentTab).requestFocus(); } } } This looks like a simple fix since mCurrentView is null at the time that this method is called - can this issue be addressed? Does anyone know of any workarounds? Thanks Lee -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Jeff Sharkey jshar...@android.com -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: Regarding the database schema of Android native database
If you're looking to interact with the built-in Contacts or MediaStore databases, you should interact through the ContentProvider abstraction layer. The underlying database schema can change, but these public APIs will continue working across releases: http://d.android.com/guide/topics/providers/content-providers.html http://d.android.com/reference/android/provider/ContactsContract.html http://d.android.com/reference/android/provider/MediaStore.html j On Tue, Nov 3, 2009 at 6:42 PM, PJ pjbar...@gmail.com wrote: If there isn't any documentation, you could always get the schema directly from the source. Read the section Examining sqlite3 Databases from a Remote Shell from the Dev Guide: http://developer.android.com/guide/developing/tools/adb.html#sqlite This describes how to view databases for an application, but this technique also works for examining the system's databases, too. You just need to know where they are, e.g. try: # sqlite3 /data/system/ accounts.db Hope this helps! -- PJ On Nov 1, 9:30 pm, richard xiaofeng.richardwei2...@gmail.com wrote: Hello all, I want to build my own cloned databases of all or some of the Android native databases like Contacts, Calllogs, Mediastore, Settings, etc. I want to know wheher it is possible and How I can know the database schemas of these databases? Is there any documentation on this? Thank you very much. regards Xiaofeng -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Jeff Sharkey jshar...@android.com -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: My appwidget broken Donut when keyboard slide out/in
For the views that have ids, try setting android:saveEnabled=false so that they don't bundle up their state. j On Sat, Oct 31, 2009 at 8:00 PM, NewPa shiji...@gmail.com wrote: Hi String, I use static var, i will test it. Hi Jeff, Here is my layout file content. it seems will cause confliction with others: Thanks for your kindly help. ?xml version=1.0 encoding=UTF-8? LinearLayout android:id=@+id/LinearLayout01 android:layout_width=72dp android:layout_height=72dp android:background=@drawable/bg android:orientation=vertical android:paddingTop=3dp xmlns:android=http://schemas.android.com/apk/res/android; TextView android:text=TextView01 android:layout_width=wrap_content android:textStyle=bold android:layout_height=14sp android:id=@+id/TVWeeks android:textSize=12sp android:paddingLeft=8dp android:textColor=#00 /TextView ImageView android:id=@+id/ImageView01 android:layout_width=65sp android:src=@drawable/line android:paddingLeft=5dp android:layout_height=2sp /ImageView TextView android:text=TextView01 android:paddingLeft=8dp android:textSize=12sp android:layout_width=wrap_content android:textColor=#00 android:layout_height=14sp android:id=@+id/TVHeight /TextView TextView android:text=TextView01 android:textSize=12sp android:paddingLeft=8dp android:layout_width=wrap_content android:textColor=#00 android:layout_height=16sp android:id=@+id/TVWeight /TextView ImageView android:id=@+id/ImageView02 android:layout_width=65sp android:src=@drawable/line android:paddingLeft=5dp android:layout_height=2sp /ImageView TextView android:text=TextView01 android:textColor=#00 android:textSize=12sp android:paddingLeft=8dp android:layout_width=wrap_content android:layout_height=16sp android:id=@+id/TVMomWeiAdded /TextView /LinearLayout On Oct 31, 4:13 am, Jeff Sharkey jshar...@android.com wrote: There can be issues if the android:id's in your layouts conflict with other widgets. This was fixed in Eclair by having Launcher create separate SparseArray jails for each widget to store their state into. It's change 09ddc08b... to be specific. Could you post your layout file, or describe how you're allocating ids? j On Thu, Oct 29, 2009 at 12:25 AM, String sterling.ud...@googlemail.com wrote: On Oct 29, 6:51 am, Eong eong.c...@gmail.com wrote: Yeap. My users reported this to me today. The OTA release has the same bug. They should push a fixed update right now. FWIW, I'm not convinced it's a bug in Donut. I'm not seeing the same issue in my widgets, and I do plenty in onUpdate. If you genuinely think it's a platform bug, produce a minimal test case and write it up, please. I'm assuming you're aware that keyboard open/close on an HTC Dream destroys and recreates the widget instance, so if (for example) you're referencing any static vars in your code, those will no longer exist. I'm also assuming that you're sending a complete set of views to the RemoteViews object every time, or you probably would have had trouble before now. But you might check those things. :^) String -- Jeff Sharkey jshar...@android.com -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Jeff Sharkey jshar...@android.com -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] skype ,gtalk intent
You should really avoid specifying direct ComponentNames, as they can change in the future, or the user may install a different client to handle those protocols. Here's a quick example of how to launch a chat with someone using AIM when a client is installed: Uri imUri = new Uri.Builder().scheme(imto).authority(aim).appendPath(u...@example.com).build(); Intent intent = new Intent(Intent.ACTION_SENDTO, imUri); You can substitute gtalk or msn for launching other clients. j On Sun, Nov 1, 2009 at 8:53 PM, jaimin mehta jaimin.r.me...@gmail.com wrote: hi. i have some problem regarding skype and gtalk intent i have application in which i display a list of online skype,gtalk contacts. Now when ever i click my online skype or gtalk contacts it should display a default skype or gtalk chat window with that Contacts So basically i want to know is there any intent to call Chat screen of Skype and Gtalk online Contacts Right now i have intent to call skype and gtalk default application login screen GTALK - Intent i = new Intent(Intent.ACTION_MAIN); i.setComponent(new ComponentName(com.google.android.talk, com.google.android.talk.SigningInActivity)); startActivity(i); SKYPE - Intent i = new Intent(Intent.ACTION_MAIN); i.setComponent( new ComponentName( com.skype.android.lite, com.skype.android.lite.SkypeActivity ) ); startActivity(i); but i want to display chat screen of both Skype and Gtalk can any body help me in my issue plz its urgent thanks jaimin. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Jeff Sharkey jshar...@android.com -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Quick Contacts popup
The easiest way is using the new QuickContactBadge widget. You can add it to your layout, and there are helper methods to bind it using phone, email, or a normal Uri. http://d.android.com/reference/android/widget/QuickContactBadge.html This control will automatically give you the frame around the photo, and launch the track when clicked. If you're looking to launch the Quick Contacts popup manually yourself, you can use the API directly: http://d.android.com/reference/android/provider/ContactsContract.QuickContact.html Just call QuickContact.showQuickContact() and pass in a target Rect area in screen coordinates. The Quick Contact window adjusts and points towards that target area. j On Thu, Oct 29, 2009 at 5:13 AM, Fedor Vlasov the...@gmail.com wrote: I can see a new Quick Contacts popup in Android 2.0. How can I use it in my application? Can't find any samples. Thanks! -- Jeff Sharkey jshar...@android.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: [Android 2.0] Accessing contact's phone numbers
Could you post the exact Uri you're passing to query()? As the javadoc describes, you need to append a filter string to the CONTENT_FILTER_URI so it knows what to filter on. Uri lookupUri = Uri.withAppendedPath(PhoneLookup.CONTENT_URI, phoneNumber); Also, you might be able to skip your second step, since you can directly ask for the PhoneLookup.DISPLAY_NAME column in the projection. j On Fri, Oct 30, 2009 at 8:05 AM, agirardello andrea.girarde...@gmail.com wrote: Dear all, I'm trying to adapt my application (Personalytics) for the brand new Android 2.0, however I'm facing an issue while accessing contacts' phone numbers... What I need to do is to retrieve the name associated to a stored contact based on his/her phone number. At present I'm doing this in two steps: 1) from a phone number I get the corresponding ID of the stored contact (if present) 2) I retrieve the contact's name based on that ID I managed to use the correct CONTENT_URI for reading contacts by using reflection to be fully compatible with Android 2.0 (ContactsContract.Contacts.CONTENT_URI) and the previous versions (People.CONTENT_URI). Now I'm trying to do the same for Phones.CONTENT_URI (Android = 1.6) and ContactsContract.PhoneLookup.CONTENT_FILTER_URI (Android = 2.0) which is needed by step 2) mentioned above. But as soon as I try to get a contentResolver by using ContactsContract.PhoneLookup.CONTENT_FILTER_URI I get the following exception: java.lang.IllegalArgumentException: Unknown URL content://com.android.contacts/phone_lookup This looks really strange to me, since it should be correct (it is part of the official API)! Moreover, I tried to look at the API Demos project, in particular to the classes: com.example.android.apis.view.List2 com.example.android.apis.view.List3 which are still using the deprecated People.CONTENT_URI and Phones.CONTENT_URI and thus no data (i.e. contacts) is loaded (of course I have sample contacts in the emulator). - Do you have any suggestion to solve this problem? - Or is there another approach I can use to get the name of a contact based on one of his/her numbers? (This must work on all versions of Android) Thank you ;-) Andrea -- Jeff Sharkey jshar...@android.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: setResult() for AppWidget
It sounds like the ACTION_VIEW might be launched as startActivity() instead of startActivityForResult(), which means the result is being dropped on the path back to Launcher. The forecast widget example interacts with the system search dialog, and uses singleTop and onNewIntent() to catch searches and still return correctly: http://code.google.com/p/android-sky/source/browse/trunk/Sky/AndroidManifest.xml#57 http://code.google.com/p/android-sky/source/browse/trunk/Sky/src/org/jsharkey/sky/ConfigureActivity.java#287 j On Tue, Oct 27, 2009 at 2:25 AM, Ollie Weng ollie.w...@gmail.com wrote: Hi, (resend with heading title) I'm making a appwidget, and hope to use search UI to let user filter some infomation while setup widget on receiving APPWIDGET_CONFIGURE. My current problem is APPWIDGET_CONFIGURE intent depends on setResult() to decide if adding widget successful. However, using search UI cause activity reentry to fail to setResult() to original caller. Below codes show how and where my code to setResult(), first when user try to add widget in home screen, we launch the search UI on APPWIDGET_CONFIGURE intent, and after search UI return result with Intent.ACTION_VIEW to same activity, it failed to setResult() to tell caller widget is configured. But in onUserInteraction() setResult() work, but it's just not correct timing. Tried extend finish() but still in vain. Any suggest is appreciated! public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Intent launchIntent = getIntent(); Bundle extras = launchIntent.getExtras(); if(Intent.ACTION_VIEW.equals(launchIntent.getAction())) { // this is where to handle search result indent, but failed to set result if (appWidgetId != AppWidgetManager.INVALID_APPWIDGET_ID) { Intent intent = new Intent(); intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId); setResult(RESULT_OK, intent); } } else if(Intent.ACTION_SEARCH.equals(launchIntent.getAction())) { String query = launchIntent.getStringExtra(SearchManager.QUERY); if (appWidgetId != AppWidgetManager.INVALID_APPWIDGET_ID) { Intent intent = new Intent(); intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId); setResult(RESULT_OK, intent); } } else { // deal android.appwidget.action.APPWIDGET_CONFIGURE here onSearchRequested(); } } TIA, Ollie -- Jeff Sharkey jshar...@android.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: My appwidget broken Donut when keyboard slide out/in
There can be issues if the android:id's in your layouts conflict with other widgets. This was fixed in Eclair by having Launcher create separate SparseArray jails for each widget to store their state into. It's change 09ddc08b... to be specific. Could you post your layout file, or describe how you're allocating ids? j On Thu, Oct 29, 2009 at 12:25 AM, String sterling.ud...@googlemail.com wrote: On Oct 29, 6:51 am, Eong eong.c...@gmail.com wrote: Yeap. My users reported this to me today. The OTA release has the same bug. They should push a fixed update right now. FWIW, I'm not convinced it's a bug in Donut. I'm not seeing the same issue in my widgets, and I do plenty in onUpdate. If you genuinely think it's a platform bug, produce a minimal test case and write it up, please. I'm assuming you're aware that keyboard open/close on an HTC Dream destroys and recreates the widget instance, so if (for example) you're referencing any static vars in your code, those will no longer exist. I'm also assuming that you're sending a complete set of views to the RemoteViews object every time, or you probably would have had trouble before now. But you might check those things. :^) String -- Jeff Sharkey jshar...@android.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: [Android 2.0] Accessing contact's phone numbers
The original, public android.provider.Contacts APIs that has shipped since Android 1.0 are still very much supported, but are now marked as deprecated. There are additional features (like multiple accounts) that will require upgrading to the new android.provider.ContactsContract APIs to access. For example, only data from the primary account is exposed through the now-legacy android.provider.Contacts APIs. j On Fri, Oct 30, 2009 at 11:40 AM, nEx.Software email.nex.softw...@gmail.com wrote: Hold up... I'm confused. Are you saying that Contacts portion of the SDK is deprecated? Whatever happened to stick to the SDK because those are stable apis that won't break in future versions? Very disappointing... On Oct 30, 11:12 am, Jeff Sharkey jshar...@android.com wrote: Could you post the exact Uri you're passing to query()? As the javadoc describes, you need to append a filter string to the CONTENT_FILTER_URI so it knows what to filter on. Uri lookupUri = Uri.withAppendedPath(PhoneLookup.CONTENT_URI, phoneNumber); Also, you might be able to skip your second step, since you can directly ask for the PhoneLookup.DISPLAY_NAME column in the projection. j On Fri, Oct 30, 2009 at 8:05 AM, agirardello andrea.girarde...@gmail.com wrote: Dear all, I'm trying to adapt my application (Personalytics) for the brand new Android 2.0, however I'm facing an issue while accessing contacts' phone numbers... What I need to do is to retrieve the name associated to a stored contact based on his/her phone number. At present I'm doing this in two steps: 1) from a phone number I get the corresponding ID of the stored contact (if present) 2) I retrieve the contact's name based on that ID I managed to use the correct CONTENT_URI for reading contacts by using reflection to be fully compatible with Android 2.0 (ContactsContract.Contacts.CONTENT_URI) and the previous versions (People.CONTENT_URI). Now I'm trying to do the same for Phones.CONTENT_URI (Android = 1.6) and ContactsContract.PhoneLookup.CONTENT_FILTER_URI (Android = 2.0) which is needed by step 2) mentioned above. But as soon as I try to get a contentResolver by using ContactsContract.PhoneLookup.CONTENT_FILTER_URI I get the following exception: java.lang.IllegalArgumentException: Unknown URL content://com.android.contacts/phone_lookup This looks really strange to me, since it should be correct (it is part of the official API)! Moreover, I tried to look at the API Demos project, in particular to the classes: com.example.android.apis.view.List2 com.example.android.apis.view.List3 which are still using the deprecated People.CONTENT_URI and Phones.CONTENT_URI and thus no data (i.e. contacts) is loaded (of course I have sample contacts in the emulator). - Do you have any suggestion to solve this problem? - Or is there another approach I can use to get the name of a contact based on one of his/her numbers? (This must work on all versions of Android) Thank you ;-) Andrea -- Jeff Sharkey jshar...@android.com -- Jeff Sharkey jshar...@android.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Contacts extension - Further developments ?
Earlier today we released the Android 2.0 SDK, which has a much-improved contacts API: http://d.android.com/reference/android/provider/ContactsContract.html Each Data row has 15 fields that can be used to store generic data, and the Data.MIMETYPE column can be used to identify the contents of a given row. If you're storing contact data, you should definitely try to leverage the existing CommonDataKinds, since most UI will understand how to render them. If you need to store custom data, just allocate a unique MIME-type. For example, something like vnd.edu.example.cursor.item/contact_class would work. j On Fri, Oct 9, 2009 at 10:09 AM, Sarab sarab.n...@gmail.com wrote: Dear Fellow Developers, I would like to request your comments on : How to add new field(s) in to android's contacts.db database ? After going through existing discussion on this topic; I could find that the deveopers recommend creating a new database for the new fields and simultaneously provide a custom contacts content provider. This custom content provider will join SQl queries from the new databse and contacts.db.The id field being the link between the contacts database and new databse.Pls see the link. http://groups.google.com/group/android-developers/browse_thread/thread/19de2b2ac8640b4c/9e4d1f9723831875?lnk=gstq=contacts+extension#9e4d1f9723831875 So I have following queries : 1. Is any simpler way out for this problem. Since the thread is quite old; I was wondering whether google provided any new API , interface to sort this problem? 2. Can someone explain me the purpose of Contacts.Extensions and Contacts.People.Extensions. I guess these are for extending contact fields but not much information is available online. 3. If the above classes serves the purpose of extending the contacts database (i.e. add field columns) , then Do i need to modify standard contacts content provider for retrieving my custom field's data? Many Thanks -- Jeff Sharkey jshar...@android.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Need a Prescription for adding a couple attributes to the Contact
Earlier today we released the Android 2.0 SDK, which has a much-improved contacts API: http://d.android.com/reference/android/provider/ContactsContract.html You can now insert custom Data rows under a RawContact to store custom fields. You should try leveraging the existing CommonDataKinds first, since most UI will understand how to render them. If you end up needing a custom row, pick a unique Data.MIMETYPE for your data, for example something like vnd.edu.example.cursor.item/contact_class would work. j On Mon, Oct 12, 2009 at 6:55 PM, stanlick stanl...@gmail.com wrote: Can a seasoned droid help me with the steps necessary to add a couple simple attributes to the stock Android Contacts application. Also, in the event the vendor has shipped their own Contacts application, will the same solution apply equally well to those handsets shipped with custom apps? I'm not looking for anyone to supply code; just a design pattern and any caveats I need to be aware of. I am writing an application that requires a couple new properties on the contact. Peace, Scott -- Jeff Sharkey jshar...@android.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Extending contacts
If the VoIP app can complete calls to any normal phone number, it should have an intent-filter for normal tel: style Intents, which allows you to leverage any phone numbers already entered by the user. If the VoIP contact method is instead something like a username, you can insert a custom Data row under a RawContact. http://d.android.com/reference/android/provider/ContactsContract.html For that custom Data row to appear in the Contacts app, you'll need to associate your custom MIME-type with XML that describes how to render the UI. The only current way of doing this is to define a sync adapter service and add meta-data definition inside, something like this: meta-data android:name=android.provider.CONTACTS_STRUCTURE android:resource=@xml/contacts / Then define the XML inside your app: --snip-- ContactsSource xmlns:android=http://schemas.android.com/apk/res/android; ContactsDataKind android:mimeType=vnd.com.example.voip.cursor.item/voip_profile android:icon=@drawable/icon android:summaryColumn=data2 android:detailColumn=data3 / /ContactsSource --snip-- j On Wed, Oct 14, 2009 at 2:01 PM, dreamerns dreame...@gmail.com wrote: I know this question was asked couple of times in this list, but I haven't found any answer in archives, and last time this subject was debated almost a year ago. Does anyone knows is it now possible to somehow extend contacts functionality (for example: add custom field for VoIP phone number in which case user can use it to start custom activity for voip)? What are Contacts.ExtensionsColumns for? Thanks Nikola -- Jeff Sharkey jshar...@android.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: AppWidgetProvider.onUpdate() -- setOnClickPendingIntent
One option is to leverage setData() when building the PendingIntent to include something unique about the button being pressed. j On Wed, Sep 30, 2009 at 2:45 PM, sdphil phil.pellouch...@gmail.com wrote: i have an app widget that has a couple of buttons on it, and in my onUpdate() call, I am hooking up the buttons to do something when you press them -- RemoteViews remoteViews = new RemoteViews(context.getPackageName (), R.layout.appwidget); remoteViews.setOnClickPendingIntent(R.id.Button1, button1PendingIntent); remoteViews.setOnClickPendingIntent(R.id.Button2, button2PendingIntent); The problem is that when I click on button2, it sends the button1 pending intent. i think that's because it's reusing the pending intent. http://groups.google.com/group/android-developers/browse_thread/thread/5605471d73a250ba If the creating application later re-retrieves the same kind of PendingIntent (same operation, same Intent action, data, categories, and components, and same flags), it will receive a PendingIntent representing the same token if that is still valid, and can thus call cancel() to remove it. So then the question is, how do I communicate which button was pressed? tia. -- Jeff Sharkey jshar...@android.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Hi
Nope, APPWIDGET_PICK is the only way to bind widgets. You can insert custom widgets into that list using CUSTOM_INFO and CUSTOM_EXTRAS, but you can't change the layout of that dialog. Also, making a visual list of widgets may not work for widgets with a configuration step, if their initialLayout isn't descriptive. j On Tue, Oct 6, 2009 at 1:20 AM, Jackie onceamo...@gmail.com wrote: I am trying to create a Home application that contains AppWidgets. Can I make a own AppWidgets list layout that includes AppWidgetHostView without APPWIDGET_PICK intent? I mean I wanna make a visual AppWidget list. Actualy I made it, but i couldn't start AppWidget some like Music widget. I think it does not contain a intent. How can I get the AppWidgets intent ? -- Jeff Sharkey jshar...@android.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: updatePeriodMillis not working for widget on 1.6
What is the actual value of updatePeriodMillis in the XML file? It's worth noting that the updatePeriodMillis approach uses AlarmManager.setInexactRepeating(), which can cause variability in update frequencies if bins your update with other alarms. j On Thu, Oct 22, 2009 at 12:10 PM, String sterling.ud...@googlemail.com wrote: I'm aware that the minimum updatePeriodMillis was increased to 30 minutes for Donut, but in my testing, I'm not seeing the APPWIDGET_UPDATE intent come through at all, even after well over 30 minutes has passed. Has anyone else had an issue with this, or any light to shed on the matter? I should mention that all of my testing so far is on 1.6 emulator images; I don't yet have Donut hardware to test on, as my update here in the UK hasn't come through yet. So it's possible this is an emulator issue, but again, any information on that front would be helpful. For reference, my manifest code looks like this: receiver android:name=.MyWidgetProvider android:label=@string/widget_name android:enabled=true meta-data android:name=android.appwidget.provider android:resource=@xml/mywidget / intent-filter action android:name=android.appwidget.action.APPWIDGET_UPDATE / /intent-filter /receiver It's working fine on 1.5 (and has been for months), both on emulator and handset. Thanks, String -- Jeff Sharkey jshar...@android.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: CompareEverywhere
I've been meaning to open-source it, but haven't had the free time to pull together all the loose ends. :) Is there something in particular you're looking to do? j On Tue, Sep 8, 2009 at 12:38 AM, paultwapaultwa2...@gmail.com wrote: hi, Is the project ‘CompareEverywhere’ the OpenSource one? If it is the OpenSource one, where can download it? -- Jeff Sharkey jshar...@android.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: android widgets on WVGA
Launcher uses a specific number of cells, and doesn't allocate more cells when the screen becomes larger: http://android.git.kernel.org/?p=platform/packages/apps/Launcher.git;a=blob;f=res/layout-port/workspace_screen.xml;hb=cupcake In particular, the number of short and long axis are identical so the desktop can be rotated as an entire group without disorienting users. j On Mon, Aug 24, 2009 at 7:05 AM, vishal bhojvishalb...@gmail.com wrote: Hello Everyone, I am trying to run widgets on wvga resolution emulator. But with such a wide screen I thought I could populate more number of widgets but looks like the same number of widgets would fill as in hvga screen. I have set the ro.sf.lcd_density=220; I could layout 3 clocks widgets; When I set ro.sf.lcd_density=160 even then I could just layout 3 clock widgets; All the widgets look fine. I want to know is it possible to configure the screen resolution to load more number of widgets onto the screen by changing. Is it possible that by keeping dpi=160 and wvga I can populate more widget ? I am doing this exercise not from an app developer point of view but from platform point of view. -- with regards vishal -- Jeff Sharkey jshar...@android.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: How put bold to android:textStyle of a TextView from RemoteViews ?
Because this is across RemoteViews not all TextView methods are available. In this case, using a SpannableString to mark a bold region should work, since it's a CharSequence. j On Tue, Aug 18, 2009 at 9:16 AM, Alixalts...@gmail.com wrote: Hello, I have a widget with a TextView. I can change text and color of this TextView like this : remoteViews.setTextViewText(R.id.txt, Sample); remoteViews.setTextColor(R.id.txt, Color.RED); But I need to put this TextView bold conditionnaly... How can I do that ? Thanks in advance... Alix -- Jeff Sharkey jshar...@android.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: AppWidgetHost - what is the hostId for?
The hostId is a number of your choosing that should be internally unique to your app (that is, you don't need to worry about collisions with other apps on the system). It's designed for cases where you want two unique AppWidgetHosts inside of the same application, so the system can optimize and only send updates to actively listening hosts. j On Tue, Aug 18, 2009 at 10:48 AM, Flying Coderav8r.st...@gmail.com wrote: Hi there, I'm developing my own appwidget hoster and am curious about the hostId used in the constructor: AppWidgetHost(Context context, int hostId) The docs don't say anything about it. Can anyone tell me what its used for, and what values are legal? Thanks for the help, Steve P.s. Sorry if this is a duplicate post -- I posted this question earlier, but now I can't find it(!) -- Jeff Sharkey jshar...@android.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Struggling -- SearchSuggestionSampleProvider issues
The installation error (INSTALL_FAILED_CONFLICTING_PROVIDER) told you what was wrong. You gave your provider the authority com.example.android.apis.SuggestionProvider which was already being used by another app on the system. Choose another authority so it doesn't conflict. Usually one that lives inside of your package space works best. j On Sat, Aug 15, 2009 at 6:00 AM, Venkatnit.ve...@gmail.com wrote: Hi Please help me. I am adding search suggestion in my application. When i ran only AoiDemos/searchInvoke application, its worked fine. But when i am added the same code in my application its giving below error when starting application. 009-08-15 13:12:26 - MyApplication] Installing MyApplication.apk... [2009-08-15 13:12:38 - MyApplication] Application already exists. Attempting to re-install instead... [2009-08-15 13:12:54 - MyApplication] Installation error: INSTALL_FAILED_CONFLICTING_PROVIDER [2009-08-15 13:12:54 - MyApplication] Please check logcat output for more details. [2009-08-15 13:12:55 - MyApplication] Launch canceled! When i remove the below code from AndroidManifest.xml, application is lannching fine. provider android:name=.search.SearchSuggestionSampleProvider an.droid:authorities=com.example.android.apis.SuggestionProvider / Can someone please help me how to resolve this issue? Thanks in advance. Thanks Regards Venkat -- Jeff Sharkey jshar...@android.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Limit EditText to alpha-numeric characters
You're probably looking to extend BaseKeyListener or one of its subclasses. This is how the Phone app only allows numbers to be dialed, and also handles translating letters to numbers. Once you've built a listener that works for your needs, assign it using EditText.setKeyListener(). j On Sat, Aug 15, 2009 at 7:06 AM, jgostylojgost...@gmail.com wrote: I have been searching through the InputFilter documentation trying to find a good way to do what I want. I want to create an edittext that only allows alpha-numeric characters. I don't think any of the InputText pre-made filters do this. I was looking at creating my own filter using InputFilter.filter, but the documentation seems a little sparse explaining the method's parameters and what it is looking for. This is probably due to my lack of experience with the topic. Searching the internet, it does not seem like anyone else is trying to do this so maybe I am not even going about this the correct way. Any help would be appreciated. -- Jeff Sharkey jshar...@android.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Adding a new xml attribute in framewrok
It's incompatible from the perspective of the current public APIs. However, if it's a useful change and is integrated into a future platform release, it would eventually live in public.xml. If it's a personal change just for your device, Romain's suggestion is the right place to start. Later, if you think the change would be useful to a wider audience, the android-platform mailing list would be a good place to start a discussion: http://groups.google.com/group/android-platform j On Sat, Aug 15, 2009 at 4:22 PM, Romain Guyromain...@google.com wrote: Do not add it to public.xml, it's an incompatible change. Use com.android.internal.R instead. On Aug 15, 2009 1:51 PM, Jeff Sharkey jshar...@android.com wrote: You also need to assign it a specific value in public.xml, otherwise it remains internal. j On Sat, Aug 15, 2009 at 12:05 AM, GPUgopuraj...@gmail.com wrote: Hi , Can anyone tell ,... Jeff Sharkey jshar...@android.com -- Jeff Sharkey jshar...@android.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: receiver enabled=false , problems after instantiation to set to listen
When building the ComponentName, you need to reference the correct BroadcastReceiver. In your case, it looks like you're enabling org.dadata.demo.Dots, when the receiver is over in the .model. subpackage. You can also create more robust ComponentNames by using the (Context, Class) constructor, instead of relying on strings: new ComponentName(context, DotsReceiver.class); j On Wed, Aug 12, 2009 at 3:08 AM, Jirijiriheitla...@googlemail.com wrote: Hello List, in my manifest I set an custom object Dots that extends a BroadcastReceiver to receive a certain broadcast string. receiver android:name=.model.Dots android:enabled=false intent-filter action android:name=org.dadata.demo.receiverTest / /intent-filter /receiver I dont want Android to instantiate the object for me hence the enable=false. In the Activity a new Dots is created Dots dots = new Dots() How do i now make the Dots start listening to the broadcasting. I tried this, but it doesnt work and it also feels much to complicated.. ComponentName cName = new ComponentName(org.dadata.demo,org.dadata.demo.Dots); PackageManager pm = this.getPackageManager(); pm.setComponentEnabledSetting(cName , PackageManager.COMPONENT_ENABLED_STATE_ENABLED , PackageManager.DONT_KILL_APP); Is there a workable easy way to do this? Thank you, Jiri -- Jeff Sharkey jshar...@android.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: How to make chat window for IM?
If you'll be working with long conversations, you should look at using a ListView to keep scrolling efficient. Also, ListView offers android:transcriptMode, which will can help automatically scroll back to the bottom when new messages arrive. j On Wed, Aug 12, 2009 at 7:28 AM, Gulfamgulfa...@gmail.com wrote: Hi every body, I am working on IM and i want to make Chat Window but i don't know how to start it. Currently I am using EditText field, a text view and a button, after entering text in EditText field on pressing send button i am getting text from EditText filed and appending it to TextView its looking good but there are some problems, and i don't know its right approach or not ? Any one can refer me any tutorial or any useful link regarding this or any other help ?. Thanks in advance. Gulfam Hassan -- Jeff Sharkey jshar...@android.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Updating Views in a ListView when they may have been recycled
One way of doing this would be to convertView.setTag() to a well-known value when binding each child item. Then, when a progress event occurs, use ListView.findViewWithTag() to find the target View, or fail silently if it doesn't exist. Each time a view is recycled, your bind step above would be updating the tag to match the content. j On Wed, Aug 12, 2009 at 2:34 AM, Neilneil.wilkin...@gmx.com wrote: Hi, I've recently got into Android development and am writing a basic podcast app as a learning exercise. I've come up with an issue I can't find a good solution for. Rather than post code (it's getting big!), I'll try and summarise: I have an ExpandableListView showing podcasts and each podcast's episodes in a simple two-level tree. The podcasts are downloaded in a Service, and this Service 'sends' messages by using an interface registered by the main Activity. This interface then uses a handler to update the UI. The child views in the ExpandableListView are LinearLayouts with one TextView and two ViewStubs, one for showing an image and one for showing a horizontal ProgressBar. These layouts are created if needed in my extended BaseExpandableListAdapter's getChildView, or reused by using the convertView supplied. This all works fine and I'm happy with the overall model, except that I can't figure out how to update a download's ProgressBar efficiently when the Activity receives a callback from the Service. How do I get a reference to the correct View to set its progress? I've tried keeping a cached HashMap to track which episode currently has which View instance, but this didn't work due to me recycling the Views via convertView - I found that when more than one download is active the two bars can swap values back and forth. Any help would be appreciated. Thanks, Neil -- Jeff Sharkey jshar...@android.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Crashes with no usefull stacktrace
[heap] 08-12 23:07:41.971: INFO/DEBUG(32): 100ffca4 afe39dd0 08-12 23:07:41.971: INFO/DEBUG(32): 100ffca8 a000 [heap] 08-12 23:07:41.981: INFO/DEBUG(32): 100ffcac 08-12 23:07:41.981: INFO/DEBUG(32): 100ffcb0 0024de0c [heap] 08-12 23:07:41.981: INFO/DEBUG(32): 100ffcb4 0024de08 [heap] 08-12 23:07:41.981: INFO/DEBUG(32): 100ffcb8 4100afb8 08-12 23:07:42.002: INFO/DEBUG(32): 100ffcbc ad53eacb /system/lib/libicuuc.so 08-12 23:07:42.002: INFO/DEBUG(32): #01 100ffcc0 0024de0c [heap] 08-12 23:07:42.002: INFO/DEBUG(32): 100ffcc4 ad5384a1 /system/lib/libicuuc.so -- Jeff Sharkey jshar...@android.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: ambiguous column name: _id when querying the contacts list
Ouch, there isn't a good solution in the current SDK. In Eclair we're restructuring this code, which would break the people._id solution you mentioned. :( And you're right, there otherwise isn't a good way of selecting multiple _ids. Ironically, the same change that breaks the people._id approach also fixes the _id ambiguity problem, lol. I'm afraid the answer is to use people._id for now, and update it when the Eclair SDK is released. j On Wed, Aug 12, 2009 at 5:22 PM, whaledawgwhaled...@gmail.com wrote: So I have a bit of code that takes a list of contact ID's that have been selected and return a cursor with other data I might be interested in for those ID's protected Cursor collectUserData(ArrayListInteger friends) { String[] PROJECTION=new String[] { Contacts.People._ID, Contacts.PeopleColumns.DISPLAY_NAME }; String WHERE = new String(); WHERE += Contacts.People._ID; WHERE += IN (; for(int i = 0; i friends.size(); i++) { WHERE += friends.get(i).toString(); if(i friends.size() - 1) { WHERE += ,; } else { WHERE += ); } } return managedQuery(Contacts.People.CONTENT_URI, PROJECTION, WHERE, null, Contacts.People.DEFAULT_SORT_ORDER); } And this code gives me the following error: # 08-12 15:49:53.013: ERROR/DatabaseUtils(102): Writing exception to parcel # 08-12 15:49:53.013: ERROR/DatabaseUtils(102): android.database.sqlite.SQLiteException: ambiguous column name: _id: , while compiling: SELECT people._id AS _id, (CASE WHEN (name IS NOT NULL AND name != '') THEN name ELSE (CASE WHEN primary_organization is NOT NULL THEN (SELECT company FROM organizations WHERE organizations._id = primary_organization) ELSE (CASE WHEN primary_phone IS NOT NULL THEN (SELECT number FROM phones WHERE phones._id = primary_phone) ELSE (CASE WHEN primary_email IS NOT NULL THEN (SELECT data FROM contact_methods WHERE contact_methods._id = primary_email) ELSE null END) END) END) END) AS display_name FROM people LEFT OUTER JOIN phones ON people.primary_phone=phones._id LEFT OUTER JOIN presence ON (presence.person=people._id) WHERE (_id IN (20)) ORDER BY name ASC I can get rid of the error if I change the WHERE clause to start like this instead: String WHERE = new String(); WHERE += people._id; But this seems a little brittle. How should I be doing this query? -- Jeff Sharkey jshar...@android.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: YAFFS2 filesystem in Android linux?
The internal partitions on current Android devices are already using YAFFS2: http://android.git.kernel.org/?p=platform/external/yaffs2.git;a=summary j On Wed, Aug 12, 2009 at 8:11 PM, Hugoluster.w...@gmail.com wrote: Hi all, I am a newbie to Android development. The robustness of the file system is very critical for a mobile device. YAFFS2 is a file system that was designed specifically for NAND flash, which is supposed to be more robust than EXT3 file system in terms of NAND flash. I wonder if there is YAFF2 support in Android platform? or there is an alternative other than EXT3? Any hint is very appreciated. Best Hugo -- Jeff Sharkey jshar...@android.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: ambiguous column name: _id when querying the contacts list
Using the SDK version to handle the logic sounds like a good solution. You should use Build.VERSION.SDK (instead of RELEASE), since its values are much more predictable. (The SDK always increments by 1 for each platform release; Cupcake was 3, Donut will be 4, Eclair will be 5.) Also, a side note, you should look at using StringBuilder to make your loop more efficient. The code you pasted is allocating two new String objects for each pass through the loop, which are then immediately marked as garbage. Here's a slightly more efficient way of doing the same loop: StringBuilder recycle = new StringBuilder((); for (Integer friend : friends) { recycle.append(friend); recycle.append(,); } // Replace last comma with clause termination recycle.setCharAt(recycle.length() - 1, ')'); final String where = recycle.toString(); For clarity purposes that code uses an iterator, but it's slightly faster to use direct indexing like you originally had: http://developer.android.com/guide/practices/design/performance.html#foreach j On Thu, Aug 13, 2009 at 9:29 AM, whaledawgwhaled...@gmail.com wrote: Ouch... I met the same problem. So is it possible to maintain a version working for both sdk? I assume that checking the version number and using the cludgy way if it's less than 2.0 should be sufficient: float version = Float.parseFloat((new Build.VERSION ()).RELEASE); if(version 2.0f) { WHERE += people._id; } else { WHERE += Contacts.People._ID; } -- Jeff Sharkey jshar...@android.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: default measuring units px or dp
You're right, setting dimensions through code only takes raw pixel values. You have to multiply the display density; something like this should work: final float density = getResources().getDisplayMetrics().density; int pxSize = (int)((float)dipSize * density); Or if you're writing your own views, you can use TypedArray.getDimensionPixelSize() to read values as raw pixels. j On Thu, Aug 13, 2009 at 2:29 AM, Atif Gulzaratif.gul...@gmail.com wrote: in xml file we can define measuring units along with the values. If I want to set some property through code it only takes int value. What is the default unit for this int? px(pixels) or dp(density indipendent pixels) ? -- Best Regards, Atif Gulzar I Unicode, ɹɐzlnƃ ɟıʇɐ -- Jeff Sharkey jshar...@android.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Crashes with no usefull stacktrace
Sadly, it looks like the best short-term answer would be to roll your own formatting code. The formatter here is calling into native code for speed, so a pure-Java implementation wouldn't run into these native crashes. j On Thu, Aug 13, 2009 at 2:58 AM, Klaus Kartoukar...@gmail.com wrote: Thank you for your answer! Is there anything I can do to prevent this error? I certainly not want my app to crash when I release it :) One more question: How did you get the decoded stack trace? Cheers! On Thu, Aug 13, 2009 at 9:00 AM, Jeff Sharkey jshar...@android.com wrote: It's a known platform issue, and an engineer has been assigned to fix it. Here's the decoded stack trace: v-- free af22 .text 0003eac6 uprv_free_3_8 0003849c icu_3_8::UMemory::operator v-- ~DecimalFormatSymbols 0005018a icu_3_8::DecimalFormatSymbols::~DecimalFormatSymbols() v-- ~DecimalFormat 000517c8 icu_3_8::DecimalFormat::~DecimalFormat() 0008d65c unum_close_3_8 v-- closeDecimalFormatImpl dcb6 closeDecimalFormatImpl(_JNIEnv*, e3b4 dvmPlatformInvoke 00040a8a dvmCallJNIMethod j On Wed, Aug 12, 2009 at 2:16 PM, Klaus Kartoukar...@gmail.com wrote: Hi! My app has been pretty stable so forth, and suddenly I keep getting these crashes that kill the entire process. What do they mean and how should I deal with them? Since I dont get any usefull stacktrace I really dont know how to debug this. Below is the dump from my error log. Any help is much welcome! Best regards, Klaser 08-12 23:07:40.701: INFO/DEBUG(32): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** 08-12 23:07:40.701: INFO/DEBUG(32): Build fingerprint: 'android-devphone1/dream_devphone/dream/trout:1.5/CRB21/147201:userdebug/adp,test-keys' 08-12 23:07:40.701: INFO/DEBUG(32): pid: 7414, tid: 7415 com.android.Eva 08-12 23:07:40.701: INFO/DEBUG(32): signal 7 (SIGBUS), fault addr 08-12 23:07:40.711: INFO/DEBUG(32): r0 002ea4d8 r1 80ff80ff r2 002ea4c8 r3 80ff80ff 08-12 23:07:40.711: INFO/DEBUG(32): r4 f000 r5 0024de00 r6 r7 0378 08-12 23:07:40.711: INFO/DEBUG(32): r8 100ffd00 r9 4100afb0 10 4100afa0 fp 0001 08-12 23:07:40.711: INFO/DEBUG(32): ip 0001 sp 100ffc90 lr afe0e940 pc afe0af22 cpsr 8030 08-12 23:07:41.671: INFO/DEBUG(32): #00 pc af22 /system/lib/libc.so 08-12 23:07:41.701: INFO/DEBUG(32): #01 pc 0003eac6 /system/lib/libicuuc.so 08-12 23:07:41.731: INFO/DEBUG(32): #02 pc 0003849c /system/lib/libicuuc.so 08-12 23:07:41.731: INFO/DEBUG(32): #03 pc 0005018a /system/lib/libicui18n.so 08-12 23:07:41.751: INFO/DEBUG(32): #04 pc 000517c8 /system/lib/libicui18n.so 08-12 23:07:41.761: INFO/DEBUG(32): #05 pc 0008d65c /system/lib/libicui18n.so 08-12 23:07:41.781: INFO/DEBUG(32): #06 pc dcb6 /system/lib/libnativehelper.so 08-12 23:07:41.811: INFO/DEBUG(32): #07 pc e3b4 /system/lib/libdvm.so 08-12 23:07:41.821: INFO/DEBUG(32): #08 pc 00040a8a /system/lib/libdvm.so 08-12 23:07:41.821: INFO/DEBUG(32): #09 pc 00013118 /system/lib/libdvm.so 08-12 23:07:41.841: INFO/DEBUG(32): #10 pc 00017b1c /system/lib/libdvm.so 08-12 23:07:41.841: INFO/DEBUG(32): #11 pc 00017560 /system/lib/libdvm.so 08-12 23:07:41.861: INFO/DEBUG(32): #12 pc 000520ec /system/lib/libdvm.so 08-12 23:07:41.861: INFO/DEBUG(32): #13 pc 0005210a /system/lib/libdvm.so 08-12 23:07:41.871: INFO/DEBUG(32): #14 pc 000494c4 /system/lib/libdvm.so 08-12 23:07:41.871: INFO/DEBUG(32): #15 pc 0004954c /system/lib/libdvm.so 08-12 23:07:41.891: INFO/DEBUG(32): #16 pc 00049896 /system/lib/libdvm.so 08-12 23:07:41.891: INFO/DEBUG(32): #17 pc 00046f6a /system/lib/libdvm.so 08-12 23:07:41.911: INFO/DEBUG(32): #18 pc f880 /system/lib/libc.so 08-12 23:07:41.911: INFO/DEBUG(32): #19 pc f3f4 /system/lib/libc.so 08-12 23:07:41.931: INFO/DEBUG(32): stack: 08-12 23:07:41.931: INFO/DEBUG(32): 100ffc50 410978e8 08-12 23:07:41.931: INFO/DEBUG(32): 100ffc54 ad0520f5 /system/lib/libdvm.so 08-12 23:07:41.931: INFO/DEBUG(32): 100ffc58 002ff5c0 [heap] 08-12 23:07:41.931: INFO/DEBUG(32): 100ffc5c afe0e940 /system/lib/libc.so 08-12 23:07:41.931: INFO/DEBUG(32): 100ffc60 2bb0 08-12 23:07:41.941: INFO/DEBUG(32): 100ffc64 afe0ecd4 /system/lib/libc.so 08-12 23:07:41.941: INFO/DEBUG(32): 100ffc68 0024de08 [heap] 08-12 23:07:41.941: INFO/DEBUG(32): 100ffc6c afe0e940 /system/lib/libc.so 08-12 23:07:41.941: INFO/DEBUG(32): 100ffc70 0024de08 [heap] 08-12 23:07:41.941: INFO/DEBUG(32): 100ffc74
[android-developers] Re: canvas.save() / restore() , what is this?
Think of it as checkpointing the transformation matrix and clip rectangle of your Canvas at a known place in time. This is useful when rendering children views that may leave them in an unknown state. (You can restore back to the checkpointed state when children are done drawing.) Here's an example from ViewGroup: final int restoreTo = canvas.save(); [perform some drawing that might change the transformation matrix or clip rectangle] canvas.restoreToCount(restoreTo); j On Thu, Aug 13, 2009 at 3:04 AM, Jirijiriheitla...@googlemail.com wrote: Could someone explain to me the canvas.save() and restore(). I come from a flash background, and this is a new concept for me. Reading the documentation is not helpfull. Jiri -- Jeff Sharkey jshar...@android.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Text and delay
You shouldn't be using loops like this to delay things, especially if they end up running on the UI thread. Instead, create a Handler and send a message to your future self using postDelayed() or sendMessageDelayed(). j On Thu, Aug 13, 2009 at 8:23 AM, bluewindalphahelix...@gmail.com wrote: I want to display text1 then a few seconds later text2. Here's what I did. text1.setText(hello); long t1; t1 = SystemClock.uptimeMillis(); while (SystemClock.uptimeMillis() - t1 2000) { } text2.setText(hello2); But when I run the program, it delays for 2 seconds, then text1 and text2 appear together. I wonder what's wrong. Can someone help? -- Jeff Sharkey jshar...@android.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: AppWigets into Applications
I don't want to choose de widget from a list, instead of this, I want to insert a specifically widtget, so, is it necessary to use the android.appwidget.action.APPWIDGET_PICK intent in this case? The platform only offers that PICK intent, which requires the user to interactively pick from the list. Binding to a specific widget is protected by a permission that can only be granted to platform apps for the security reasons mentioned earlier. -- Jeff Sharkey jshar...@android.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: The Map keys of the Google APIs Add-on
The MD5 requested is only of the /keystore/ used to sign your app, not of the app itself. As long as the app is always signed with that same key, there is still only a single MD5. j On Mon, Aug 10, 2009 at 12:17 AM, Electronpcedb0...@gmail.com wrote: In the Web When we apply the Map Keys, we need sumbit the URL of our sites. In the Google APIs Add-on , we need the MD5 of our soft to get the Map keys. but here is a big question. 1. MD5 is easy to be changed. 2. First I got the MD5 of my app ,and then submit, but when I add the new keys , if the MD5 is changed, there will have the problems of the martch. 3. what should I do? -- Jeff Sharkey jshar...@android.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: How can I update values in contacts.db in a transaction.
The current (1.5_r3) ContentResolver API doesn't offer bulk updates, or a method of wrapping multiple operations into a transaction. One way to optimize your code is to allocate a single ContentValues object outside of the loop, and recycle it during each pass by calling clear(). (Currently you're allocating a new object for every update, which can get expensive.) j On Sun, Aug 9, 2009 at 9:41 PM, Daniel Kingcnk...@gmail.com wrote: I made a programe to update phonetic_names of contacts. Pronunciation p = new Pronunciation(getResources().openRawResource( R.raw.pronunciations)); Cursor c = getContentResolver() .query(People.CONTENT_URI, null, NAME != '', null, People.DEFAULT_SORT_ORDER); int idx_name = c.getColumnIndex(People.NAME); int idx_id = c.getColumnIndex(People._ID); while (c.moveToNext()) { ContentValues v = new ContentValues(); v.put(People.PHONETIC_NAME, p .get(c.getString(idx_name))); Uri u = ContentUris.withAppendedId(People.CONTENT_URI, c.getInt(idx_id)); getContentResolver().update(u, v, null, null); } It's very slow. I think it can be fast if there is a transaction. But I don't know how. -- Jeff Sharkey jshar...@android.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: how to create a appwidget with a listview
That's correct, ListView is not supported through RemoteViews, and no other views are supported to emulate scrolling. One reason for this is that many AppWidgetHosts override fling gestures to switch workspaces or perform other actions. j On Sun, Aug 9, 2009 at 7:25 PM, fenix baofenix...@vip.163.com wrote: hi all : I want to create an appwidget with a listview, but it seems that remotview do not support thsi element(there is some error) so is there any way to resolve it or some other view to replace listview. thank you! -- Jeff Sharkey jshar...@android.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Intent to pick appwidget?
The Help activity is the best solution for now. Also, if your users would like to remove that icon from their all-apps drawer after they've read the instructions, you can use PackageManager.setComponentEnabledSetting() to hide it, while leaving your app installed. j On Tue, Aug 11, 2009 at 9:37 AM, Stringsterling.ud...@googlemail.com wrote: Reposting this from Android Discuss, as it's probably more on-topic here. There's an ongoing issue with users who install an appwidget app from the Market and then don't know how to add the widget to their home screen. It's been suggested to add a Help or About activity with instructions - and I've done that - but I'd really rather include an Install Widget button on my main activity. Anyone have any clues on how to make that happen? I tried firing off an ACTION_APPWIDGET_PICK intent, but that always seems to NPE. I suspect I don't have the extras right, but OTOH, reading the docs it doesn't sound like exactly what I want anyway. Thanks, String -- Jeff Sharkey jshar...@android.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Spinner that looks like an EditText - Head is bloody and bruised
The look of a Spinner is just defined through a framework style, and you can override that style in your XML. In this case, the look of a spinner is provided by its android:background, which is defined here: http://android.git.kernel.org/?p=platform/frameworks/base.git;a=blob;f=core/res/res/drawable/btn_dropdown.xml;hb=cupcake You could specify your own android:background, even copying the existing EditText: http://android.git.kernel.org/?p=platform/frameworks/base.git;a=blob;f=core/res/res/drawable/edit_text.xml;hb=cupcake Since the EditText resources aren't exposed in the public API, you'd have to copy those assets into your local project. j On Tue, Aug 11, 2009 at 1:52 PM, phildopjlor...@gmail.com wrote: Ok so I spent quite a bit of time trying to find posts online about how to make a spinner look like an EditText. Basically, I want ALL the functionality of a spinner but I don't want that ugly down arrow that comes with the spinner. I'm perfectly capable of writing an EditText that opens a selectable list on click but theres got to be an easier way to just change how the spinner looks. Is there a way to do this in styles? or themes? or something? Thanks! -- Jeff Sharkey jshar...@android.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Share menu
You're probably looking to launch ACTION_SEND, wrapped in a createChooser() to let the user pick which application to share using. Here's an example of how sharing is triggered from the Camera app: http://android.git.kernel.org/?p=platform/packages/apps/Camera.git;a=blob;f=src/com/android/camera/ViewImage.java;hb=cupcake#l1467 j On Tue, Aug 11, 2009 at 5:11 PM, mphillip...@gmail.com wrote: How do you call the share menu to share some item (for example a URL) via email, SMS, twidroid, etc? Any examples of doing this? -- Jeff Sharkey jshar...@android.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Equi Size button in linearLayout
Since the buttons are inside a LinearLayout, assign android:layout_weight=1 to each of the children. Or, any fraction thereof, as long as the weights are identical. j On Tue, Aug 11, 2009 at 11:44 PM, Atifatif.gul...@gmail.com wrote: I want to place three button on the bottom of screen. I place these button in a linear layout and sets its gravity bottom. Currently these button wrap according to their labels so have different widths. But I want these button equi size. Means all three button should have same width (without using fixed widths). Is it possible? -- Best Regards, Atif Gulzar I Unicode, ɹɐzlnƃ ɟıʇɐ -- Jeff Sharkey jshar...@android.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: AppWigets into Applications
After you allocate the appWidgetId, you need to launch the android.appwidget.action.APPWIDGET_PICK intent, which will show a dialog that lets the user pick which widget to bind. Here's an example of how Launcher does this: http://android.git.kernel.org/?p=platform/packages/apps/Launcher.git;a=blob;f=src/com/android/launcher/Launcher.java;hb=cupcake#l1768 You don't need to request any permissions to bind widgets. In fact, only the platform can bind them, since binding is the primary security mechanism for widgets. If apps could bind widgets programmatically, one could imagine a bad app that would bind to your Calendar widget without your knowledge and slowly scrape updates about your personal events over time, etc. Once the user has successfully finished the binding process, your onActivityResult() is called, and shortly thereafter you should start receiving RemoteViews updates from that widget the callbacks you registered through AppWidgetHost.startListening(). j On Thu, Aug 6, 2009 at 4:45 AM, karansmwankh...@gmail.com wrote: hi, You need to bind your widgets id first, and for doing that you need to do two things 1) you will need a permission for binding 2) you will need to share your process id. Let me know if you still face the problem, On Aug 6, 4:35 pm, mtd martit...@hotmail.com wrote: Hi, I am trying to create an application that contains AppWidgets, but only get to show the original layout of the same, unable to interact with them. The main steps that I followed are: AppWidgetManager mAppWidgetManager = AppWidgetManager.getInstance (this); AppWidgetHost mAppWidgetHost = new AppWidgetHost(this, hostId); appWidgetId = mAppWidgetHost.allocateAppWidgetId(); // i is an integer used to specify the widget I want to insert AppWidgetHostView appWidgetHostView = mAppWidgetHost.createView(this, appWidgetId, appWidgetProviderInfo.get(i)); appWidgetHostView.setAppWidget(appWidgetId, (AppWidgetProviderInfo) appWidgetProviderInfo.get(i)); And then insert the appWidgetHostView into my application layout.Has anyone managed to enter AppWidgets into their applications and can tell me what I'm doing wrong? Thank you very much -- Jeff Sharkey jshar...@android.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: In call dialpad/menu confusion - am I the only one?
Platform improvements are ongoing, and this specific issue is being addressed in an upcoming release. j On Fri, Aug 7, 2009 at 11:31 AM, sambukacpwern...@googlemail.com wrote: When in a call, there is a confusion in the UI in selecting options. DTMF is sent flicking up the 'dialpad', and speaker (and other options) is found in the 'menu'. I think that this is confusing. All should be put in the menu or dialpad, but not both, or maybe put a frequent option SPEAKER on the dialpad. I often dial, then press MENU to select speaker, then have to flick DIALPAD to type in DTMF digits, then when the call is established, press MENU again and deselect speaker. This is too much!! A colleague recently got HTC Magic, and faced the same confusion (as I did when I got the phone). Please, Android engineers, fix this 'spikey' user interface. -- Jeff Sharkey jshar...@android.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Multiple line Notification
Yes, look at using a custom layout through RemoteViews, which is how Music shows multiple lines in its notification: http://android.git.kernel.org/?p=platform/packages/apps/Music.git;a=blob;f=src/com/android/music/MediaPlaybackService.java;hb=cupcake#l985 j On Fri, Aug 7, 2009 at 2:56 PM, Peacemoontran.bin...@gmail.com wrote: I use NotificationManager to write a Notification. I want now a multiple-line text for my notification. Is it possible? -- Jeff Sharkey jshar...@android.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: ProgressBar doesn't allow control of visibility in AppWidgetProvider App Widget?
Doh, good catch. The View.setVisibility() method is marked with the @android.view.RemotableViewMethod annotation, which is what allows it to be called through RemoteViews. In this case, ProgressBar actually overrides the default View implementation, but without adding that annotation. (This is why it throws the exception.) One quick workaround is to wrap the ProgressBar into a simple view like FrameLayout, and then setVisibility() on that wrapper. j On Fri, Aug 7, 2009 at 3:49 PM, Craigcraig.det...@gmail.com wrote: I was trying to set a progress bar to View.INVISIBLE or View.GONE, or View.VISIBLE inside an AppWidgetProvider. However, it doesn't seem to want to do it. Setting visibility works fine with TextView fields or ImageView fields or ImageButtons. However, ProgressBar doesn't seem to work. It doesn't make sense that just the progress bar type isn't supported for controlling visibility. Has anyone else seen this problem? The code: �...@override public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { RemoteViews updateViews = new RemoteViews(context.getPackageName(), R.layout.a_widget_home_screen); updateViews.setViewVisibility(R.id.progress_bar, View.VISIBLE); } ?xml version=1.0 encoding=utf-8? RelativeLayout xmlns:android=http://schemas.android.com/apk/res/android; android:orientation=vertical android:layout_width=fill_parent android:layout_height=fill_parent ProgressBar android:id=@+id/progress_bar android:layout_height=32px android:layout_width=32px android:indeterminate=true android:layout_marginLeft=110px android:layout_marginTop=120px android:visibility=gone / /RelativeLayout This is the error: 08-07 17:42:42.633: WARN/AppWidgetHostView(102): updateAppWidget couldn't find any view, using error view 08-07 17:42:42.633: WARN/AppWidgetHostView(102): android.widget.RemoteViews$ActionException: view: android.widget.ProgressBar can't use method with RemoteViews: setVisibility(int) 08-07 17:42:42.633: WARN/AppWidgetHostView(102): at android.widget.RemoteViews$ReflectionAction.apply(RemoteViews.java: 443) 08-07 17:42:42.633: WARN/AppWidgetHostView(102): at android.widget.RemoteViews.performApply(RemoteViews.java:855) 08-07 17:42:42.633: WARN/AppWidgetHostView(102): at android.widget.RemoteViews.apply(RemoteViews.java:832) 08-07 17:42:42.633: WARN/AppWidgetHostView(102): at android.appwidget.AppWidgetHostView.updateAppWidget (AppWidgetHostView.java:167) 08-07 17:42:42.633: WARN/AppWidgetHostView(102): at android.appwidget.AppWidgetHost.updateAppWidgetView(AppWidgetHost.java: 243) 08-07 17:42:42.633: WARN/AppWidgetHostView(102): at android.appwidget.AppWidgetHost$UpdateHandler.handleMessage (AppWidgetHost.java:73) 08-07 17:42:42.633: WARN/AppWidgetHostView(102): at android.os.Handler.dispatchMessage(Handler.java:99) 08-07 17:42:42.633: WARN/AppWidgetHostView(102): at android.os.Looper.loop(Looper.java:123) 08-07 17:42:42.633: WARN/AppWidgetHostView(102): at android.app.ActivityThread.main(ActivityThread.java:3948) 08-07 17:42:42.633: WARN/AppWidgetHostView(102): at java.lang.reflect.Method.invokeNative(Native Method) 08-07 17:42:42.633: WARN/AppWidgetHostView(102): at java.lang.reflect.Method.invoke(Method.java:521) 08-07 17:42:42.633: WARN/AppWidgetHostView(102): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:782) 08-07 17:42:42.633: WARN/AppWidgetHostView(102): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540) 08-07 17:42:42.633: WARN/AppWidgetHostView(102): at dalvik.system.NativeStart.main(Native Method) -- Jeff Sharkey jshar...@android.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Android on the iPhone
If you're a developer interested in porting to various hardware configurations, you're probably looking for the android-porting list: http://groups.google.com/group/android-porting This group (android-developers) is primarily focused on app development questions when working with the Android SDK. j On Fri, Aug 7, 2009 at 3:58 PM, MikeAdjarcad...@gmail.com wrote: I wasn'ta fan of the G1 because it seemed so small. The myTouch seems much better but I've since gotten an iPhone. Is there anyway to run Android on the iPhone? I Googled it but a lot of the data I found was old. -- Jeff Sharkey jshar...@android.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Get application version detail
You can read it out through PackageManager. Here's a quick example of how I'm reading this in ConnectBot: http://code.google.com/p/connectbot/source/browse/trunk/connectbot/src/org/connectbot/util/UpdateHelper.java#85 j On Tue, Aug 4, 2009 at 11:24 PM, Muthu Kumar K.muthum...@gmail.com wrote: Hi All, I am trying to get the application version which is mentioned in AndroidManifest.xml How can i get this detail? Please suggest me. Thanks in Advance, Muthu Kumar K. -- Jeff Sharkey jshar...@android.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: clipboard copy paste
You're probably looking to grab an instance of ClipboardManager through Context.getSystemService(). j On Tue, Aug 4, 2009 at 6:23 AM, Bobbshumsk...@yahoo.com wrote: Hi, Is there a way to programmatically add text to the clipboard for copy/ paste functionality into another app. Thanks, Bob -- Jeff Sharkey jshar...@android.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Clearing the cache of your app on exit
Another thing worth mentioning when you're managing your own cache is to listen for the ACTION_DEVICE_STORAGE_LOW broadcast through a receiver. This way, if the device runs low on space, you can help by automatically purging your cache. j On Fri, Jul 24, 2009 at 5:27 PM, Mark Murphymmur...@commonsware.com wrote: niko001 wrote: is it possible to force the cache of your app to clear when the user exits the app? My app piles up cache data (rightfully so) on each start, which is no longer needed once the user quits the app, so I am trying to find a way to forcibly clear it. You could try deleting the files from getCacheDir(), available on Activity, Service, and other flavors of Context. On the other hand, you did not specify which cache you were concerned about... -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy _The Busy Coder's Guide to *Advanced* Android Development_ Version 1.0 Available! -- Jeff Sharkey jshar...@android.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: ImageButton press feedback
The framework offers stateful drawables that automatically change based on user interaction, such as focus or touch. Here's an example of the default Button background is defined: http://android.git.kernel.org/?p=platform/frameworks/base.git;a=blob;f=core/res/res/drawable/btn_default.xml;hb=cupcake When a drawable like this is set as a android:background or android:src, the framework will handle swapping out the icon based on state for you. (You don't need to write onKeyDown, etc.) j On Sun, Aug 2, 2009 at 11:07 PM, Venkatesh Dd.venkates...@gmail.com wrote: Hi all, I am developing an application which has many cool image buttons. On press or click of any image button there is no feed back to the user either color change or any kind of contrast change in the button. I don't prefer to have multiple images for a single image button loaded onKeyDown and onKeyUp callbacks, simply to avoid the size of the APK. Is there any default property provided by the framework which just takes care of Image Button press and release events with some kind of feedback to the user on both the events? -- Jeff Sharkey jshar...@android.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: SQLiteDatabase table
You should really look at using SQLiteOpenHelper; it automatically helps with initial database creation and any upgrade paths. j On Tue, Jul 28, 2009 at 7:35 PM, jayaramjaiac...@gmail.com wrote: Hi, I've an SQLiteDatabase mydb.db. I want to check whether a particular table named 'table1' exists or not at the beginning of my pgm. Do i have any methods for checking that without the create table if not exists query? Any suggestions Regards.. Jayaram -- Jeff Sharkey jshar...@android.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: appwidget onReceive() appwidgetIds null
There's a known bug where the DELETED broadcast sends EXTRA_APPWIDGET_ID (instead of IDS): http://groups.google.com/group/android-developers/msg/e405ca19df2170e2 j On Mon, Aug 3, 2009 at 8:21 AM, ChangliWangchlw...@hustunique.com wrote: public void onReceive(Context context, Intent intent) { // TODO Auto-generated method stub super.onReceive(context, intent); String action = intent.getAction(); if (AppWidgetManager.ACTION_APPWIDGET_DELETED.equals(action)) { Log.i(TAG, onReceive1); Bundle extras = intent.getExtras(); if (extras != null) { Log.i(TAG, onReceive2); int[] appWidgetIds = extras.getIntArray (AppWidgetManager.EXTRA_APPWIDGET_IDS); if (appWidgetIds != null appWidgetIds.length 0) { Log.i(TAG, onReceive3); this.onDeleted(context, appWidgetIds); } } } } I found that appWidgetIds is null. Who can tell me why? -- Jeff Sharkey jshar...@android.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Images not loading on the phone
if(photoUrl.contains( )) { photoUrl = photoUrl.replaceAll( , %20); } Just a random side note, but you probably want to use Uri.encode() to properly escape all characters, not just spaces. -- Jeff Sharkey jshar...@android.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Rotate TextView to an angle... What's wrong with this code?
Don't restore the Canvas until /after/ you super.dispatchDraw(). j On Sun, Aug 2, 2009 at 10:32 AM, Motomedicalsou...@gmail.com wrote: Hello, I got this code from another post and modified it to work for me as a TextView. I tried using the code below but no transformation is happening? Can someone help me out see what's wrong? I trying to draw the canvas of the TextView with the given Matrix transformation. Thanks! Moto! import android.content.Context; import android.graphics.Canvas; import android.graphics.Matrix; import android.util.AttributeSet; import android.view.MotionEvent; import android.widget.TextView; public class CTextView extends TextView { private Matrix mForward = new Matrix(); private Matrix mReverse = new Matrix(); private float[] mTemp = new float[2]; public CTextView(Context context) { super(context); mForward.postRotate(90); mForward.invert(mReverse); } public CTextView(Context context, AttributeSet attrs) { super(context, attrs); mForward.postRotate(90); mForward.invert(mReverse); } public CTextView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); mForward.postRotate(90); mForward.invert(mReverse); } �...@override protected void dispatchDraw(Canvas canvas) { canvas.save(); canvas.concat(mForward); canvas.restore(); super.dispatchDraw(canvas); } �...@override public boolean dispatchTouchEvent(MotionEvent event) { final float[] temp = mTemp; temp[0] = event.getX(); temp[1] = event.getY(); mReverse.mapPoints(temp); event.setLocation(temp[0], temp[1]); return super.dispatchTouchEvent(event); } } -- Jeff Sharkey jshar...@android.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: How to show the search bar
) menu.removeItem(0); // next, add back item(s) based on current menu mode switch (mMenuMode.getSelectedItemPosition()) { case MENUMODE_SEARCH_KEY: item = menu.add( 0, 0, 0, (Search Key)); break; case MENUMODE_MENU_ITEM: item = menu.add( 0, 0, 0, Search); item.setAlphabeticShortcut(SearchManager.MENU_KEY); break; case MENUMODE_TYPE_TO_SEARCH: item = menu.add( 0, 0, 0, (Type-To-Search)); break; case MENUMODE_DISABLED: item = menu.add( 0, 0, 0, (Disabled)); break; } return true; } /** Handle the menu item selections */ �...@override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case 0: switch (mMenuMode.getSelectedItemPosition()) { case MENUMODE_SEARCH_KEY: new AlertDialog.Builder(this) .setMessage(To invoke search, dismiss this dialog and press the search key + (F5 on the simulator).) .setPositiveButton(OK, null) .show(); break; case MENUMODE_MENU_ITEM: onSearchRequested(); break; case MENUMODE_TYPE_TO_SEARCH: new AlertDialog.Builder(this) .setMessage(To invoke search, dismiss this dialog and start typing.) .setPositiveButton(OK, null) .show(); break; case MENUMODE_DISABLED: new AlertDialog.Builder(this) .setMessage(You have disabled search.) .setPositiveButton(OK, null) .show(); break; } break; } return super.onOptionsItemSelected(item); } /** * This hook is called when the user signals the desire to start a search. * * By overriding this hook we can insert local or context-specific data. * * @return Returns true if search launched, false if activity blocks it */ �...@override public boolean onSearchRequested() { // If your application absolutely must disable search, do it here. if (mMenuMode.getSelectedItemPosition() == MENUMODE_DISABLED) { return false; } // It's possible to prefill the query string before launching the search // UI. For this demo, we simply copy it from the user input field. // For most applications, you can simply pass null to startSearch() to // open the UI with an empty query string. final String queryPrefill = mQueryPrefill.getText().toString (); // Next, set up a bundle to send context-specific search data (if any) // The bundle can contain any number of elements, using any number of keys; // For this Api Demo we copy a string from the user input field, and store // it in the bundle as a string with the key demo_key. // For most applications, you can simply pass null to startSearch(). Bundle appDataBundle = null; final String queryAppDataString = mQueryAppData.getText ().toString(); if (queryAppDataString != null) { appDataBundle = new Bundle(); appDataBundle.putString(demo_key, queryAppDataString); } // Now call the Activity member function that invokes the Search Manager UI. startSearch(queryPrefill, false, appDataBundle, false); // Returning true indicates that we did launch the search, instead of blocking it. return true; } } -- Jeff Sharkey jshar...@android.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Rotate A View Permanently
It's actually really easy, and you don't need to use animations. I did something like this recently by using a wrapper layout that adjusts the Canvas and any MotionEvents. (You could also use this approach rotate the entire layout to any arbitrary angle.) I think romainguy told me to use Canvas.concat(mForward) instead of setMatrix(), but I haven't updated the code in awhile. private static class FlipLayout extends FrameLayout { private Matrix mForward = new Matrix(); private Matrix mReverse = new Matrix(); private float[] mTemp = new float[2]; public FlipLayout(Context context) { super(context); mForward.postRotate(180); mForward.invert(mReverse); } @Override protected void dispatchDraw(Canvas canvas) { canvas.setMatrix(mForward); super.dispatchDraw(canvas); } @Override public boolean dispatchTouchEvent(MotionEvent event) { final float[] temp = mTemp; temp[0] = event.getX(); temp[1] = event.getY(); mReverse.mapPoints(temp); event.setLocation(temp[0], temp[1]); return super.dispatchTouchEvent(event); } } On Fri, Jul 24, 2009 at 10:53 PM, Josh Hoffmankeshis...@gmail.com wrote: I posted earlier today on this topic, but I'm re-posting as I haven't been able to locate my post via search. I apologize if this is indeed a double-post, but it seems something went wrong with the original. I've been trying to find a means of rotating a view such that it is flipped upside-down and stays that way. I found the Rotation Animation method, but I have been unable to find a means of keeping the view rotated. Repeating the animation doesn't suit my purposes, and in fact I don't want an animation at all if possible. What I would like is something akin to a transformation, except to be used on a TextView or a LinearLayout. I have considering overriding methods to accomplish this task by slightly modifying the animation code, but I'm not sure how extensive the work for this would be. Additionally, I'm not sure where to find the source for those methods. If anyone could recommend a means of accomplishing this task, whether it be by an override or perhaps something simple that I am missing, I would appreciate it very much. Thanks! -- Jeff Sharkey jshar...@android.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Flipping / Rotating TextView (or layout) upside-down
Ugh double-post. I just responded in the other thread with an alternative approach that doesn't require animations. j On Sun, Jul 26, 2009 at 3:51 PM, Romain Guyromain...@google.com wrote: All you have to do is set the fillAfter property of the animation to true. On Fri, Jul 24, 2009 at 11:27 AM, Josh Hoffmankeshis...@gmail.com wrote: Hello, I'm trying to find a way to rotate a View, or (more conveniently) an entire layout, upside down and have it stay that way. I found the rotation and animation classes in the SDK, and these come close to what I want, but at the end of the animation I want my Layout to stay rotated; repeating the animation or just flipping back right- side-up doesn't help me with my app unfortunately. The only thing I can think of so far would be to find the source code for the rotate class, and override it such that the ...and then flip it back around to be right-side-up code never happens. I'm not sure exactly where I'd find the original rotate code for reference if I were to do something that extensive however. I've found references online to the full android source - is that basically what I'd be looking at downloading to be able to attempt something like this? Am I missing a simple option on the rotation that would let it just stay put after I rotate it? Any help would be very much appreciated! Thank you! -- 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 -- Jeff Sharkey jshar...@android.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Rotate A View Permanently
Ah yes, that's what I was missing. :) j On Mon, Jul 27, 2009 at 8:22 AM, Romain Guyromain...@google.com wrote: Your solution might not always work because you do not save/restore the Canvas in dispatchDraw(). On Mon, Jul 27, 2009 at 2:46 AM, Jeff Sharkeyjshar...@android.com wrote: It's actually really easy, and you don't need to use animations. I did something like this recently by using a wrapper layout that adjusts the Canvas and any MotionEvents. (You could also use this approach rotate the entire layout to any arbitrary angle.) I think romainguy told me to use Canvas.concat(mForward) instead of setMatrix(), but I haven't updated the code in awhile. private static class FlipLayout extends FrameLayout { private Matrix mForward = new Matrix(); private Matrix mReverse = new Matrix(); private float[] mTemp = new float[2]; public FlipLayout(Context context) { super(context); mForward.postRotate(180); mForward.invert(mReverse); } �...@override protected void dispatchDraw(Canvas canvas) { canvas.setMatrix(mForward); super.dispatchDraw(canvas); } �...@override public boolean dispatchTouchEvent(MotionEvent event) { final float[] temp = mTemp; temp[0] = event.getX(); temp[1] = event.getY(); mReverse.mapPoints(temp); event.setLocation(temp[0], temp[1]); return super.dispatchTouchEvent(event); } } On Fri, Jul 24, 2009 at 10:53 PM, Josh Hoffmankeshis...@gmail.com wrote: I posted earlier today on this topic, but I'm re-posting as I haven't been able to locate my post via search. I apologize if this is indeed a double-post, but it seems something went wrong with the original. I've been trying to find a means of rotating a view such that it is flipped upside-down and stays that way. I found the Rotation Animation method, but I have been unable to find a means of keeping the view rotated. Repeating the animation doesn't suit my purposes, and in fact I don't want an animation at all if possible. What I would like is something akin to a transformation, except to be used on a TextView or a LinearLayout. I have considering overriding methods to accomplish this task by slightly modifying the animation code, but I'm not sure how extensive the work for this would be. Additionally, I'm not sure where to find the source for those methods. If anyone could recommend a means of accomplishing this task, whether it be by an override or perhaps something simple that I am missing, I would appreciate it very much. Thanks! -- Jeff Sharkey jshar...@android.com -- 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 -- Jeff Sharkey jshar...@android.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Problem in running the android sky widget
There have been previous threads about android.location.Geocoder not entirely working in the SDK. That app depends on responses from that API, which is why it's not working. The geocoder works on actual devices, otherwise you could hard-code values when debugging. j On Tue, Jul 14, 2009 at 5:04 AM, bhojvishalb...@gmail.com wrote: same here even I am facing the same problem On Jul 14, 11:07 am, n179911 n179...@gmail.com wrote: Hi, I have download the android sky project and able to get it to compile it under eclipse. http://code.google.com/p/android-sky/ But when i try to add a 'Forecast' Widget on emulator, it pops up a 'Configure forecast widget', then I click 'Manual search' , I entered '60005' as my zip code. Then I press the 'Search' Icon. Then what should I do to next? Both 'Verify on Map' and 'Save' buttons are disabled. I am not sure what else do i need to do to run it on emulator? Thank you. -- Jeff Sharkey jshar...@android.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: TIME_TICK in an AppWidget?
If I do have to try to make AnalogClock work instead, though... I know that it's possible to use custom dial and hand drawables, but can't see how to make that happen in an AppWidget (using RemoteView). Can anyone shed any light on that? When you define the AnalogClock in your layout XML file, you can assign the drawables through android:hand_hour and android:hand_minute. When the widget is inflated, it will apply those drawables. -- Jeff Sharkey jshar...@android.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Widget not working properly when changing orientation
Make sure you're sending all PendingIntents across with each RemoteViews update, even if they've already been set. When the orientation changes, the layout is inflated and only the most-recently cached RemoteViews is applied over it. j On Wed, Jul 8, 2009 at 1:49 AM, sunitaagrawal.suni...@gmail.com wrote: I have a widget , thats working just fine in a particular orientation, but the moment i change the orientation to landscape/portrait, the widget is not able to launch. I have one layout and one layout-land folder in res directory.The problem is that the widget created in landscape mode is not opening in portrait mode and vice-versa. Thanks for the answer -- Jeff Sharkey jshar...@android.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Error on SharedPreferences for AppWidget
The SharedPreferences should be saving okay. There's an open issue where if you return from the configuration activity to Launcher in a different orientation, it won't insert the widget correctly. If the user returns to the original orientation before returning, I think it inserts correctly. j On Fri, Jul 10, 2009 at 5:55 AM, Stefano Sanna (gerdavax)gerda...@gmail.com wrote: Hi. I'm working on an AppWidget which manages settings using SharedPreferences. I'm experiencing a strange behaviour (on a Dream) on its configuration Activity: 1) if I use software keyboard (that is: without opening physical keyboard) to edit text, everything works fine and preferences are stored. The happens if the application starts with keyboard already open. 2) if I open physical keyboard (and activity is being restarted and rendered in landscape), when saving preferences the widget does not appear on the desktop. Sometimes I get an error message (unable to unlink to the path of application's data). It seems that, when restarted on keyboard open, the configuration Activity looses ownership of its sharedpreferences. Any idea? Thank you. Ciao, Stefano. -- Jeff Sharkey jshar...@android.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Bug report: widget does not load if the orientation changes during the configuration
Thanks for catching this--it's a known issue and an engineer has been assigned to it. :) There really isn't a good workaround in 1.5, other than forcing the configuration activity into portrait mode or asking users to rotate before returning. j On Sun, Jul 12, 2009 at 3:19 PM, Pablo Perapablo...@gmail.com wrote: Hi, I'd like to report a bug we just found while writing a widget. Summary: There is a widget installed, that defines a configuration activity. If the user changes the orientation while they are in the configuration activity, and they finish that activity in a different orientation that they started, the widget does NOT appear in the home screen after the configuration is done. How to reproduce: have a minimal widget, with a configuration activity that contains a button, which correctly updates the App Widget when it is clicked (as explained in http://developer.android.com/guide/topics/appwidgets/index.html#Configuring). Add a new instance of the widget, so the config screen shows up. Change the orientation once. Click on the button. Your widget does not appear in the home screen. (Ouch.) If this has already been reported, or if there's a better way to submit a bug report, please let me know! Thanks, Pablo -- Jeff Sharkey jshar...@android.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: TIME_TICK in an AppWidget?
Is there any way to make the dial dynamic? That's a crucial part of the app I'm trying to build. Yep, assign a drawable to android:dial just like the other attributes. Here's the exact layout of the current clock widget: http://android.git.kernel.org/?p=platform/packages/apps/AlarmClock.git;a=blob;f=res/layout/analog_appwidget.xml;hb=cupcake -- Jeff Sharkey jshar...@android.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: How do you handle orientation change for a Cupcake widget?
Does this imply that EVERY RemoteViews update that I apply to my widget should be capable of COMPLETELY initializing the correct current state of every component on the widget? Yes, that's correct. This is because you can't infer anything about the current remote state. That remote state might have some actions pre-applied from a previous RemoteViews object, or it might be applied over a newly-inflated layout, for example if Launcher was forced out of memory. (So it's not just orientation changes.) -- Jeff Sharkey jshar...@android.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: ACTION_TIME_TICK for every Second required.
Implementing a clock widget with seconds as an AppWidget would be /extremely/ inefficient. The update code would be creating a new RemoteViews object, and marshaling it across two IPC boundaries every second. The best way to write something like this would be to integrate it directly into a custom home screen, so you could bypass the IPC costs and only invalidate when the home activity is actively being shown. j On Fri, Jun 26, 2009 at 3:46 AM, Raviravikumar...@gmail.com wrote: ACTION_TIME_TICK occurs every minute. I need an action which will occur every second because I'm trying to display the 'Seconds' needle in AppWidget. Do help me even if it means modifying the framework source code. ACTION_TIME doesn't occurs it's docs are not clear. -- Jeff Sharkey jshar...@android.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: AnalogClock AppWidget dial.
AnalogClock doesn't directly provide methods to change its drawables. One approach you could use would be to have two layout files, one each for AM and PM, and build a new RemoteViews targeting the correct layout when building updates. j On Tue, Jun 23, 2009 at 9:54 PM, Raviravikumar...@gmail.com wrote: Using Appwidgets, If we use TextView in layout provider xml then, we are able to set the text in Provider.java using remoteViews.setTextViewText() method. Similarly, if I use AnalogClock as AppWidget in xml then, is there any method available to change the android:dial value using RemoteViews or AnalogClock api's in Provider.java ? For Ex- I need to load two dial png's based on AM or PM. Please help me. -- Jeff Sharkey jshar...@android.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: WebView Dialog Activity
This might be related to the layout measuring pass. Try setLayoutParams() on the WebView with both dimensions as FILL_PARENT before calling setContentView(). j On Mon, Jun 22, 2009 at 5:50 PM, Mark Murphymmur...@commonsware.com wrote: Derek wrote: Thanks for the quick response. My responses to your questions: -- Does your page require Javascript? If so, have you tried enabling Javascript? No Javascript used (its pretty much begin/end tags with plain text) -- Have you tried it without the Dialog theme? Yes and that works but we'd like the Dialog to work for aesthetic purposes -- Have you tried using a layout file rather than directly creating a WebView instance? Yes, that also doesn't work -- Have you tried some URL without the # syntax? Yes also doesn't work OK, so it's definitely tied to a Dialog theme. Sorry for all the questions, but I wasn't sure if you had tried those sorts of things. Sounds like a bug to me. AFAIK, themes should not interfere with the operation of any specific widget type. If you can create a separate test project that demonstrates the error, post an issue to http://b.android.com, and post the issue URL to this list. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Warescription: Three Android Books, Plus Updates, $35/Year -- Jeff Sharkey jshar...@android.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: override AnalogClock
Is there any way or workaround so that we can add our custom analog clock at the home screen widget? You can still customize the clock drawables, but would need to use the AnalogClock class as provided by the framework. -- Jeff Sharkey jshar...@android.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: How do you handle orientation change for a Cupcake widget?
When it is initially created, the onUpdate() method of my AppWidgetProvider calls views.setOnClickPendingIntent(buttonID, pendingIntent) to register for my button events, but when the orientation changes, new buttons are created and I don't have an opportunity to re-register the onClick listeners. What is the proper way to do this? The system keeps a cache of the last RemoteViews update you sent, and reapplies it to the newly inflated landscape layout automatically. :) -- Jeff Sharkey jshar...@android.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Make a application default launcher
Your intent needs to match the base Content-Type returned in the HTTP header. You can peek to figure out what mimetype your server is reporting: $ curl -I http://localhost/news.xml.post.xml HTTP/1.1 200 OK Content-Type: application/xml ... $ curl -I http://feeds.feedburner.com/blogspot/hsDu HTTP/1.1 200 OK Content-Type: text/xml; charset=UTF-8 ... In that last example, the charset isn't part of the base mimetype. j On Wed, Jun 17, 2009 at 8:58 AM, Dillidilliraomca...@gmail.com wrote: Hi, i am developing a simple application which takes xml files and do the operations i am testing it on emulator. 1.5 sdk I set the intent filters and data and mime types as follows in the manifest file intent-filter action android:name=android.intent.action.MAIN/action category android:name=android.intent.category.LAUNCHER/ category action android:name=android.intent.action.VIEW / category android:name=android.intent.category.DEFAULT / category android:name=android.intent.category.BROWSABLE / data android:scheme=http / data android:mimeType=application/autom+xml/ data android:mimeType=application/xml/ data android:mimeType=application/rss+xml/ !-- added data types -- /intent-filter Note: while loading the xml file from the browser directly loads it as a text it gives data:htt://./file.xml but it don't give the mime type ie: type: how to launh my activity as default for these type of xml files need help Thank you. -- Jeff Sharkey jshar...@android.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: How to get current time?
So I made the NTP assumption based on seeing things scroll by in logcat, but after digging deeper, it looks like it doesn't actually change the system clock. (Instead it's used for GPS somehow?) D/GpsLocationProvider( 5839): Requesting time from NTP server north-america.pool.ntp.org D/InetAddress( 5839): north-america.pool.ntp.org: 66.218.191.215 (family 2, proto 6) D/InetAddress( 5839): north-america.pool.ntp.org: 72.36.170.170 (family 2, proto 6) D/InetAddress( 5839): north-america.pool.ntp.org: 204.15.208.61 (family 2, proto 6) D/InetAddress( 5839): north-america.pool.ntp.org: 204.152.186.173 (family 2, proto 6) D/InetAddress( 5839): north-america.pool.ntp.org: 66.96.96.29 (family 2, proto 6) D/SntpClient( 5839): round trip: 363 ms D/SntpClient( 5839): clock offset: 4603 ms D/GpsLocationProvider( 5839): calling native_inject_time: 1244281076239 reference: 469876415 certainty: 181 j On Tue, Jun 9, 2009 at 5:01 AM, Mark Murphymmur...@commonsware.com wrote: Jeff Sharkey wrote: So just a heads up that Android uses NITZ events provided by a carrier to properly set the system date and time. Android also falls-back to network NTP automatically when no cellular network is available. http://en.wikipedia.org/wiki/NITZ The time provided by currentTimeMillis() will typically be the best available time, and it's what all of the services on the device use, like Calendar and Alarm Clock. Does Android fall back to NTP when there is cellular but no NITZ? NITZ isn't terribly widespread. Thanks! -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Need help for your Android OSS project? http://wiki.andmob.org/hado -- Jeff Sharkey jshar...@android.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Adding forign language
http://d.android.com/guide/topics/resources/resources-i18n.html#AlternateResources j On Sun, Jun 14, 2009 at 10:41 PM, abhashreeabhashree.pa...@gmail.com wrote: How to add support for foreign languages in an android application? -- Jeff Sharkey jshar...@android.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: AppWidget: help with setOnClickPendingIntent()
Right, you can't pass the appWidgetId through a PendingIntent extra reliably. You could pass it through the setData() Uri, and have the configuration activity watch for both. j On Mon, Jun 15, 2009 at 2:18 AM, BoDbodl...@gmail.com wrote: Replying to my own post for future reference. This is due to the way PendingIntents work and are automatically reused. Quoting the PendingIntent Javadoc: If the creating application later re-retrieves the same kind of PendingIntent (same operation, same Intent action, data, categories, and components, and same flags), it will receive a PendingIntent representing the same token if that is still valid, and can thus call cancel() to remove it. BoD On Jun 14, 9:19 pm, BoD bodl...@gmail.com wrote: Hi! I'm making a little AppWidget that should be configured when you first add it and also when you click on it. I figured, since clicking on it should do the same as the creation event, why not try to use the same code? My configuration Activity should not know or care, whether it was called for a creation event or an already exists, wants to be configured event. So I extend AppWidgetProvider, create a RemoteViews for my AppWidget and do this in onUpdate(): Intent intent = new Intent(context, ConfigureActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId); PendingIntent pendingIntent = PendingIntent.getActivity (context, 0, intent, 0); views.setOnClickPendingIntent(R.id.buttonImage, pendingIntent); For some reason it's not working as I'd like: in my ConfigureActivity when I look at getIntent().getExtras ().extras.getInt(AppWidgetManager.EXTRA_APPWIDGET_ID), it returns always the same id: the first one that was configured. Now the strange part: if in the code above I add this line: intent.setData(ContentUris.withAppendedId(Uri.EMPTY, appWidgetId)); then it works correctly and in my ConfigureActivity getIntent ().getExtras().extras.getInt(AppWidgetManager.EXTRA_APPWIDGET_ID) returns the correct id, the id of the widget I clicked on. Surely there is an explanation but I don't see it. Please help! :) Thanks a lot! BoD -- Jeff Sharkey jshar...@android.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: How to drop the AppWidget to Home Screen?
You have to long-press on the home screen, or pick Add from the menu. Then you can pick Widgets and the example widget. j On Sat, Jun 13, 2009 at 1:32 PM, tng.z...@googlemail.comtng.z...@googlemail.com wrote: I checked out the SimpleWikitionary, the demo project mentioned in the Blog http://android-developers.blogspot.com/2009/04/introducing- home-screen-widgets-and.html. I tried to start the application in the emulator. The application was installed successfully on the emulator, but I could not see the wiki- widget on the home screen. I added also some logging code in the WordWidget::onUpdate(), however, the code seems never to be called. Does the emulator delivered in SDK 1.5 support the AppWidgets Framework? Or I did forget to do some configuration? Thx in advance for help! Ting -- Jeff Sharkey jshar...@android.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: [AppWidget ] How to get widget object from appwidget
I don't know how to get the button object from appwidget(get the ture layout copy of home screen). You can't access the actually-inflated layout from your app because it exists entirely in another process. I know the RemoteView offeres an interface RemoteView.setOnClickPendingIntent,but what I need is RemoteView.setOnClickListener(R.id.delete,OnClickListener) You can't setOnClickListener() directly, because the target View lives in another process. If this were allowed, the other process would be executing your code as itself, which is a security hole. -- Jeff Sharkey jshar...@android.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: How to disable Buttons on a Widget
Is it possible to disable a button on a Cupcake desktop widget? Not directly, but you could send a widget update that swaps out the drawable used and clears the PendingIntent. Or, keep two buttons in your layout, and visible/gone them as needed. The current Google Search widget disables the search button until a user enters text, then the button is disabled. Is this only allowed for special widgets, or is there an approach available to third- party widgets? The Google Search bar on the desktop looks and feels like a widget, but it isn't a real widget. It lives directly in the Launcher app, which is how it does things like auto completion. Other AppWidgetHosts are free to include their custom elements like this: http://d.android.com/reference/android/appwidget/AppWidgetManager.html#EXTRA_CUSTOM_INFO More generally, is there a list somewhere of the allowed / disallowed calls to widget views via the RemoteViews.setType() approach? I've also encountered that setSelected and some others are not allowed. The allowed methods are simply marked with the @RemotableViewMethod annotation, here's a quick grep across the Cupcake tree: http://pastebin.com/f45b5130a -- Jeff Sharkey jshar...@android.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Widget Unresponsive after Opening/Closing
Are you sending a full RemoteViews update each time? (The AppWidget framework only keeps the last RemoteViews sent, and reapplies it when needed, such as after a screen rotation.) For example, if you only set the PendingIntent once, and have a second RemoteViews update that doesn't include it, the PendingIntent will be lost when the screen is rotated. j On Tue, Jun 16, 2009 at 10:16 AM, d2daddd2d...@gmail.com wrote: I have a widget button that responds to user's clicks. My design is to assign the click event handler to calling a service in OnUpdate. It works fine when first created, but it stops responding after user has opened and closed the keyboard. How to fix this? Many thanks. -- Jeff Sharkey jshar...@android.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: which width and height for a 2*1 cell widget? 160*100? Bug in Widget?
Using the following equation yields: Minimum size in dip = (Number of cells * 74dip) - 2dip 146dip = (2 * 74dip) - 2dip 72dip = (1 * 74dip) - 2dip The reason for the odd math is because the same dimensions are used when inserted in landscape mode, which has different cell sizes on the default home screen. Source of equation: http://android-developers.blogspot.com/2009/04/introducing-home-screen-widgets-and.html j On Sat, Jun 13, 2009 at 7:02 PM, Hastaladev...@gmail.com wrote: I use 160*100 but it becomes 3*2 cells. Is this a bug? -- Jeff Sharkey jshar...@android.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Sortable ListView
The Music app can reorder a playlist of songs, and its source code is available. It might take a little bit of digging since it's intertwined with Music-specific code, but here are the important parts: TouchInterceptor, which is a custom ListView: http://android.git.kernel.org/?p=platform/packages/apps/Music.git;a=blob;f=src/com/android/music/TouchInterceptor.java;hb=cupcake http://android.git.kernel.org/?p=platform/packages/apps/Music.git;a=blob;f=res/layout/media_picker_activity.xml;hb=cupcake TrackBrowserActivity, which uses TouchInterceptor. In particular, mEditMode is what enables the reorder mode: http://android.git.kernel.org/?p=platform/packages/apps/Music.git;a=blob;f=src/com/android/music/TrackBrowserActivity.java;hb=cupcake Hope this helps. j On Mon, Jun 15, 2009 at 3:10 PM, Walterwhri...@gmail.com wrote: Has anyone been able to create a sortable ListView (one where you can drag items around to change their order)? -- Jeff Sharkey jshar...@android.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: BroadcastReceiver not able to receive events
You need to resolve the Java variable names to their actual String constants when inserting into XML. For example, the below Java variable resolves to the actual string android.intent.action.MEDIA_MOUNTED which is what you would use in the intent-filter. http://d.android.com/reference/android/content/Intent.html#ACTION_MEDIA_MOUNTED j On Sun, Jun 14, 2009 at 11:34 PM, jonathantopcod...@gmail.com wrote: I have created a BroadcastReceiver to detect SDCard mount and unmount event, however, I am not able to receive any events at all: here's the androidmanifest.xml: receiver android:enabled=true android:label=SDCardMountReceiver android:exported=true android:name=xxx.broadcasts.SDCardBroadcastReceiver intent-filter action android:name=android.content.Intent.ACTION_MEDIA_MOUNTED/action action android:name=android.content.Intent.ACTION_MEDIA_UNMOUNTED / /intent-filter /receiver SDCardMountReceiver class: public class SDCardBroadcastReceiver extends BroadcastReceiver { public SDCardBroadcastReceiver(){ super(); System.err.println(constructor); } public void onReceive(Context context, Intent intent) { Log.d(SDCardBroadCastReceiver, receive +intent.getAction()); System.err.println(jonathan receive +intent.getAction()); } } -- Jeff Sharkey jshar...@android.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Changing the application icon at runtime?
Actually, it totally can take focus. :) The forecast widget I wrote can be selected and clicked using the trackball: http://code.google.com/p/android-sky/source/browse/trunk/Sky/res/layout/widget_med.xml You may need to use tricks like android:duplicateParentState to correctly show drawable states in children views. j On Thu, Jun 11, 2009 at 4:24 AM, Tom Gibaram...@tomgibara.com wrote: I just want to add that one thing about this: a widget can't take focus or otherwise be operated via the trackball, that might prove an irritation for some users. Tom. 2009/6/11 Jeff Sharkey jshar...@android.com Changing icons dynamically still isn't possible. However, you can now write an AppWidget the size and shape of an icon that dynamically changes. j On Wed, Jun 10, 2009 at 12:24 AM, toff...@gmail.comtoff...@gmail.com wrote: Hi, I'm also trying to find out if this is possible to do. Anyone who knows? / Toffer On 9 Juni, 14:58, pehrlo pehr.hans...@gmail.com wrote: Does somebody know if this is possibly in 1.5? From: hackbod hack...@gmail.com Date: 19 Okt 2008, 20:06 Subject: How can the app icon be changed at runtime To: Android Developers Sorry, application icons can't be changed dynamically in 1.0. On Oct 18, 8:10 am, omni dbk...@gmail.com wrote: I'd like to be able to change the applicationiconatruntime; either by providing a completely new image, or by applying badgest to the existingicon. Can't seem to find a way to do it that actually works, and group search only reveals posts about changing views in an activity.- Dölj citerad text - - Visa citerad text - -- Jeff Sharkey jshar...@android.com -- Jeff Sharkey jshar...@android.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Hide application in Home dinamically
You can try PackageManager#setComponentEnabledSetting(), though I have not tried this personally. Yep this should work perfectly. In fact, it's how the Email app hides/shows itself in Share lists across the system dynamically, based on if you have an account setup. -- Jeff Sharkey jshar...@android.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---