[android-developers] Supporting ClientCertificates in Android Webview for 4.4
Hi, My app needs to support Client Certificate authentication from my Webview. Until 4.3 , i could do it by accessing internal APIs for onReceivedClientCertRequest() But in 4.4 it seems that the Browser implementation has changed to Chromium browser which has removed the classback for Client certificates. Is there any way to support Client Certificates on Kitkat OS ? -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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.
[android-developers] Contact shows as part of Groups Tab and not
I create a group programatically as private void createGroup() { ArrayListContentProviderOperation ops = new ArrayListContentProviderOperation(); ops.add(ContentProviderOperation .newInsert(ContactsContract.Groups.CONTENT_URI) .withValue(ContactsContract.Groups.TITLE, SRI).build()); try { getContentResolver().applyBatch(ContactsContract.AUTHORITY, ops); } catch (Exception e) { Log.e(Error, e.toString()); } } If i try to add a contact group in this manner(manually/programatically) on Samsung Europa (Galaxy5), it succeeds, but if i Add a contact and link to this group, the contact does not show in Contacts Tab but only in Groups tab under that group. If i remove the Contact from that group, then it shows under contacts tab.Why is this happening ? Regards, Alok -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email 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: Programatically adding a contact issue
Hello.. Anybody there :) Please let me know if you have an answer :) On Tue, Nov 22, 2011 at 3:28 PM, Alok Kulkarni kulsu...@gmail.com wrote: Hi all, I am developing a Backup restore app for contacts.There is this device HTC Desire which has Birthday and Anniversary Fields which are not present on my devices.For each field i apply ContentProviderOperation.newInsert() and finally ContentProviderResult[] res = contentResolver.applyBatch( ContactsContract.AUTHORITY, valueArray); I need to know which fields were inserted correctly like if a Device does not have a Birthday field in Contact , i shd understand that.How do i come to know whether a certain field was inserted correctly or not. Another way is to find out at runtime which all fields of Contacts are present on a device.Is there any way to find that out ? Please let me know your thoughts. Regards, Alok -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Programatically adding a contact issue
Hi all, I am developing a Backup restore app for contacts.There is this device HTC Desire which has Birthday and Anniversary Fields which are not present on my devices.For each field i apply ContentProviderOperation.newInsert() and finally ContentProviderResult[] res = contentResolver.applyBatch( ContactsContract.AUTHORITY, valueArray); I need to know which fields were inserted correctly like if a Device does not have a Birthday field in Contact , i shd understand that.How do i come to know whether a certain field was inserted correctly or not. Another way is to find out at runtime which all fields of Contacts are present on a device.Is there any way to find that out ? Please let me know your thoughts. Regards, Alok -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email 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: Weird behavior when two applications with Similar Package names are installed
Solved: I was using an internal Broadcast mechanism for starting activity and displaying toasts.Both applications had the same Action name :) So both applications were receiving the broadcasts ... On 8/4/11, Alok Kulkarni kulsu...@gmail.com wrote: HI, I have written an app with base package as say a.b.c and for having multiple APKs to be installed at same time i create another project with base package as a.b.c.d.Both apps are signed with the same Release Key When i have both apps installed, sometimes calling an activity from 1st project launches activity from 2nd project. This one is also happening for a toast that i show. What can be the problem? Any guesses ? Thanks, Alok -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Weird behavior when two applications with Similar Package names are installed
HI, I have written an app with base package as say a.b.c and for having multiple APKs to be installed at same time i create another project with base package as a.b.c.d.Both apps are signed with the same Release Key When i have both apps installed, sometimes calling an activity from 1st project launches activity from 2nd project. This one is also happening for a toast that i show. What can be the problem? Any guesses ? Thanks, Alok -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Disable Specific Cell Boadcasts
Hi, I wish to disable Cell Broadcasts for Advertisements in my app. The ISms AIDL has the disableCellBroadcast with messageIdentifier as the parameter. I went through the 3GPP TS 23.041 doc and also searched the net but could not find Message Identifier for Advertisements. Can anyone help me with this one ? -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Calendar Backup/Restore Related Guidance
Hi, I want to write an application which backs up the default calendar on the phone. My question is what all fields should i backup.Looking at the Calendars /Events/EventsRawTimes/Instances/Attendees/Reminders/CalendarAlerts tables there are lots of columns .And according to manufacturer some columns might be present or not. So for say case 1 Backup from 1st Android and restore on same Android and case 2 Backup from 1st Android and restore on 2nd Android What are the minimum things if backed up are enough ? Thanks, Alok -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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] Calendar Backup/Restore Related Guidance
Oh ok thanks a lot Mark.. :) On Tue, Jul 26, 2011 at 4:45 PM, Mark Murphy mmur...@commonsware.com wrote: On Tue, Jul 26, 2011 at 5:54 AM, Alok Kulkarni kulsu...@gmail.com wrote: I want to write an application which backs up the default calendar on the phone. If you wish to back up a user's Google Calendar, use the Google Calendar GData API. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Android Training in NYC: http://marakana.com/training/android/ -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] CD installer for my Android application Permissions
I want to create a CD installer for my Android application. I want to use adb.exe and AdbWinApi.dll in my Windows application. Can i use this directly internally in my app or i need to consider Licensing for Android here? I want to create something similar to Android Injector -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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] CD installer for my Android application Permissions
Ok . thanks for the info Mark.As i read the license http://www.apache.org/licenses/LICENSE-2.0.txt, in Point 4 , they have mentioned regarding Redistribution of the Work, By that does it mean that if i make say adb install xyz.apk calls from my app i need to make that file openSource with Apache license included ? Please let me know if you can help me with that.. :) On Mon, Jul 11, 2011 at 4:49 PM, Mark Murphy mmur...@commonsware.com wrote: On Mon, Jul 11, 2011 at 7:14 AM, Alok Kulkarni kulsu...@gmail.com wrote: I want to create a CD installer for my Android application. I want to use adb.exe and AdbWinApi.dll in my Windows application. Can i use this directly internally in my app or i need to consider Licensing for Android here? The tools are under the Apache License 2.0. Manufacturer USB drivers, however, are not, so be certain that you are abiding by the appropriate distribution terms for those. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy _Android Programming Tutorials_ Version 3.5 Available! -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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] CD installer for my Android application Permissions
haha.. I will go into the legalities of the stuff myself ;) Sorry for the trouble... Thanks, Alok On Mon, Jul 11, 2011 at 5:55 PM, Mark Murphy mmur...@commonsware.com wrote: On Mon, Jul 11, 2011 at 7:43 AM, Alok Kulkarni kulsu...@gmail.com wrote: Ok . thanks for the info Mark.As i read the license http://www.apache.org/licenses/LICENSE-2.0.txt, in Point 4 , they have mentioned regarding Redistribution of the Work, By that does it mean that if i make say adb install xyz.apk calls from my app i need to make that file openSource with Apache license included ? I am not a lawyer, nor do I play one on TV. You really should get qualified legal counsel to answer licensing questions. That being said, forking a process to run commands is not usually considered making a derivative work. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy _Android Programming Tutorials_ Version 3.5 Available! -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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] Get the virtual keyboard set by user
Thanks Trung for your clarification :) On Thu, Jun 23, 2011 at 9:09 PM, Trung Liem Vo lie...@gmail.com wrote: Hi owner, I is impossible. I was tried to catch the event keyboard but It is not success. Thanks, Liem -Original Message- From: android-developers@googlegroups.com [mailto:android-developers@googlegroups.com] On Behalf Of Alok Kulkarni Sent: Thursday, June 23, 2011 9:59 PM To: android-developers@googlegroups.com Subject: [android-developers] Get the virtual keyboard set by user Hi all. Can we programatically come to know whether Android keyboard is currently being used by the user or not? This requirement arises from the need of popping up Numeric keypad as default and then user can switch to Alphanumeric keypad .This is possible using editText.setRawInputType(Configuration.KEYBOARD_QWERTY) but only if keyboard is set as Android Keyboard Thanks, Alok. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Get the virtual keyboard set by user
Hi all. Can we programatically come to know whether Android keyboard is currently being used by the user or not? This requirement arises from the need of popping up Numeric keypad as default and then user can switch to Alphanumeric keypad .This is possible using editText.setRawInputType(Configuration.KEYBOARD_QWERTY) but only if keyboard is set as Android Keyboard Thanks, Alok. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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: Force Close on Click in Calendar after i delete all information set in it
Thanks all for your vauable inputs,@Dianne I understood all ur points,I don't have much options but i will hv to take care device wise(That looks impossible considering the 100's of different devices pouring in everyday) .. :) @TreKing, i will go thru the Google Calendar APIs.. Thanks, Alok On Tue, May 3, 2011 at 3:58 AM, Dianne Hackborn hack...@android.com wrote: maxSdkVersion won't give you a full guarantee of this -- it will tell Market to hide it from the newer platform versions if someone is trying to install it, but you should expect to still end up running on newer versions due to people installing it on an older version and then getting a platform update to the newer version. On Mon, May 2, 2011 at 6:20 PM, Jens dunkingbikk...@gmail.com wrote: It's especially problematic if you're trying to work with closed source, such as Android 3.0 - you should consider setting maxSdkVersion to prevent people from seeing your app on 3.0. On 2 Maj, 15:34, Dianne Hackborn hack...@android.com wrote: You can expect individual devices to behave differently when you are using private APIs like these, regardless of platform version. Writing code like this is going to be a continual source of trouble for you. On Mon, May 2, 2011 at 4:36 AM, Alok Kulkarni kulsu...@gmail.com wrote: Hi All, I am trying to remove all Calendar related entries from a phone(Galaxy tab) Here is the code /** * Deletes all calendar info */ private boolean _deleteCalendarInfo() { try { String uriPrefix; if (Build.VERSION.SDK_INT = Build.VERSION_CODES.ECLAIR_MR1) { uriPrefix = content://calendar/; } else { uriPrefix = content://com.android.calendar/; } int cnt = contentResolver.delete(Uri.parse(uriPrefix + events), null, null); Log.i(Data Wipe,Calendar events deleted Count +cnt); contentResolver.delete(Uri.parse(uriPrefix + calendars), null, null); Log.i(Data Wipe,Calendars events deleted Count +cnt); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); Log.i(Data Wipe,Calendar delete failed+e.toString()); return false; } return true; } The code executes successfully, but after that when i go into calendar manually and try to add an event, it is giving force close with following error android.database.CursorIndexOutOfBoundsException: Index 0 requested, with a size of 0 Detailed stack trace:- 05-02 14:02:08.077: ERROR/AndroidRuntime(3412): Caused by: android.database.CursorIndexOutOfBoundsException: Index 0 requested, with a size of 0 05-02 14:02:08.077: ERROR/AndroidRuntime(3412): at android.database.AbstractCursor.checkPosition(AbstractCursor.java:580) 05-02 14:02:08.077: ERROR/AndroidRuntime(3412): at android.database.AbstractWindowedCursor.checkPosition(AbstractWindowedCursor.java:214) 05-02 14:02:08.077: ERROR/AndroidRuntime(3412): at android.database.AbstractWindowedCursor.getInt(AbstractWindowedCursor.java:84) 05-02 14:02:08.077: ERROR/AndroidRuntime(3412): at android.database.CursorWrapper.getInt(CursorWrapper.java:123) 05-02 14:02:08.077: ERROR/AndroidRuntime(3412): at com.android.calendar.EditEvent.setCalendarData(EditEvent.java:4098) 05-02 14:02:08.077: ERROR/AndroidRuntime(3412): at com.android.calendar.EditEvent.onCreate(EditEvent.java:2333) 05-02 14:02:08.077: ERROR/AndroidRuntime(3412): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047) 05-02 14:02:08.077: ERROR/AndroidRuntime(3412): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627) 05-02 14:02:08.077: ERROR/AndroidRuntime(3412): ... 11 more I have probably found what the problem is on Stack Overflow.It states Query is returning 0 rows, which is why you are getting an error attempting to use the 1st row of a 0-row Cursor Is there any better way to Delete all calendar info ? Thanks, Alok -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Dianne Hackborn Android framework engineer
[android-developers] Force Close on Click in Calendar after i delete all information set in it
Hi All, I am trying to remove all Calendar related entries from a phone(Galaxy tab) Here is the code /** * Deletes all calendar info */ private boolean _deleteCalendarInfo() { try { String uriPrefix; if (Build.VERSION.SDK_INT = Build.VERSION_CODES.ECLAIR_MR1) { uriPrefix = content://calendar/; } else { uriPrefix = content://com.android.calendar/; } int cnt = contentResolver.delete(Uri.parse(uriPrefix + events), null, null); Log.i(Data Wipe,Calendar events deleted Count +cnt); contentResolver.delete(Uri.parse(uriPrefix + calendars), null, null); Log.i(Data Wipe,Calendars events deleted Count +cnt); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); Log.i(Data Wipe,Calendar delete failed+e.toString()); return false; } return true; } The code executes successfully, but after that when i go into calendar manually and try to add an event, it is giving force close with following error android.database.CursorIndexOutOfBoundsException: Index 0 requested, with a size of 0 Detailed stack trace:- 05-02 14:02:08.077: ERROR/AndroidRuntime(3412): Caused by: android.database.CursorIndexOutOfBoundsException: Index 0 requested, with a size of 0 05-02 14:02:08.077: ERROR/AndroidRuntime(3412): at android.database.AbstractCursor.checkPosition(AbstractCursor.java:580) 05-02 14:02:08.077: ERROR/AndroidRuntime(3412): at android.database.AbstractWindowedCursor.checkPosition(AbstractWindowedCursor.java:214) 05-02 14:02:08.077: ERROR/AndroidRuntime(3412): at android.database.AbstractWindowedCursor.getInt(AbstractWindowedCursor.java:84) 05-02 14:02:08.077: ERROR/AndroidRuntime(3412): at android.database.CursorWrapper.getInt(CursorWrapper.java:123) 05-02 14:02:08.077: ERROR/AndroidRuntime(3412): at com.android.calendar.EditEvent.setCalendarData(EditEvent.java:4098) 05-02 14:02:08.077: ERROR/AndroidRuntime(3412): at com.android.calendar.EditEvent.onCreate(EditEvent.java:2333) 05-02 14:02:08.077: ERROR/AndroidRuntime(3412): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047) 05-02 14:02:08.077: ERROR/AndroidRuntime(3412): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627) 05-02 14:02:08.077: ERROR/AndroidRuntime(3412): ... 11 more I have probably found what the problem is on Stack Overflow.It states Query is returning 0 rows, which is why you are getting an error attempting to use the 1st row of a 0-row Cursor Is there any better way to Delete all calendar info ? Thanks, Alok -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email 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: Delete Emails programatically
Answer 2 :- Not possible. Change account password if u want noone else to get the access. On 2/8/11, Alok Kulkarni kulsu...@gmail.com wrote: Ok i got my first answer.Deleting a non primary account also deleted the associated mails with that account. Thanks, Alok On Tue, Feb 8, 2011 at 12:20 PM, Alok Kulkarni kulsu...@gmail.com wrote: Any answers ??? On Mon, Feb 7, 2011 at 7:55 PM, Alok Kulkarni kulsu...@gmail.com wrote: Hi, I am trying to delete all the mails of an existing account .Is that possible? When i tried to delete the accounts on the phone , i saw that i could delete all the accounts programatically except the primary account which i know that can be deleted only on phone reset.(In program i get false return value for the AccountManagerCallback)So it seems impossible to delete mails as the mails are loaded as and when needed for the account. So following are my questions. 1 ) Can we delete all the mails on the device of the non primary Email account? 2)Is there any way to delete the primary mail account programatically ? Thanks , Alok. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email 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: Delete Emails programatically
Ok i got my first answer.Deleting a non primary account also deleted the associated mails with that account. Thanks, Alok On Tue, Feb 8, 2011 at 12:20 PM, Alok Kulkarni kulsu...@gmail.com wrote: Any answers ??? On Mon, Feb 7, 2011 at 7:55 PM, Alok Kulkarni kulsu...@gmail.com wrote: Hi, I am trying to delete all the mails of an existing account .Is that possible? When i tried to delete the accounts on the phone , i saw that i could delete all the accounts programatically except the primary account which i know that can be deleted only on phone reset.(In program i get false return value for the AccountManagerCallback)So it seems impossible to delete mails as the mails are loaded as and when needed for the account. So following are my questions. 1 ) Can we delete all the mails on the device of the non primary Email account? 2)Is there any way to delete the primary mail account programatically ? Thanks , Alok. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Delete Emails programatically
Hi, I am trying to delete all the mails of an existing account .Is that possible? When i tried to delete the accounts on the phone , i saw that i could delete all the accounts programatically except the primary account which i know that can be deleted only on phone reset.(In program i get false return value for the AccountManagerCallback)So it seems impossible to delete mails as the mails are loaded as and when needed for the account. So following are my questions. 1 ) Can we delete all the mails on the device of the non primary Email account? 2)Is there any way to delete the primary mail account programatically ? Thanks , Alok. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email 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: Delete Emails programatically
Any answers ??? On Mon, Feb 7, 2011 at 7:55 PM, Alok Kulkarni kulsu...@gmail.com wrote: Hi, I am trying to delete all the mails of an existing account .Is that possible? When i tried to delete the accounts on the phone , i saw that i could delete all the accounts programatically except the primary account which i know that can be deleted only on phone reset.(In program i get false return value for the AccountManagerCallback)So it seems impossible to delete mails as the mails are loaded as and when needed for the account. So following are my questions. 1 ) Can we delete all the mails on the device of the non primary Email account? 2)Is there any way to delete the primary mail account programatically ? Thanks , Alok. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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] Problem with adjustPan andadjustResize
Thanks a lot for ur responses.I will try that out and update. Regards, Alok. On Sat, Jan 22, 2011 at 3:16 AM, Dianne Hackborn hack...@android.com wrote: You can not mix adjustPan and adjustResize. It is one or the other. If your window can resize to accommodate the IME, you should use adjustResize. That said, these would have nothing to do with whether a text view would actually receive input. On Fri, Jan 21, 2011 at 6:09 AM, Alok Kulkarni kulsu...@gmail.com wrote: Hi. i am having an activity in which i am adding controls such as EditText and TextView at runtime in a listiiew. What happens is that for the Edittext the keyboard pops up and the controls at the bottom of the screen are not visible even when i scroll down.So when i add the property android:windowSoftInputMode=stateVisible|adjustResize|adjustPan , things work.But suddenly i face the issue that i cannot type in the edit text pressing the keyboard.The focus automatically goes out of the EditText while typing on the keyboard.I have tried this on Devices like Nexus S , Moto Cliq . Both have the same problem.Any ideas. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Dianne Hackborn Android framework engineer hack...@android.com Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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] Problem with adjustPan andadjustResize
@Dianne , If i use adjustResize only then it works on most of the devices, its observed that on an EditText keyboard comes up but the focus of the Edittext goes and user has to click again on the Edittext, which is not natural behaviour. If i use adjustPan only , then the screen does not scroll to the bottom when SoftKeyboard is open. When both are given , then worked fine on a few devices like Samsung Europa but on most of the devices either of the issues mentioned above was observed. Regards, Alok. On Tue, Jan 25, 2011 at 2:11 PM, Alok Kulkarni kulsu...@gmail.com wrote: Thanks a lot for ur responses.I will try that out and update. Regards, Alok. On Sat, Jan 22, 2011 at 3:16 AM, Dianne Hackborn hack...@android.com wrote: You can not mix adjustPan and adjustResize. It is one or the other. If your window can resize to accommodate the IME, you should use adjustResize. That said, these would have nothing to do with whether a text view would actually receive input. On Fri, Jan 21, 2011 at 6:09 AM, Alok Kulkarni kulsu...@gmail.com wrote: Hi. i am having an activity in which i am adding controls such as EditText and TextView at runtime in a listiiew. What happens is that for the Edittext the keyboard pops up and the controls at the bottom of the screen are not visible even when i scroll down.So when i add the property android:windowSoftInputMode=stateVisible|adjustResize|adjustPan , things work.But suddenly i face the issue that i cannot type in the edit text pressing the keyboard.The focus automatically goes out of the EditText while typing on the keyboard.I have tried this on Devices like Nexus S , Moto Cliq . Both have the same problem.Any ideas. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Dianne Hackborn Android framework engineer hack...@android.com Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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] Problem with adjustPan andadjustResize
One thing i am doing is adding Edittexts defined in XML to a ListView at runtime according to number of fields.Is that causing the problem ? On Tue, Jan 25, 2011 at 2:33 PM, Dianne Hackborn hack...@android.com wrote: Using adjustResize does not cause an edit text to lose focus in any way. The only thing it does is cause your UI to relayout for the new window size. I don't know what you are doing, but the vast majority of applications you interact with just use adjustResize with a regular view hierarchy, and they work fine. On Tue, Jan 25, 2011 at 12:50 AM, Alok Kulkarni kulsu...@gmail.com wrote: @Dianne , If i use adjustResize only then it works on most of the devices, its observed that on an EditText keyboard comes up but the focus of the Edittext goes and user has to click again on the Edittext, which is not natural behaviour. If i use adjustPan only , then the screen does not scroll to the bottom when SoftKeyboard is open. When both are given , then worked fine on a few devices like Samsung Europa but on most of the devices either of the issues mentioned above was observed. Regards, Alok. On Tue, Jan 25, 2011 at 2:11 PM, Alok Kulkarni kulsu...@gmail.com wrote: Thanks a lot for ur responses.I will try that out and update. Regards, Alok. On Sat, Jan 22, 2011 at 3:16 AM, Dianne Hackborn hack...@android.com wrote: You can not mix adjustPan and adjustResize. It is one or the other. If your window can resize to accommodate the IME, you should use adjustResize. That said, these would have nothing to do with whether a text view would actually receive input. On Fri, Jan 21, 2011 at 6:09 AM, Alok Kulkarni kulsu...@gmail.com wrote: Hi. i am having an activity in which i am adding controls such as EditText and TextView at runtime in a listiiew. What happens is that for the Edittext the keyboard pops up and the controls at the bottom of the screen are not visible even when i scroll down.So when i add the property android:windowSoftInputMode=stateVisible|adjustResize|adjustPan , things work.But suddenly i face the issue that i cannot type in the edit text pressing the keyboard.The focus automatically goes out of the EditText while typing on the keyboard.I have tried this on Devices like Nexus S , Moto Cliq . Both have the same problem.Any ideas. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Dianne Hackborn Android framework engineer hack...@android.com Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Dianne Hackborn Android framework engineer hack...@android.com Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Problem with adjustPan andadjustResize
Hi. i am having an activity in which i am adding controls such as EditText and TextView at runtime in a listiiew. What happens is that for the Edittext the keyboard pops up and the controls at the bottom of the screen are not visible even when i scroll down.So when i add the property android:windowSoftInputMode=stateVisible|adjustResize|adjustPan , things work.But suddenly i face the issue that i cannot type in the edit text pressing the keyboard.The focus automatically goes out of the EditText while typing on the keyboard.I have tried this on Devices like Nexus S , Moto Cliq . Both have the same problem.Any ideas. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Create Folder for Specific SMSes
Any answers ??? Thanks, Alok. On Wed, Jan 5, 2011 at 6:58 PM, Alok Kulkarni kulsu...@gmail.com wrote: Hi guys, I searched the forums but could not find a satisfactory solution.Can i create a seperate folder at the SMS root level in android and filter SMSes coming to Inbox to get diverted to this new folder ? Thanks , Alok -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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: Create Folder for Specific SMSes
I am creating antivirus app .So its not possible to sort out messages that can be spam or the ones that i wish to ignore ? On Thu, Jan 6, 2011 at 6:58 PM, Kumar Bibek coomar@gmail.com wrote: No you cant. The SMS apis is not public, specifically those related to their storage. Morever, smses are stored in a table and not in a folder structure. Kumar Bibek http://techdroid.kbeanie.com http://www.kbeanie.com On Thu, Jan 6, 2011 at 6:53 PM, Alok Kulkarni kulsu...@gmail.com wrote: Any answers ??? Thanks, Alok. On Wed, Jan 5, 2011 at 6:58 PM, Alok Kulkarni kulsu...@gmail.com wrote: Hi guys, I searched the forums but could not find a satisfactory solution.Can i create a seperate folder at the SMS root level in android and filter SMSes coming to Inbox to get diverted to this new folder ? Thanks , Alok -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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: Create Folder for Specific SMSes
Got the short answer its not possible. You might be able to make it work for a few devices, but it will not work reliably for all devices.. Becuase, the SMS content provider apis are not public, and most of the manufacturers create their own implementations not most ( but quite a few) http://techdroid.kbeanie.com/2009/09/sms-blocking-in-android.html On Thu, Jan 6, 2011 at 7:13 PM, Alok Kulkarni kulsu...@gmail.com wrote: I am creating antivirus app .So its not possible to sort out messages that can be spam or the ones that i wish to ignore ? On Thu, Jan 6, 2011 at 6:58 PM, Kumar Bibek coomar@gmail.com wrote: No you cant. The SMS apis is not public, specifically those related to their storage. Morever, smses are stored in a table and not in a folder structure. Kumar Bibek http://techdroid.kbeanie.com http://www.kbeanie.com On Thu, Jan 6, 2011 at 6:53 PM, Alok Kulkarni kulsu...@gmail.com wrote: Any answers ??? Thanks, Alok. On Wed, Jan 5, 2011 at 6:58 PM, Alok Kulkarni kulsu...@gmail.com wrote: Hi guys, I searched the forums but could not find a satisfactory solution.Can i create a seperate folder at the SMS root level in android and filter SMSes coming to Inbox to get diverted to this new folder ? Thanks , Alok -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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: Create Folder for Specific SMSes
thanks to Bibek. On Thu, Jan 6, 2011 at 8:28 PM, Alok Kulkarni kulsu...@gmail.com wrote: Got the short answer its not possible. You might be able to make it work for a few devices, but it will not work reliably for all devices.. Becuase, the SMS content provider apis are not public, and most of the manufacturers create their own implementations not most ( but quite a few) http://techdroid.kbeanie.com/2009/09/sms-blocking-in-android.html On Thu, Jan 6, 2011 at 7:13 PM, Alok Kulkarni kulsu...@gmail.com wrote: I am creating antivirus app .So its not possible to sort out messages that can be spam or the ones that i wish to ignore ? On Thu, Jan 6, 2011 at 6:58 PM, Kumar Bibek coomar@gmail.com wrote: No you cant. The SMS apis is not public, specifically those related to their storage. Morever, smses are stored in a table and not in a folder structure. Kumar Bibek http://techdroid.kbeanie.com http://www.kbeanie.com On Thu, Jan 6, 2011 at 6:53 PM, Alok Kulkarni kulsu...@gmail.com wrote: Any answers ??? Thanks, Alok. On Wed, Jan 5, 2011 at 6:58 PM, Alok Kulkarni kulsu...@gmail.com wrote: Hi guys, I searched the forums but could not find a satisfactory solution.Can i create a seperate folder at the SMS root level in android and filter SMSes coming to Inbox to get diverted to this new folder ? Thanks , Alok -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Create Folder for Specific SMSes
Hi guys, I searched the forums but could not find a satisfactory solution.Can i create a seperate folder at the SMS root level in android and filter SMSes coming to Inbox to get diverted to this new folder ? Thanks , Alok -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email 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: Detect Codec of local media File
Seems everyone is busy with new year party :P:P Anyways Happy New Year to all Android developers.. Have a rocking year ahead !!! Thanks , Alok. On Fri, Dec 31, 2010 at 12:50 PM, Alok Kulkarni kulsu...@gmail.com wrote: Hi, I am streaming local audio and video files of a mobile device to another android devce using FFMpeg. Is there a way to detect/ know the Codec format of the file programatically as it needs to be passed to FFMpeg. I am using the Media Scanning logic of ContentProvider ( MediaStore.Audio.Media and MediaStore.Video.Media). The table does not contain any column for getting Codec information. Thanks And Regards , Alok -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Detect Codec of local media File
Hi, I am streaming local audio and video files of a mobile device to another android devce using FFMpeg. Is there a way to detect/ know the Codec format of the file programatically as it needs to be passed to FFMpeg. I am using the Media Scanning logic of ContentProvider ( MediaStore.Audio.Media and MediaStore.Video.Media). The table does not contain any column for getting Codec information. Thanks And Regards , Alok -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email 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 related with EditText used in Listview
The solution worked for me. Only thing to was to add following code in getView if (attitude_values[position] != null) { holder.TextEntry.setText(attitude_values[position]); } else { holder.TextEntry.setText(); } On Tue, Dec 14, 2010 at 11:28 PM, Alok Kulkarni kulsu...@gmail.com wrote: Apparently , i found this link http://stackoverflow.com/questions/4358342/edittext-in-a-list-arent-working-the-way-they-should Ill chech if this works, Thanks, Alok On 12/14/10, Alok Kulkarni kulsu...@gmail.com wrote: I am using a ListView wherein my listitem.xml contains a TextView and an EditText. If my list length increases and it becomes scrollable then the value which the user had entered in the first EditText in listitem#0 gets reflected in the listitem which has become visible now due to scrolling, for example: if initially listitems 0 to 6 were visible and user enetered abc text in the EditText in listitem#0 then when i scroll just one position down, I see text abc in the EditText in listitem#7 Can someone plz help me out with this? Thanks. Regards, Alok. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Problem related with EditText used in Listview
I am using a ListView wherein my listitem.xml contains a TextView and an EditText. If my list length increases and it becomes scrollable then the value which the user had entered in the first EditText in listitem#0 gets reflected in the listitem which has become visible now due to scrolling, for example: if initially listitems 0 to 6 were visible and user enetered abc text in the EditText in listitem#0 then when i scroll just one position down, I see text abc in the EditText in listitem#7 Can someone plz help me out with this? Thanks. Regards, Alok. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email 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 related with EditText used in Listview
Apparently , i found this link http://stackoverflow.com/questions/4358342/edittext-in-a-list-arent-working-the-way-they-should Ill chech if this works, Thanks, Alok On 12/14/10, Alok Kulkarni kulsu...@gmail.com wrote: I am using a ListView wherein my listitem.xml contains a TextView and an EditText. If my list length increases and it becomes scrollable then the value which the user had entered in the first EditText in listitem#0 gets reflected in the listitem which has become visible now due to scrolling, for example: if initially listitems 0 to 6 were visible and user enetered abc text in the EditText in listitem#0 then when i scroll just one position down, I see text abc in the EditText in listitem#7 Can someone plz help me out with this? Thanks. Regards, Alok. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Problem passing Unicode string through JSON request
Hi, I am having a unicode string \u3403 which is actualy some japansee character I want to pass it through a JSON object. So i put the value as say String str = \u3403 jsonObject.put(name,str); When i do this the json object internally adds another escape sequence as \\u3403, and the request string has two \ slashes. This is interpreted wrongly by the server as it does not detect unicode name. What can i do for this ? Thanks, Alok. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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] Problem passing Unicode string through JSON request
Thanks Daniel for your response, In my app, the user enters a name in japanese language which is to be sent to server in a JSON request.The server expects the name parameter in form of a UTF-8 encoded string. So the encoding of source code should not matter.Here is the sample code public static String EncodeJson(String strJson) { try { String strHex = null; for (int i = 0; i strJson.length(); i++) { try{ //char c = strJson.charAt(i); // int j = (int) c; // System.out.println(ASCII OF +c + = + j + .); //System.out.println(strJson.charAt(i), 10= +Integer.parseInt(+strJson.charAt(i), 10)); if ( strJson.charAt(i) = 126) { String start = strJson.substring(0, i); String end = strJson.substring(i + 1); int jsonChar = strJson.charAt(i); // new string(strJson[i], 1); strHex = 000 + Integer.toHexString(jsonChar); strHex = strHex.toUpperCase(); strJson = start + \\u + strHex.substring(strHex.length()-4)+ end; i += 5; } }catch(Exception e){ System.out.println( Exception - strJson.charAt(i)= +strJson.charAt(i)); } } return strJson; } catch (Exception ex) { Log.i(Encode, ex.toString()); return strJson; } } The output of this method is passed to JSON object using its put method.At this point an additional \ gets added to the parameter due to which the server does not recognize this as a valid UTF string Thanks, Alok. On Fri, Nov 12, 2010 at 9:07 PM, Daniel Drozdzewski daniel.drozdzew...@gmail.com wrote: On Fri, Nov 12, 2010 at 3:01 PM, Alok Kulkarni kulsu...@gmail.com wrote: Hi, I am having a unicode string \u3403 which is actualy some japansee character I want to pass it through a JSON object. So i put the value as say String str = \u3403 jsonObject.put(name,str); When i do this the json object internally adds another escape sequence as \\u3403, and the request string has two \ slashes. This is interpreted wrongly by the server as it does not detect unicode name. What can i do for this ? Thanks, Alok. Alok, \u3403 is not a unicode string, but a string that has hex code of an unicode character in it. It can be unicode encoded or its encoding can be anything else really. Since \ is a special character and has extra meaning in Java String class, it gets escaped by escape character, which is \. Now you know, what is the extra meaning of \ ;-) Now JSON should not have any problems with parsing such character/string, even when double escaped. Make sure that your server is correctly configured for use of unicode. Also try sending the actual character (paste it from some place that generates a character based on its hex code), but please make sure that your source code is unicode encoded, otherwise it will not work. 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 -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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] Problem passing Unicode string through JSON request
I am using Androids JSON library, The extra \ in the line strJson = start + \\u + strHex.substring(strHex.length()-4)+ end; has to be added as an escape sequence else the code does not compile. I don't understand the need for the EncodeJson function. -Though internally java might be storing as UCS-16, when passing to the web service , the web service expectes the parameter to be in UTF-8 encoded string. Thanks, Alok. On Fri, Nov 12, 2010 at 9:42 PM, Frank Weiss fewe...@gmail.com wrote: \u3403 is not a unicode string, but a string that has hex code of an unicode character in it. It can be unicode encoded or its encoding can be anything else really. Since \ is a special character and has extra meaning in Java String class, it gets escaped by escape character, which is \. Now you know, what is the extra meaning of \ ;-) This is not correct in Java. Strings are stored internally as UCS-16. Therefore, \u3403.length() == 1. However, \\u3403.length() == 6. This can be verified with a simple Java program. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Application Losing Connectivity after 30 minutes (on Wifi)
Thanks for sharing the info mark, i will try it out and post if there are any further issues. Regards, Alok. On Tue, Oct 26, 2010 at 1:03 PM, Mark Murphy mmur...@commonsware.com wrote: You may need a WakeLock and WifiLock, if the device is falling asleep. On Tue, Oct 26, 2010 at 3:28 AM, Alok Kulkarni kulsu...@gmail.com wrote: Hi, I have an application which continuously fetches data from the server , downloads and plays songs ..My app runs on WiFi. After around 30 minutes , the application loses connectivity .. At that point of time if a browser is opened it connects to the internet.. But my app has lost connectivity.If i make explicit requests thru the app by user interaction the connectivity is regained, but automatic disconnection happens many times.. Even if the setting for Wifi always on is set , this this happens.. This issue i observed on HTC Magic and Samsung Europa..Does anyone have an idea why this happends Thanks And Regards, Alok -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Android 2.2 Programming Books: http://commonsware.com/books -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Application Losing Connectivity after 30 minutes (on Wifi)
Hi, I have an application which continuously fetches data from the server , downloads and plays songs ..My app runs on WiFi. After around 30 minutes , the application loses connectivity .. At that point of time if a browser is opened it connects to the internet.. But my app has lost connectivity.If i make explicit requests thru the app by user interaction the connectivity is regained, but automatic disconnection happens many times.. Even if the setting for Wifi always on is set , this this happens.. This issue i observed on HTC Magic and Samsung Europa..Does anyone have an idea why this happends Thanks And Regards, Alok -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Error with DB onUpgrade
Hi, I have multiple databases in my app.At the start of the application , i initialize all the databases and access columns from the required tables.What i did is , for one of the databases i incremented the version of the DB. So now i have started getting error of No Such table say ABCD while compiling query.This table is in another DB than the updated DB. I dont have any code in the onUpgrade right now.. Is there any thing thats striking anyone why this behavior is happening? Is there anything that happens in the onUpgrade method that causes all the DBs to be inaccessable temporarily. I am saying this because if i place a breakpoint in onUpgrade and debug , then i wait for a few seconds on the 1st stmt in onUpgrade and then everything works fine... -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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] Error with DB onUpgrade
No. Actually i am accessing another table from my databases at the same time from another thread while onUpgrade is being called.So i think thats where the problem lies.But i need to figure out a way so that i access the SQL tables after the on Upgrade function completes. On Fri, Oct 22, 2010 at 5:58 PM, Kostya Vasilyev kmans...@gmail.com wrote: AFAIK, there is nothing special, except: - onUpgrade may take some time to run - the tables are not updated until after onUpgrade is done Are you accessing the database in any way bypassing your SQL open helper? Is this what you mean by At the start of the application , i initialize all the databases and access columns from the required tables ? If you're relying on SQL open helper and its onUpgrade, then that should be the only way you're accessing the database. -- Kostya 22.10.2010 15:14, Alok Kulkarni пишет: Hi, I have multiple databases in my app.At the start of the application , i initialize all the databases and access columns from the required tables.What i did is , for one of the databases i incremented the version of the DB. So now i have started getting error of No Such table say ABCD while compiling query.This table is in another DB than the updated DB. I dont have any code in the onUpgrade right now.. Is there any thing thats striking anyone why this behavior is happening? Is there anything that happens in the onUpgrade method that causes all the DBs to be inaccessable temporarily. I am saying this because if i place a breakpoint in onUpgrade and debug , then i wait for a few seconds on the 1st stmt in onUpgrade and then everything works fine... -- Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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] Error with DB onUpgrade
Yeah ill do my best.. My code is too complicated right now... :P One more thing i need to confirm.. After upgrade , all the old databases are deleted right.. So i need to backup all the tables in the onUpgrade and recreate new ones .. Right ? On Fri, Oct 22, 2010 at 6:20 PM, Kostya Vasilyev kmans...@gmail.com wrote: Sounds like this could be it. Can't you just go through SQL open helper for all code paths? -- Kostya 22.10.2010 16:37, Alok Kulkarni пишет: No. Actually i am accessing another table from my databases at the same time from another thread while onUpgrade is being called.So i think thats where the problem lies.But i need to figure out a way so that i access the SQL tables after the on Upgrade function completes. On Fri, Oct 22, 2010 at 5:58 PM, Kostya Vasilyevkmans...@gmail.com wrote: AFAIK, there is nothing special, except: - onUpgrade may take some time to run - the tables are not updated until after onUpgrade is done Are you accessing the database in any way bypassing your SQL open helper? Is this what you mean by At the start of the application , i initialize all the databases and access columns from the required tables ? If you're relying on SQL open helper and its onUpgrade, then that should be the only way you're accessing the database. -- Kostya 22.10.2010 15:14, Alok Kulkarni пишет: Hi, I have multiple databases in my app.At the start of the application , i initialize all the databases and access columns from the required tables.What i did is , for one of the databases i incremented the version of the DB. So now i have started getting error of No Such table say ABCD while compiling query.This table is in another DB than the updated DB. I dont have any code in the onUpgrade right now.. Is there any thing thats striking anyone why this behavior is happening? Is there anything that happens in the onUpgrade method that causes all the DBs to be inaccessable temporarily. I am saying this because if i place a breakpoint in onUpgrade and debug , then i wait for a few seconds on the 1st stmt in onUpgrade and then everything works fine... -- Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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] Error with DB onUpgrade
I am following this http://efreedom.com/Question/1-3505900/SQLiteOpenHelper-OnUpgrade-Confusion-Android What do u mean by saying SQL open helper for all code paths I am using the standard code for public void open() throws SQLException { db = DBHelper.getWritableDatabase(); } The open method is called for each database seperately. On Fri, Oct 22, 2010 at 6:26 PM, Alok Kulkarni kulsu...@gmail.com wrote: Yeah ill do my best.. My code is too complicated right now... :P One more thing i need to confirm.. After upgrade , all the old databases are deleted right.. So i need to backup all the tables in the onUpgrade and recreate new ones .. Right ? On Fri, Oct 22, 2010 at 6:20 PM, Kostya Vasilyev kmans...@gmail.com wrote: Sounds like this could be it. Can't you just go through SQL open helper for all code paths? -- Kostya 22.10.2010 16:37, Alok Kulkarni пишет: No. Actually i am accessing another table from my databases at the same time from another thread while onUpgrade is being called.So i think thats where the problem lies.But i need to figure out a way so that i access the SQL tables after the on Upgrade function completes. On Fri, Oct 22, 2010 at 5:58 PM, Kostya Vasilyevkmans...@gmail.com wrote: AFAIK, there is nothing special, except: - onUpgrade may take some time to run - the tables are not updated until after onUpgrade is done Are you accessing the database in any way bypassing your SQL open helper? Is this what you mean by At the start of the application , i initialize all the databases and access columns from the required tables ? If you're relying on SQL open helper and its onUpgrade, then that should be the only way you're accessing the database. -- Kostya 22.10.2010 15:14, Alok Kulkarni пишет: Hi, I have multiple databases in my app.At the start of the application , i initialize all the databases and access columns from the required tables.What i did is , for one of the databases i incremented the version of the DB. So now i have started getting error of No Such table say ABCD while compiling query.This table is in another DB than the updated DB. I dont have any code in the onUpgrade right now.. Is there any thing thats striking anyone why this behavior is happening? Is there anything that happens in the onUpgrade method that causes all the DBs to be inaccessable temporarily. I am saying this because if i place a breakpoint in onUpgrade and debug , then i wait for a few seconds on the 1st stmt in onUpgrade and then everything works fine... -- Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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] Error with DB onUpgrade
Ok.. thanks One more thing .. Here for the problem i am facing.. IS that i need to take care that i access the tables only after onUpgrade completes execution ? On Fri, Oct 22, 2010 at 6:34 PM, Kostya Vasilyev kmans...@gmail.com wrote: No, onUpgrade doesn't delete any data, tables, or databases. It's just a callback in your code that's called by Android when the desired database version doesn't match the existing database version. Your callback can do whatever it needs to bring the database schema up to date - typically, adding columns or tables. So if your code just does ALTER TABLE ADD COLUMN, you don't need to do anything special to preserve existing data. -- Kostya 22.10.2010 16:56, Alok Kulkarni пишет: Yeah ill do my best.. My code is too complicated right now... :P One more thing i need to confirm.. After upgrade , all the old databases are deleted right.. So i need to backup all the tables in the onUpgrade and recreate new ones .. Right ? On Fri, Oct 22, 2010 at 6:20 PM, Kostya Vasilyevkmans...@gmail.com wrote: Sounds like this could be it. Can't you just go through SQL open helper for all code paths? -- Kostya 22.10.2010 16:37, Alok Kulkarni пишет: No. Actually i am accessing another table from my databases at the same time from another thread while onUpgrade is being called.So i think thats where the problem lies.But i need to figure out a way so that i access the SQL tables after the on Upgrade function completes. On Fri, Oct 22, 2010 at 5:58 PM, Kostya Vasilyevkmans...@gmail.com wrote: AFAIK, there is nothing special, except: - onUpgrade may take some time to run - the tables are not updated until after onUpgrade is done Are you accessing the database in any way bypassing your SQL open helper? Is this what you mean by At the start of the application , i initialize all the databases and access columns from the required tables ? If you're relying on SQL open helper and its onUpgrade, then that should be the only way you're accessing the database. -- Kostya 22.10.2010 15:14, Alok Kulkarni пишет: Hi, I have multiple databases in my app.At the start of the application , i initialize all the databases and access columns from the required tables.What i did is , for one of the databases i incremented the version of the DB. So now i have started getting error of No Such table say ABCD while compiling query.This table is in another DB than the updated DB. I dont have any code in the onUpgrade right now.. Is there any thing thats striking anyone why this behavior is happening? Is there anything that happens in the onUpgrade method that causes all the DBs to be inaccessable temporarily. I am saying this because if i place a breakpoint in onUpgrade and debug , then i wait for a few seconds on the 1st stmt in onUpgrade and then everything works fine... -- Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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] Error with DB onUpgrade
Yeah , thats what probably is the issue.. So i will take a sequential approach over there and update it .. Thanks a lot Kostya.. Regards, Alok. On Fri, Oct 22, 2010 at 6:49 PM, Kostya Vasilyev kmans...@gmail.com wrote: Yes, that's what I meant. Always call getWritableDatabase, and don't call SQLiteDatabase.openDatabase - are you, perhaps, somewhere in your code? In the link you posted, table upgrades are done by renaming the old table and creating a new table from scratch, then copying the data. So there is the time period when the table doesn't exist. Most likely, this is the reason why you're seeing your error. Since you've said that your code is multithreaded, I think what happens is, one thread starts upgrading the database, while another thread starts to make queires, or perhaps tries to perform an upgrade as well. To fix this issue, you need to add thread synchronization around opening the database, to avoid concurrent access until the database has been fully upgraded. -- Kostya 22.10.2010 17:03, Alok Kulkarni пишет: I am following this http://efreedom.com/Question/1-3505900/SQLiteOpenHelper-OnUpgrade-Confusion-Android What do u mean by saying SQL open helper for all code paths I am using the standard code for public void open() throws SQLException { db = DBHelper.getWritableDatabase(); } The open method is called for each database seperately. On Fri, Oct 22, 2010 at 6:26 PM, Alok Kulkarnikulsu...@gmail.com wrote: Yeah ill do my best.. My code is too complicated right now... :P One more thing i need to confirm.. After upgrade , all the old databases are deleted right.. So i need to backup all the tables in the onUpgrade and recreate new ones .. Right ? On Fri, Oct 22, 2010 at 6:20 PM, Kostya Vasilyevkmans...@gmail.com wrote: Sounds like this could be it. Can't you just go through SQL open helper for all code paths? -- Kostya 22.10.2010 16:37, Alok Kulkarni пишет: No. Actually i am accessing another table from my databases at the same time from another thread while onUpgrade is being called.So i think thats where the problem lies.But i need to figure out a way so that i access the SQL tables after the on Upgrade function completes. On Fri, Oct 22, 2010 at 5:58 PM, Kostya Vasilyevkmans...@gmail.com wrote: AFAIK, there is nothing special, except: - onUpgrade may take some time to run - the tables are not updated until after onUpgrade is done Are you accessing the database in any way bypassing your SQL open helper? Is this what you mean by At the start of the application , i initialize all the databases and access columns from the required tables ? If you're relying on SQL open helper and its onUpgrade, then that should be the only way you're accessing the database. -- Kostya 22.10.2010 15:14, Alok Kulkarni пишет: Hi, I have multiple databases in my app.At the start of the application , i initialize all the databases and access columns from the required tables.What i did is , for one of the databases i incremented the version of the DB. So now i have started getting error of No Such table say ABCD while compiling query.This table is in another DB than the updated DB. I dont have any code in the onUpgrade right now.. Is there any thing thats striking anyone why this behavior is happening? Is there anything that happens in the onUpgrade method that causes all the DBs to be inaccessable temporarily. I am saying this because if i place a breakpoint in onUpgrade and debug , then i wait for a few seconds on the 1st stmt in onUpgrade and then everything works fine... -- Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group
[android-developers] Issue of getting keyEvents for device having both hard and soft keyboard.
Hi all, I am developing the application where i want to capture all 'keyEvents' in my code. I used onKeyDown(int keyCode, KeyEvent event) to achieve this. But it has some flaw in it, 1.When i have device with Hardware keyboard, onKeyDown works well with it. But when i use Virtual keyboard it fails. 2. Now if i use device with only Softkeyboard, having no Hardware keyboard, onKeyDown works well with Virtual keyboard. So, my difficulty is to detect the onKeyDown for the device which has got Hardware keyboard user uses the Soft keyboard. Thanks, Alok. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Intent filter to launch an application
Hi, I want to do the following. When a user clicks on a URL containing a few specific keywords like http://ad.mysite.com from somewhere like entering the URL in a to do note in calendar, i want to recognize mysite.com keywords and launch my application instead of browser. I know that the browser activity's manifest file contains a filter to launch it if the keywords http or www are found .So how can i override this behaviour? Thanks, Alok. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email 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 filter to launch an application
Solved the problem. Referred to the Manifest file of Androd Browser. Thanks, Alok. On Wed, Sep 15, 2010 at 4:59 PM, Alok Kulkarni kulsu...@gmail.com wrote: Hi, I want to do the following. When a user clicks on a URL containing a few specific keywords like http://ad.mysite.com from somewhere like entering the URL in a to do note in calendar, i want to recognize mysite.com keywords and launch my application instead of browser. I know that the browser activity's manifest file contains a filter to launch it if the keywords http or www are found .So how can i override this behaviour? Thanks, Alok. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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] ListView ClassCastException
Oh i got the problem.It was incorrectly declared in the layout.Will try the chages now.. Thanks a lot Michael. On Mon, Aug 30, 2010 at 10:47 PM, Michael MacDonald googlec...@antlersoft.com wrote: On 08/30/10 06:59, Alok Kulkarni wrote: Hi all,in my application I have a class as: 1. public class TouchInterceptor extends ListView and my main activity class as: 1. public class GUIEngine extends Activity in this class i initialize my ListView variable as: 1. lView = (ListView) findViewById(R.id.mainList); now i want to set a listener on this lview object which is in my TouchInterceptor class, i do that as: 1. ((TouchInterceptor) lView).setDropListener(mDropListener); but i get a ClassCastException at this line. what am i doing wrong? plzz can anyone help.. thank u -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en How are you creating mainList? If you are doing it with a layout, are you declaring it as a TouchInterceptor in the layout? You can't cast any old object to a derived class of its declared type; you can only downcast if the object was created with the derived class. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] ListView ClassCastException
Hi all,in my application I have a class as: 1. public class TouchInterceptor extends ListView and my main activity class as: 1. public class GUIEngine extends Activity in this class i initialize my ListView variable as: 1. lView = (ListView) findViewById(R.id.mainList); now i want to set a listener on this lview object which is in my TouchInterceptor class, i do that as: 1. ((TouchInterceptor) lView).setDropListener(mDropListener); but i get a ClassCastException at this line. what am i doing wrong? plzz can anyone help.. thank u -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Problem getting width and height of Device programatically for QVGA devices.
Hi all, I want to get the width and height of my device to know what type device it is ie QVGA, HVGA ,WVGA.. Also i need to adjust some layouts according to width and height of the screen. I tried following methods but its not working. 1) 1. /* First, get the Display from the WindowManager */ 2. Display display = ((WindowManager) getSystemService(WINDOW_SERVICE)).getDefaultDisplay(); 3. 4. /* Now we can retrieve all display-related infos */ 5. int width = display.getWidth(); 6. int height = display.getHeight(); 7. int orientation = display.getOrientation(); 2) width = getResources().getDisplayMetrics().widthPixels; height = getResources().getDisplayMetrics().heightPixels; 3) int ht; int wt; DisplayMetrics displaymetrics = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(displaymetrics); ht = displaymetrics.heightPixels; wt = displaymetrics.widthPixels; All these methods return wrong width and height for the 240x320 devices namely Samsung Europa and Alcatel which i have. Width = 320 Height = 240.. This is wierd as some of the critical functionality is getting hampered .. I think this is really a basic thing which shd be correctly provided. Please help me with this issue . Thanks, Alok -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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] Problem getting width and height of Device programatically for QVGA devices.
Ok.. here is what the case is.. I have uses-sdk android:minSdkVersion=3 / in manifest, but i compile the project using Android 2.1 as i have to support few APIs for contacts introduced in 2.1.. So my app is compiled against 2.1 but runs for Android 1.5 as well. 2010/8/23 Kostya Vasilyev kmans...@gmail.com Do you have targetSdk set correctly? It seems like your app runs in compatibility mode, and sees emulated HVGA display parameters. -- Kostya Vasilyev -- http://kmansoft.wordpress.com 23.08.2010 17:51 пользователь Alok Kulkarni kulsu...@gmail.com написал: Hi all, I want to get the width and height of my device to know what type device it is ie QVGA, HVGA ,WVGA.. Also i need to adjust some layouts according to width and height of the screen. I tried following methods but its not working. 1) 1. /* First, get the Display from the WindowManager */ 2. Display display = ((WindowManager) getSystemService(WINDOW_SERVICE)).getDefaultDisplay(); 3. 4. /* Now we can retrieve all display-related infos */ 5. int width = display.getWidth(); 6. int height = display.getHeight(); 7. int orientation = display.getOrientation(); 2) width = getResources().getDisplayMetrics().widthPixels; height = getResources().getDisplayMetrics().heightPixels; 3) int ht; int wt; DisplayMetrics displaymetrics = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(displaymetrics); ht = displaymetrics.heightPixels; wt = displaymetrics.widthPixels; All these methods return wrong width and height for the 240x320 devices namely Samsung Europa and Alcatel which i have. Width = 320 Height = 240.. This is wierd as some of the critical functionality is getting hampered .. I think this is really a basic thing which shd be correctly provided. Please help me with this issue . Thanks, Alok -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Problem getting width and height of Device programatically for QVGA devices.
So is it that of API level is 3, then it wont calculate the width and height and just assume the emulated HVGA version as 320 x 427.. But what is 427 i mean it shd be 480 rite ?? 2010/8/23 Alok Kulkarni kulsu...@gmail.com Ok.. here is what the case is.. I have uses-sdk android:minSdkVersion=3 / in manifest, but i compile the project using Android 2.1 as i have to support few APIs for contacts introduced in 2.1.. So my app is compiled against 2.1 but runs for Android 1.5 as well. 2010/8/23 Kostya Vasilyev kmans...@gmail.com Do you have targetSdk set correctly? It seems like your app runs in compatibility mode, and sees emulated HVGA display parameters. -- Kostya Vasilyev -- http://kmansoft.wordpress.com 23.08.2010 17:51 пользователь Alok Kulkarni kulsu...@gmail.com написал: Hi all, I want to get the width and height of my device to know what type device it is ie QVGA, HVGA ,WVGA.. Also i need to adjust some layouts according to width and height of the screen. I tried following methods but its not working. 1) 1. /* First, get the Display from the WindowManager */ 2. Display display = ((WindowManager) getSystemService(WINDOW_SERVICE)).getDefaultDisplay(); 3. 4. /* Now we can retrieve all display-related infos */ 5. int width = display.getWidth(); 6. int height = display.getHeight(); 7. int orientation = display.getOrientation(); 2) width = getResources().getDisplayMetrics().widthPixels; height = getResources().getDisplayMetrics().heightPixels; 3) int ht; int wt; DisplayMetrics displaymetrics = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(displaymetrics); ht = displaymetrics.heightPixels; wt = displaymetrics.widthPixels; All these methods return wrong width and height for the 240x320 devices namely Samsung Europa and Alcatel which i have. Width = 320 Height = 240.. This is wierd as some of the critical functionality is getting hampered .. I think this is really a basic thing which shd be correctly provided. Please help me with this issue . Thanks, Alok -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] ListView paint issue in landscape mode.Width remains as in Portrait mode
Hi, I am having a listview in my App which shows perfectly in Portrait mode.But when i change orientation to landscape , sometimes the width remains as that of Portrait mode.Even the scrollbar for the list comes at the center and remaining part of the screen remains balcked out.This happens only with the list view.Other views show perfectly.I have designed the layouts such that the Portrait layouts look feel proportionate in landscape mode . I want to avoid restarting the activity so i have not put the layouts in the landscape folder. I tried invalidating the listview in onConfigurationChanged() but of no use. When i navigate in the list in landscape mode , the width automatically gets adjusted.Any help in this regard will be of great use :) Thanks, Alok. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: ListView paint issue in landscape mode.Width remains as in Portrait mode
Solved the problem Actually i was playing with the width of the list after setting the indexer of the list.This was causing the painting issue Thanks, Alok On Mon, Aug 16, 2010 at 2:35 PM, Alok Kulkarni kulsu...@gmail.com wrote: Hi, I am having a listview in my App which shows perfectly in Portrait mode.But when i change orientation to landscape , sometimes the width remains as that of Portrait mode.Even the scrollbar for the list comes at the center and remaining part of the screen remains balcked out.This happens only with the list view.Other views show perfectly.I have designed the layouts such that the Portrait layouts look feel proportionate in landscape mode . I want to avoid restarting the activity so i have not put the layouts in the landscape folder. I tried invalidating the listview in onConfigurationChanged() but of no use. When i navigate in the list in landscape mode , the width automatically gets adjusted.Any help in this regard will be of great use :) Thanks, Alok. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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] Problem with reading contacts on Samsung Galaxy Europa
yeah it is only happening on that deviuce. But i have found a different solution to it which i will put up here tomorrow. On Wed, Aug 4, 2010 at 12:51 PM, dan raaka danra...@gmail.com wrote: Is this happening only on Europa ? -Dan On Wed, Aug 4, 2010 at 12:26 PM, Alok Kulkarni kulsu...@gmail.com wrote: Hi , i am using startActivityForResult(intent,PICK_CONTACT); Its working on Android 1.5 to 2.1 except for the 2.1 device Samsung Europa..On that device , i am not able to read the contacts, its returning empty result. here is the link i referred for the code http://www.droidnova.com/use-intents-to-start-other-activities,76.html Is thr something i m missing ? -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Problem with reading contacts on Samsung Galaxy Europa
Hi , i am using startActivityForResult(intent,PICK_CONTACT); Its working on Android 1.5 to 2.1 except for the 2.1 device Samsung Europa..On that device , i am not able to read the contacts, its returning empty result. here is the link i referred for the code http://www.droidnova.com/use-intents-to-start-other-activities,76.html Is thr something i m missing ? -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] cursor.moveToFirst() blocking UI
Hi, I have a background thread which queries for 1000 records at a time. After querying , when i call cursor.moveToFirst(), the UI gets blocked until the operation is completed.This is very disturbing experience for user , especially if there are 1 plus records.I use Thread.sleep in between after each 1000 records, As soon as cursor.moveToFirst is called, UI blocks for 2 3 seconds. Am i missing anything here ? -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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] cursor.moveToFirst() blocking UI
Hi Mark, As i said , i am doing the operation in a background thread. I also know that cursor.moveToFirst() causes the data to be accessed at that point. Here is the code public void getAllSongIdsOffset(int offset, int limit) { int nTrackId; try { SQLiteDatabase db = InventoryManager.inventoryDB.getConnection(); Cursor mCursor; int index = 0; mCursor = db.rawQuery( select distinct id from tracks order by tracks.namelimit + limit + offset + offset + , null); SQLiteDatabase.releaseMemory(); if (mCursor != null) { Log.i(VALUE-, Before movetoFirst + System.currentTimeMillis()); mCursor.moveToFirst(); Log.i(VALUE-, After movetoFirst + System.currentTimeMillis()); if (mCursor.getCount() == 0) { mCursor.close(); SQLiteDatabase.releaseMemory(); System.gc(); return; } do { // songIds[index] = new Integer(mCursor.getInt(0)); mediaIdArray.set(offset + index, mCursor .getInt(0)); index++; } while (mCursor.moveToNext()); } mCursor.close(); mCursor = null; } catch (Exception e) { e.printStackTrace(); } finally { InventoryManager.inventoryDB.releaseConnection(); } SQLiteDatabase.releaseMemory(); } private class ListThread extends Thread { public void run() { int size = mediaIdArray.size(); while (offset = InventoryManager.songs.getAllSongCount()) { try { Thread.sleep(1); int cnt = offset + limit; if (cnt size) cnt = size; InventoryManager.songs.getAllSongIdsOffset(offset, limit); offset += 1000; ListScreenHandler .sendEmptyMessage(ScreenConstants.NOTIFYDATASETCHANGED); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } } } If i dont do a Thread.sleep... the UI gets completely blocked until all the records are fetched.\ To update the UI i am calling a handler. Thanks , Alok. On Tue, Jul 20, 2010 at 5:10 PM, anil kukreti success.anil...@gmail.comwrote: Ya Mark is right ! You need to use *multithreading* for making a reponsive UI. Thread.sleep inside spawned thread will give a chance to main UI thread to response to User events. -- Forwarded message -- From: Alok Kulkarni kulsu...@gmail.com Date: Tue, Jul 20, 2010 at 4:44 PM Subject: [android-developers] cursor.moveToFirst() blocking UI To: android-developers@googlegroups.com Hi, I have a background thread which queries for 1000 records at a time. After querying , when i call cursor.moveToFirst(), the UI gets blocked until the operation is completed.This is very disturbing experience for user , especially if there are 1 plus records.I use Thread.sleep in between after each 1000 records, As soon as cursor.moveToFirst is called, UI blocks for 2 3 seconds. Am i missing anything here ? -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Thanks for Cooperating! Anil Kukreti Network transforms ideas to reality. 09312646623 Linked In : http://in.linkedin.com/in/anilkukreti Blog : http://androidosbeginning.blogspot.com/ Skype Id : anil.kleward -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] cursor.moveToFirst() blocking UI
Hi Mark, Thanks for your reply. What i did was i removed the System.gc() as well as the handler call. Considering the code from above snippet. Log.i(VALUE-, Before movetoFirst + System.currentTimeMillis()); mCursor.moveToFirst(); Log.i(VALUE-, After movetoFirst + System.currentTimeMillis()); Output :- Before movetoFirst 1279628503040 After movetoFirst1279628508063 This clearly shows a difference of 5 seconds.(My emulator is slow.On device it takes 2 to 3 seconds) Thanks, Alok. On Tue, Jul 20, 2010 at 5:40 PM, Mark Murphy mmur...@commonsware.comwrote: With respect to your If i dont do a Thread.sleep... the UI gets completely blocked until all the records are fetched., the problem would appear to be in whatever your Handler is doing, or possibly just due to all the garbage collection you are doing. None of the code you show here, other than the GC, should block the UI thread, from what I can tell. Bear in mind that the code you have here is only copying a bunch of ID values. Assuming your UI is displaying things other than ID numbers, there must be other database I/O going on -- perhaps it is that I/O that is causing your problem. On Tue, Jul 20, 2010 at 7:56 AM, Alok Kulkarni kulsu...@gmail.com wrote: Hi Mark, As i said , i am doing the operation in a background thread. I also know that cursor.moveToFirst() causes the data to be accessed at that point. Here is the code public void getAllSongIdsOffset(int offset, int limit) { int nTrackId; try { SQLiteDatabase db = InventoryManager.inventoryDB.getConnection(); Cursor mCursor; int index = 0; mCursor = db.rawQuery( select distinct id from tracks order by tracks.name limit + limit + offset + offset + , null); SQLiteDatabase.releaseMemory(); if (mCursor != null) { Log.i(VALUE-, Before movetoFirst + System.currentTimeMillis()); mCursor.moveToFirst(); Log.i(VALUE-, After movetoFirst + System.currentTimeMillis()); if (mCursor.getCount() == 0) { mCursor.close(); SQLiteDatabase.releaseMemory(); System.gc(); return; } do { // songIds[index] = new Integer(mCursor.getInt(0)); mediaIdArray.set(offset + index, mCursor .getInt(0)); index++; } while (mCursor.moveToNext()); } mCursor.close(); mCursor = null; } catch (Exception e) { e.printStackTrace(); } finally { InventoryManager.inventoryDB.releaseConnection(); } SQLiteDatabase.releaseMemory(); } private class ListThread extends Thread { public void run() { int size = mediaIdArray.size(); while (offset = InventoryManager.songs.getAllSongCount()) { try { Thread.sleep(1); int cnt = offset + limit; if (cnt size) cnt = size; InventoryManager.songs.getAllSongIdsOffset(offset, limit); offset += 1000; ListScreenHandler .sendEmptyMessage(ScreenConstants.NOTIFYDATASETCHANGED); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } } } If i dont do a Thread.sleep... the UI gets completely blocked until all the records are fetched.\ To update the UI i am calling a handler. Thanks , Alok. On Tue, Jul 20, 2010 at 5:10 PM, anil kukreti success.anil...@gmail.com wrote: Ya Mark is right ! You need to use multithreading for making a reponsive UI. Thread.sleep inside spawned thread will give a chance to main UI thread to response to User events. -- Forwarded message -- From: Alok Kulkarni kulsu...@gmail.com Date: Tue, Jul 20, 2010 at 4:44 PM Subject: [android-developers] cursor.moveToFirst() blocking UI To: android-developers@googlegroups.com Hi, I have a background thread which queries for 1000 records at a time. After querying , when i call cursor.moveToFirst(), the UI gets blocked until the operation is completed.This is very disturbing experience for user , especially if there are 1 plus records.I use Thread.sleep in between after each 1000 records, As soon as cursor.moveToFirst is called, UI blocks for 2 3 seconds. Am i missing anything here ? -- You received this message
Re: [android-developers] cursor.moveToFirst() blocking UI
Yess :( Anyone can try it out.. One more thing.. I have iniialised the DB ie called the getWritiabledDatabase at the start of app from the Application class.Is the accessing the DB from a new thread causing the UI to hang if supposedly the Application context means the UI context getting blocked as DB was created in UI context. On Tue, Jul 20, 2010 at 6:01 PM, Mark Murphy mmur...@commonsware.comwrote: On Tue, Jul 20, 2010 at 8:24 AM, Alok Kulkarni kulsu...@gmail.com wrote: Thanks for your reply. What i did was i removed the System.gc() as well as the handler call. Considering the code from above snippet. Log.i(VALUE-, Before movetoFirst + System.currentTimeMillis()); mCursor.moveToFirst(); Log.i(VALUE-, After movetoFirst + System.currentTimeMillis()); Output :- Before movetoFirst 1279628503040 After movetoFirst1279628508063 This clearly shows a difference of 5 seconds.(My emulator is slow.On device it takes 2 to 3 seconds) That is to be expected given your query. However, according to you, that is in a background thread. And, according to you, your problem is the UI being blocked. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy _The Busy Coder's Guide to Android Development_ Version 3.1 Available! -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] cursor.moveToFirst() blocking UI
Problem Solved.. The problem was that i was querying on the tracks database for 1000 songs.. At the same time, scrolling the list would make a call to the same tracks table. This is synchronous in Android using the same DB object. So the solution was to create a seperate DB object as getReadableDatabase for the 3 songs list query.. UI does not block now..Yippee I am sorry for the incorrect inference that i got earlier .. Thanks And Regards, Alok. On Tue, Jul 20, 2010 at 6:52 PM, Alok Kulkarni kulsu...@gmail.com wrote: Yess :( Anyone can try it out.. One more thing.. I have iniialised the DB ie called the getWritiabledDatabase at the start of app from the Application class.Is the accessing the DB from a new thread causing the UI to hang if supposedly the Application context means the UI context getting blocked as DB was created in UI context. On Tue, Jul 20, 2010 at 6:01 PM, Mark Murphy mmur...@commonsware.comwrote: On Tue, Jul 20, 2010 at 8:24 AM, Alok Kulkarni kulsu...@gmail.com wrote: Thanks for your reply. What i did was i removed the System.gc() as well as the handler call. Considering the code from above snippet. Log.i(VALUE-, Before movetoFirst + System.currentTimeMillis()); mCursor.moveToFirst(); Log.i(VALUE-, After movetoFirst + System.currentTimeMillis()); Output :- Before movetoFirst 1279628503040 After movetoFirst1279628508063 This clearly shows a difference of 5 seconds.(My emulator is slow.On device it takes 2 to 3 seconds) That is to be expected given your query. However, according to you, that is in a background thread. And, according to you, your problem is the UI being blocked. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy _The Busy Coder's Guide to Android Development_ Version 3.1 Available! -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Memory usage increasing on orientation change only for the 1st orientation change
Hi, I traced the memory usage of my app using adb shell procrank command. At that startup, USS is 6.2 mb .When i change orientation,it goes to 8.1 mb.After that , if i keep on changing orientation , it remains on 8.1 mb. Is this a memory leak , or am i missing something ? -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Progressbar with Thumb image is not showing correctly on the 2.1 emulator
HI I am having a progressbar whose width is fill parent. I have an image for its thumb which is similar to Android default thumb but a bit larger in size.On Android 1.5 when i observer , part of the thumb goes out of the screen on the left side.So i gave a thumb offset as -10 which works perfectly.But the same thing does not work on 2.1 or 2.2 emulator.The thumb still goes out of the screen partially.Am i missing something ? -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: Maintaining the state when changing the orientation
Thanks Dianne for your response. I have solved the leaks almost completely . What wrong i was doing is i was also saving the array of list items drawn on the UI and reassigning it to the new activity.It takes some time to understand what really should be saved and what not to be saved , also understanding saving what exactly causes a memory leak.There are a few leaks after i start playing a song.But i need to analyze further and get back. Thanks Guys :), Alok. On Sun, Jun 20, 2010 at 3:18 AM, Dianne Hackborn hack...@android.comwrote: On Wed, May 19, 2010 at 5:12 PM, JP joachim.pfeif...@gmail.com wrote: Like in your case, I have apps that need to keep (hundreds of) objects and state variables that require retention regardless of what's going on at the UI level. What I've done in order to pick up where I left off after a rotation change (or, for that matter, when the user calls the app from the main screen) is to start and bind a Service that I bind again when the app comes out at the other end. Implement getters and setters like you normally would to access the relevant data. The SDK contains a pretty good example how to do all that which you can use as a blueprint. Hi, this doesn't really save you anything. If you are just keeping the service running during the change, then it isn't any better than keeping that stuff in globals. If you are actually keeping the service running all the time just to not have to persist your state... please do not do that, as it harms the overall user experience because you are telling the system your app needs to run all the time and it needs to kill other things to keep you running. (And we are increasingly going to have facilities for users to find out about apps doing this kind of stuff and deal with it in various ways. This is becoming my #1 target for making a better user experience.) If your application is really something that has so much going on that it needs to always be running, then you can make a foreground service with its associated notification. Then the user knows it is running, and knows how to get it to go away if that is not what they want. The downside is that there's a risk the service gets killed as the system is scraping for resources, but personally I haven't seen this happen for a service that's bound to an UI thread. There's people on the list who know much more about what's going on under the hood in that regard, perhaps they can chime in. The service and your activity all run in the same process. If the activity is in the foreground (which is the case during a configuration change), then the process will not be killed. It doesn't matter at all that there is a service there or that you are binding to it or anything like that. If you are using a service to keep yourself around in the background... well, these days we pretty aggressively throw long-running services farther into the background, to basically guarantee they will always eventually get killed (and then restarted in a clean process). -- Dianne Hackborn Android framework engineer hack...@android.com Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email 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: Maintaining the state when changing the orientation
Currently i am having handlers in my code which update th ui. But it seems they are not having any effect on ui when i change the orientation.the handlers get called but do not have any effect on ui.is there any special handling that needs to be done in case of handlers? On 5/14/10, Alok Kulkarni kulsu...@gmail.com wrote: Thanks a lot guys for the information, I found this article http://peacemoon.wordpress.com/2009/08/23/android-developing-orientation-aware-android-applications/ I need to save many objects so basically onSavedInstanceState is not of full use . So i am going forward with onRetainNonConfigurationInstance(). @Charlie, why is this method not so reliable? Thanks, Alok. On Fri, May 14, 2010 at 6:25 AM, Charlie Collins charlie.coll...@gmail.comwrote: http://developer.android.com/intl/de/guide/topics/fundamentals.html#actlife Saving activity state When the system, rather than the user, shuts down an activity to conserve memory, the user may expect to return to the activity and find it in its previous state. To capture that state before the activity is killed, you can implement an onSaveInstanceState() method for the activity. Android calls this method before making the activity vulnerable to being destroyed — that is, before onPause() is called. It passes the method a Bundle object where you can record the dynamic state of the activity as name-value pairs. When the activity is again started, the Bundle is passed both to onCreate() and to a method that's called after onStart(), onRestoreInstanceState(), so that either or both of them can recreate the captured state. Unlike onPause() and the other methods discussed earlier, onSaveInstanceState() and onRestoreInstanceState() are not lifecycle methods. They are not always called. For example, Android calls onSaveInstanceState() before the activity becomes vulnerable to being destroyed by the system, but does not bother calling it when the instance is actually being destroyed by a user action (such as pressing the BACK key). In that case, the user won't expect to return to the activity, so there's no reason to save its state. Because onSaveInstanceState() is not always called, you should use it only to record the transient state of the activity, not to store persistent data. Use onPause() for that purpose instead. http://developer.android.com/intl/de/reference/android/app/Activity.html Configuration Changes If the configuration of the device (as defined by the Resources.Configuration class) changes, then anything displaying a user interface will need to update to match that configuration. Because Activity is the primary mechanism for interacting with the user, it includes special support for handling configuration changes. Unless you specify otherwise, a configuration change (such as a change in screen orientation, language, input devices, etc) will cause your current activity to be destroyed, going through the normal activity lifecycle process of onPause(), onStop(), and onDestroy() as appropriate. If the activity had been in the foreground or visible to the user, once onDestroy() is called in that instance then a new instance of the activity will be created, with whatever savedInstanceState the previous instance had generated from onSaveInstanceState(Bundle). This is done because any application resource, including layout files, can change based on any configuration value. Thus the only safe way to handle a configuration change is to re-retrieve all resources, including layouts, drawables, and strings. Because activities must already know how to save their state and re-create themselves from that state, this is a convenient way to have an activity restart itself with a new configuration. In some special cases, you may want to bypass restarting of your activity based on one or more types of configuration changes. This is done with the android:configChanges attribute in its manifest. For any types of configuration changes you say that you handle there, you will receive a call to your current activity's onConfigurationChanged(Configuration) method instead of being restarted. If a configuration change involves any that you do not handle, however, the activity will still be restarted and onConfigurationChanged(Configuration) will not be called. That should get you going in the right direction. There is also onRetainNonConfigurationInstance (Activity method) but it's not what you should rely on (can be used to optimize), but the basics are the onSaveInstanceState and onRestoreInstanceState methods. On May 13, 4:29 am, Alok Kulkarni kulsu...@gmail.com wrote: I am having an application showing ListItems and Dialog boxes in it.. I want that when i change the orientation from Portrait to landscape mode, i need to maintain the state of the application .. I have seperate XMLs for landscape and portrait mode.. What is the best way to achieve this Thanks
[android-developers] OnOrientationChanged leaks in ListView
Hi, I am having a ListView with custom ArrayAdapter.For defining a list item i have my own class ListItem which stores all info including list item images, and other textual info in it. I have handled orientation change in onRetainNonConfigurationInstance() in which i save the array of ListItems in another object.. and when the Activity is recreated i reassign the array of list items to those of the activity. Then i create an ArrayAdapter accordingly .I use adb shell procrank and find out that i am leaking memory everytime i change orientation. I have debugged through and found out that the leak is in arraylist of list items itself.What wrong am i doing here ? Thanks , Alok. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Airplane mode Causing a problem
Hi, I am having an HTC Magic device. Scenario For the problem I turn off airplane mode after putting it on for sometime. Once i do that and make some network connection either programatically or opening a browser, i get a Force Close dialog with process com.android.phone not responding. When i see the logcat i see the message :- ERROR/AndroidRuntime(905): Uncaught handler: thread main exiting due to uncaught exception 06-09 13:58:33.462: ERROR/AndroidRuntime(905): a*ndroid.content.ActivityNotFoundException: Unable to find explicit activity class {com.android.phone/com.android.phone.NetworkListDialog}*; *have you declared this activity in your AndroidManifest.xml?* 06-09 13:58:33.462: ERROR/AndroidRuntime(905): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1484) 06-09 13:58:33.462: ERROR/AndroidRuntime(905): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1458) 06-09 13:58:33.462: ERROR/AndroidRuntime(905): at android.app.ApplicationContext.startActivity(ApplicationContext.java:632) 06-09 13:58:33.462: ERROR/AndroidRuntime(905): at android.content.ContextWrapper.startActivity(ContextWrapper.java:236) 06-09 13:58:33.462: ERROR/AndroidRuntime(905): at com.android.phone.PhoneApp.networksListLoaded(PhoneApp.java:672) 06-09 13:58:33.462: ERROR/AndroidRuntime(905): at com.android.phone.PhoneApp.access$1100(PhoneApp.java:98) 06-09 13:58:33.462: ERROR/AndroidRuntime(905): at com.android.phone.PhoneApp$3.handleMessage(PhoneApp.java:421) 06-09 13:58:33.462: ERROR/AndroidRuntime(905): at android.os.Handler.dispatchMessage(Handler.java:99) 06-09 13:58:33.462: ERROR/AndroidRuntime(905): at android.os.Looper.loop(Looper.java:123) 06-09 13:58:33.462: ERROR/AndroidRuntime(905): at android.app.ActivityThread.main(ActivityThread.java:3948) 06-09 13:58:33.462: ERROR/AndroidRuntime(905): at java.lang.reflect.Method.invokeNative(Native Method) 06-09 13:58:33.462: ERROR/AndroidRuntime(905): at java.lang.reflect.Method.invoke(Method.java:521) 06-09 13:58:33.462: ERROR/AndroidRuntime(905): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:782) 06-09 13:58:33.462: ERROR/AndroidRuntime(905): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540) 06-09 13:58:33.462: ERROR/AndroidRuntime(905): at dalvik.system.NativeStart.main(Native Method) 06-09 13:58:33.472: INFO/Process(55): Sending signal. PID: 905 SIG: 3 06-09 13:58:33.472: INFO/dalvikvm(905): threadid=7: reacting to signal 3 Important :- This is observed when i have a SIM card inserted in the device . Even if i use Wifi for connection , it is observed the if the SIM is not present in the device , this issue does not come. I googled for *com.android.phone.NetworkListDialog but *i aint getting any results. Is this a device specific problem ? I have a Moto Blurr to but its not unlocked here for SIM services. Please help . :) Thanks , Alok. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: Problem with StateListDrawables not found in 1.5 but there from 1.6 onwards
Guys , I finally found the solution for my original problem.So thought of sharing it if someone has the same in the future. Using the 3 images itself ,my problem was solved by adding a zero padding explicitly android:paddingLeft=0dip android:paddingRight=0dip android:paddingTop=0dip android:paddingBottom=0dip Maybe Android 1.5 is taking padding 0 dip for the compound drawables but later on its adding some padding by default from 1.6 and specifying padding as 0 explicitly solves the problem.This solution was found just by fluke..But it has solved a major headache for me .. Thanks and Regards, Alok. On Thu, May 6, 2010 at 7:24 PM, Alok Kulkarni kulsu...@gmail.com wrote: Oh ok.. Thanks for that.. ill try that and will let you know... Regards, Alok. On Thu, May 6, 2010 at 3:36 PM, skink psk...@gmail.com wrote: On May 6, 5:52 am, skink psk...@gmail.com wrote: reading this: http://groups.google.com/group/android-developers/msg/db8d63fd8575129c it seems ninePatches are created statically by aapt tool and if you want to create ninepatchdrawable dynamically from any file you would calculate chunk by yourself (ResourceTypes.h for its format) pskink so if creating NinePatcheDrawable is not an easy thing (due to binary chunk format) i thing the best idea for OP is to create custom drawable extending StateListDrawable pskink -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: Maintaining the state when changing the orientation
Hi guys , thanks for the replys, @Sanjay , i have taken care in case of ArrayAdapter for ListViews I could successfully do save the state of application and also the handlers problem was solved. What i did is that i used a Main class which extends Application, whenever onCreate of my Activity gets called , i assign the Activity reference to a Main class Activity variable.This happens each time onCreate is called. @JP, Actually the application is very huge currently. So i will slowly move towards Service implementation, but for current releases i need to do changes in the current architecture itself. But currently i am facing the issue of going OutOfMemory if i keep on changing the layout from landscape to portratit and vice versa. I have to take all the drawable images from a runtime folder under my application as i have themes implementation and themes images come from server. So i assign drawables at runtime to all the widgets. When the orientation changes , i reassign the drawables to all widgets.I have taken care of making the objects null.. And views get null when onDestroy is called. Also i havent kept the reference of activity anywhere after onDestroy is called.. IS there anything wrong thats striking to anyone right now ? Thanks , Alok. On Thu, May 20, 2010 at 5:42 AM, JP joachim.pfeif...@gmail.com wrote: On May 14, 2:54 am, Alok Kulkarni kulsu...@gmail.com wrote: I need to save many objects so basically onSavedInstanceState is not of full use . Like in your case, I have apps that need to keep (hundreds of) objects and state variables that require retention regardless of what's going on at the UI level. What I've done in order to pick up where I left off after a rotation change (or, for that matter, when the user calls the app from the main screen) is to start and bind a Service that I bind again when the app comes out at the other end. Implement getters and setters like you normally would to access the relevant data. The SDK contains a pretty good example how to do all that which you can use as a blueprint. The downside is that there's a risk the service gets killed as the system is scraping for resources, but personally I haven't seen this happen for a service that's bound to an UI thread. There's people on the list who know much more about what's going on under the hood in that regard, perhaps they can chime in. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: Maintaining the state when changing the orientation
Thanks a lot guys for the information, I found this article http://peacemoon.wordpress.com/2009/08/23/android-developing-orientation-aware-android-applications/ I need to save many objects so basically onSavedInstanceState is not of full use . So i am going forward with onRetainNonConfigurationInstance(). @Charlie, why is this method not so reliable? Thanks, Alok. On Fri, May 14, 2010 at 6:25 AM, Charlie Collins charlie.coll...@gmail.comwrote: http://developer.android.com/intl/de/guide/topics/fundamentals.html#actlife Saving activity state When the system, rather than the user, shuts down an activity to conserve memory, the user may expect to return to the activity and find it in its previous state. To capture that state before the activity is killed, you can implement an onSaveInstanceState() method for the activity. Android calls this method before making the activity vulnerable to being destroyed — that is, before onPause() is called. It passes the method a Bundle object where you can record the dynamic state of the activity as name-value pairs. When the activity is again started, the Bundle is passed both to onCreate() and to a method that's called after onStart(), onRestoreInstanceState(), so that either or both of them can recreate the captured state. Unlike onPause() and the other methods discussed earlier, onSaveInstanceState() and onRestoreInstanceState() are not lifecycle methods. They are not always called. For example, Android calls onSaveInstanceState() before the activity becomes vulnerable to being destroyed by the system, but does not bother calling it when the instance is actually being destroyed by a user action (such as pressing the BACK key). In that case, the user won't expect to return to the activity, so there's no reason to save its state. Because onSaveInstanceState() is not always called, you should use it only to record the transient state of the activity, not to store persistent data. Use onPause() for that purpose instead. http://developer.android.com/intl/de/reference/android/app/Activity.html Configuration Changes If the configuration of the device (as defined by the Resources.Configuration class) changes, then anything displaying a user interface will need to update to match that configuration. Because Activity is the primary mechanism for interacting with the user, it includes special support for handling configuration changes. Unless you specify otherwise, a configuration change (such as a change in screen orientation, language, input devices, etc) will cause your current activity to be destroyed, going through the normal activity lifecycle process of onPause(), onStop(), and onDestroy() as appropriate. If the activity had been in the foreground or visible to the user, once onDestroy() is called in that instance then a new instance of the activity will be created, with whatever savedInstanceState the previous instance had generated from onSaveInstanceState(Bundle). This is done because any application resource, including layout files, can change based on any configuration value. Thus the only safe way to handle a configuration change is to re-retrieve all resources, including layouts, drawables, and strings. Because activities must already know how to save their state and re-create themselves from that state, this is a convenient way to have an activity restart itself with a new configuration. In some special cases, you may want to bypass restarting of your activity based on one or more types of configuration changes. This is done with the android:configChanges attribute in its manifest. For any types of configuration changes you say that you handle there, you will receive a call to your current activity's onConfigurationChanged(Configuration) method instead of being restarted. If a configuration change involves any that you do not handle, however, the activity will still be restarted and onConfigurationChanged(Configuration) will not be called. That should get you going in the right direction. There is also onRetainNonConfigurationInstance (Activity method) but it's not what you should rely on (can be used to optimize), but the basics are the onSaveInstanceState and onRestoreInstanceState methods. On May 13, 4:29 am, Alok Kulkarni kulsu...@gmail.com wrote: I am having an application showing ListItems and Dialog boxes in it.. I want that when i change the orientation from Portrait to landscape mode, i need to maintain the state of the application .. I have seperate XMLs for landscape and portrait mode.. What is the best way to achieve this Thanks , Alok. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com
Re: [android-developers] Re: Maintaining the state when changing the orientation
Ok , i have succeeded in many parts of the app supporting the landscape mode, i am now facing a major problem in case of Handlers. I have many handlers for updating the UI . But they dont seem to work when i change Orientation.They behave a bit werdly actually.For example, i have a Play button which plays a song.A few set of events occur and then a handler is called from non ui thread to update the button icon.The icon of the button toggles to Pause as expected.Now when i change the orientaion, and do the same activity, the icon does not update. Now when i change the orientation again, the icon has been updated automatically? Is there any issue in case of handlers in case of orientation change?The handlers seem to get called when i checked using the debug mode ,but do not have any effect it seems. Thanks, Alok. On Thu, May 13, 2010 at 9:54 PM, Alok Kulkarni kulsu...@gmail.com wrote: Thanks a lot guys for the information, I found this article http://peacemoon.wordpress.com/2009/08/23/android-developing-orientation-aware-android-applications/ I need to save many objects so basically onSavedInstanceState is not of full use . So i am going forward with onRetainNonConfigurationInstance(). @Charlie, why is this method not so reliable? Thanks, Alok. On Fri, May 14, 2010 at 6:25 AM, Charlie Collins charlie.coll...@gmail.com wrote: http://developer.android.com/intl/de/guide/topics/fundamentals.html#actlife Saving activity state When the system, rather than the user, shuts down an activity to conserve memory, the user may expect to return to the activity and find it in its previous state. To capture that state before the activity is killed, you can implement an onSaveInstanceState() method for the activity. Android calls this method before making the activity vulnerable to being destroyed — that is, before onPause() is called. It passes the method a Bundle object where you can record the dynamic state of the activity as name-value pairs. When the activity is again started, the Bundle is passed both to onCreate() and to a method that's called after onStart(), onRestoreInstanceState(), so that either or both of them can recreate the captured state. Unlike onPause() and the other methods discussed earlier, onSaveInstanceState() and onRestoreInstanceState() are not lifecycle methods. They are not always called. For example, Android calls onSaveInstanceState() before the activity becomes vulnerable to being destroyed by the system, but does not bother calling it when the instance is actually being destroyed by a user action (such as pressing the BACK key). In that case, the user won't expect to return to the activity, so there's no reason to save its state. Because onSaveInstanceState() is not always called, you should use it only to record the transient state of the activity, not to store persistent data. Use onPause() for that purpose instead. http://developer.android.com/intl/de/reference/android/app/Activity.html Configuration Changes If the configuration of the device (as defined by the Resources.Configuration class) changes, then anything displaying a user interface will need to update to match that configuration. Because Activity is the primary mechanism for interacting with the user, it includes special support for handling configuration changes. Unless you specify otherwise, a configuration change (such as a change in screen orientation, language, input devices, etc) will cause your current activity to be destroyed, going through the normal activity lifecycle process of onPause(), onStop(), and onDestroy() as appropriate. If the activity had been in the foreground or visible to the user, once onDestroy() is called in that instance then a new instance of the activity will be created, with whatever savedInstanceState the previous instance had generated from onSaveInstanceState(Bundle). This is done because any application resource, including layout files, can change based on any configuration value. Thus the only safe way to handle a configuration change is to re-retrieve all resources, including layouts, drawables, and strings. Because activities must already know how to save their state and re-create themselves from that state, this is a convenient way to have an activity restart itself with a new configuration. In some special cases, you may want to bypass restarting of your activity based on one or more types of configuration changes. This is done with the android:configChanges attribute in its manifest. For any types of configuration changes you say that you handle there, you will receive a call to your current activity's onConfigurationChanged(Configuration) method instead of being restarted. If a configuration change involves any that you do not handle, however, the activity will still be restarted and onConfigurationChanged(Configuration) will not be called. That should get you going in the right direction
[android-developers] Maintaining the state when changing the orientation
I am having an application showing ListItems and Dialog boxes in it.. I want that when i change the orientation from Portrait to landscape mode, i need to maintain the state of the application .. I have seperate XMLs for landscape and portrait mode.. What is the best way to achieve this Thanks , Alok. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Application Upgrade Related Questions
Hi , i wanted to ask a question regarding the upgrading of my application. I have tested the following thing. Put the new version of the APK on a server.Open the link of the APK from the mobile browser .The mobile automatically downloads the APK and asks for installation.Once installed , the application has got upgraded. Now can i do this thing programatically ? I want that once the user starts the application , a web service will be called internally which will check that an application upgrade is available. If its available , i want to internally download the APK on the device once the user says Yes. And then it should get installed automatically. I can download a given file from a given server on the device on my SDCard /application folder. How can i invoke an automatic installation procedure? Can i do this programatically ? Thanks, Alok. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: Problem with StateListDrawables not found in 1.5 but there from 1.6 onwards
Oh ok.. Thanks for that.. ill try that and will let you know... Regards, Alok. On Thu, May 6, 2010 at 3:36 PM, skink psk...@gmail.com wrote: On May 6, 5:52 am, skink psk...@gmail.com wrote: reading this: http://groups.google.com/group/android-developers/msg/db8d63fd8575129c it seems ninePatches are created statically by aapt tool and if you want to create ninepatchdrawable dynamically from any file you would calculate chunk by yourself (ResourceTypes.h for its format) pskink so if creating NinePatcheDrawable is not an easy thing (due to binary chunk format) i thing the best idea for OP is to create custom drawable extending StateListDrawable pskink -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Problem with StateListDrawables not found in 1.5 but there from 1.6 onwards
Hi , I am having the following code for drawing buttons in my project. I am having a button which has three images for 1 button .Namely one image for the rectangle and 2 images for the left and right side curves respectively. When the button has focus , there is another three images for focus and similarly 3 images when button is pressed. Following is the code. public void setButtonStyle(Button btn) { //The middle rectangle StateListDrawable drawables = new StateListDrawable(); drawables.addState(new int[] { stateFocused, -statePressed }, dButtonMidOverImage); drawables.addState(new int[] { stateFocused, statePressed }, dButtonMidDownImage); drawables.addState(new int[] { -stateFocused, statePressed }, dButtonMidDownImage); drawables.addState(new int[] { -stateChecked }, dButtonMidUpImage); btn.setBackgroundDrawable(drawables); //The left curve StateListDrawable drawablesLeft = new StateListDrawable(); drawablesLeft.addState(new int[] { stateFocused, -statePressed }, dButtonLeftOverImage); drawablesLeft.addState(new int[] { stateFocused, statePressed }, dButtonLeftDownImage); drawablesLeft.addState(new int[] { -stateFocused, statePressed }, dButtonLeftDownImage); drawablesLeft.addState(new int[] { -stateChecked }, dButtonLeftUpImage); StateListDrawable drawablesRight = new StateListDrawable(); drawablesRight.addState(new int[] { stateFocused, -statePressed }, dButtonRightOverImage); //The right curve drawablesRight.addState(new int[] { stateFocused, statePressed }, dButtonRightDownImage); drawablesRight.addState(new int[] { -stateFocused, statePressed }, dButtonRightDownImage); drawablesRight.addState(new int[] { -stateChecked }, dButtonRightUpImage); //Compound drawables set for left and right side. btn.setCompoundDrawablesWithIntrinsicBounds(drawablesLeft, null, drawablesRight, null); } This thing which i have done runtime can be done in the XML too , but i want to change themes runtime so my images for button will also change runtime. If i do the code in the XML it works fine on both Android 1.5 as well as Android 1.6 .But doing it in code distorts the images for 1.6 emulator. I have attached the screen shot of the buttons on both 1.5 and 1.6 emulators.As you can see, the left and right curve images come almost to the center and the centre image is expanded in 1.6 emulator. The same problem is seen on HTC Desire (Android2.1) Is there something wrong that i am doing . Is there any workaround for this problem. Thanks , Alok., -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=enattachment: Android1.5 Emulator_Button.JPGattachment: Android1.6 Emulator_Button.JPGattachment: Button Seperation.JPG
Re: [android-developers] Problem with StateListDrawables not found in 1.5 but there from 1.6 onwards
For 9 patch images i suppose they need to be stored under drawable folder. I need to change the images according to theme at runtime. On Wed, May 5, 2010 at 12:52 PM, skink psk...@gmail.com wrote: Alok Kulkarni wrote: Hi , I am having the following code for drawing buttons in my project. I am having a button which has three images for 1 button .Namely one image for the rectangle and 2 images for the left and right side curves respectively. use nine-patch-drawables instead search for *.9.png files under SDK/platforms/*/data/res to see how they look like pskink -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Problem with StateListDrawables not found in 1.5 but there from 1.6 onwards
Thanks for the link Kostya, But my problem is that i cannot have my images under drawable folder and also cannot specify the image path in my XML for layout as and when the user wishes to change the theme , a new theme will be downloaded from the server and the new set of images will be loaded at runtime ,, So if my button has a yellow color when it has focus it might become red when user changes theme.So all the three images for a button will change at runtime..So all my drawables need to be kept in the runtime application folder ie data/data/appPackage/themes which i am doing curently.. Is the 9 patch image logic useful in this case ? The statelistdrawable works fine if i have only one image for a Widget.But in case of button i have three images which is not working 1.6 onwards.. Thanks, Alok. 2010/5/5 Kostya Vasilyev kmans...@gmail.com Nine-patch described here: http://developer.android.com/guide/topics/graphics/2d-graphics.html#nine-patch -- Kostya Alok Kulkarni kulsu...@gmail.com писал(а) в своём письме Wed, 05 May 2010 12:25:11 +0400: For 9 patch images i suppose they need to be stored under drawable folder. I need to change the images according to theme at runtime. On Wed, May 5, 2010 at 12:52 PM, skink psk...@gmail.com wrote: Alok Kulkarni wrote: Hi , I am having the following code for drawing buttons in my project. I am having a button which has three images for 1 button .Namely one image for the rectangle and 2 images for the left and right side curves respectively. use nine-patch-drawables instead search for *.9.png files under SDK/platforms/*/data/res to see how they look like pskink -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com android-developers%2bunsubscr...@googlegroups.comandroid-developers%252bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Написано в почтовом клиенте браузера Opera: http://www.opera.com/mail/ -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Problem with StateListDrawables not found in 1.5 but there from 1.6 onwards
thanks skink , i will look into it .. and will update it over here.. 2010/5/5 Alok Kulkarni kulsu...@gmail.com Thanks for the link Kostya, But my problem is that i cannot have my images under drawable folder and also cannot specify the image path in my XML for layout as and when the user wishes to change the theme , a new theme will be downloaded from the server and the new set of images will be loaded at runtime ,, So if my button has a yellow color when it has focus it might become red when user changes theme.So all the three images for a button will change at runtime..So all my drawables need to be kept in the runtime application folder ie data/data/appPackage/themes which i am doing curently.. Is the 9 patch image logic useful in this case ? The statelistdrawable works fine if i have only one image for a Widget.But in case of button i have three images which is not working 1.6 onwards.. Thanks, Alok. 2010/5/5 Kostya Vasilyev kmans...@gmail.com Nine-patch described here: http://developer.android.com/guide/topics/graphics/2d-graphics.html#nine-patch -- Kostya Alok Kulkarni kulsu...@gmail.com писал(а) в своём письме Wed, 05 May 2010 12:25:11 +0400: For 9 patch images i suppose they need to be stored under drawable folder. I need to change the images according to theme at runtime. On Wed, May 5, 2010 at 12:52 PM, skink psk...@gmail.com wrote: Alok Kulkarni wrote: Hi , I am having the following code for drawing buttons in my project. I am having a button which has three images for 1 button .Namely one image for the rectangle and 2 images for the left and right side curves respectively. use nine-patch-drawables instead search for *.9.png files under SDK/platforms/*/data/res to see how they look like pskink -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com android-developers%2bunsubscr...@googlegroups.comandroid-developers%252bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Написано в почтовом клиенте браузера Opera: http://www.opera.com/mail/ -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Problem with StateListDrawables not found in 1.5 but there from 1.6 onwards
Can you show me an example if possible ? 2010/5/5 Alok Kulkarni kulsu...@gmail.com thanks skink , i will look into it .. and will update it over here.. 2010/5/5 Alok Kulkarni kulsu...@gmail.com Thanks for the link Kostya, But my problem is that i cannot have my images under drawable folder and also cannot specify the image path in my XML for layout as and when the user wishes to change the theme , a new theme will be downloaded from the server and the new set of images will be loaded at runtime ,, So if my button has a yellow color when it has focus it might become red when user changes theme.So all the three images for a button will change at runtime..So all my drawables need to be kept in the runtime application folder ie data/data/appPackage/themes which i am doing curently.. Is the 9 patch image logic useful in this case ? The statelistdrawable works fine if i have only one image for a Widget.But in case of button i have three images which is not working 1.6 onwards.. Thanks, Alok. 2010/5/5 Kostya Vasilyev kmans...@gmail.com Nine-patch described here: http://developer.android.com/guide/topics/graphics/2d-graphics.html#nine-patch -- Kostya Alok Kulkarni kulsu...@gmail.com писал(а) в своём письме Wed, 05 May 2010 12:25:11 +0400: For 9 patch images i suppose they need to be stored under drawable folder. I need to change the images according to theme at runtime. On Wed, May 5, 2010 at 12:52 PM, skink psk...@gmail.com wrote: Alok Kulkarni wrote: Hi , I am having the following code for drawing buttons in my project. I am having a button which has three images for 1 button .Namely one image for the rectangle and 2 images for the left and right side curves respectively. use nine-patch-drawables instead search for *.9.png files under SDK/platforms/*/data/res to see how they look like pskink -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com android-developers%2bunsubscr...@googlegroups.comandroid-developers%252bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Написано в почтовом клиенте браузера Opera: http://www.opera.com/mail/ -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: Problem with StateListDrawables not found in 1.5 but there from 1.6 onwards
Okay i have a question here .. I am trying to use the draw9patch tool in the sdk folder. I took an image btn_media_player.9 from the SDK folder path which skink had given In the code i did the following String path = data/data/com.android.test.themes/default/images/btn_media_player.9.png; Drawable npd = NinePatchDrawable.createFromPath(path); btn.setBackgroundDrawable(npd); But this is not working.. The image is getting stretched.I have attached the screenshot. Am i doing anything wrong ? On Wed, May 5, 2010 at 3:52 PM, skink psk...@gmail.com wrote: On May 5, 6:46 am, Alok Kulkarni kulsu...@gmail.com wrote: Can you show me an example if possible ? use this ctor: http://developer.android.com/intl/fr/reference/android/graphics/drawable/NinePatchDrawable.html#NinePatchDrawable(android.content.res.Resourceshttp://developer.android.com/intl/fr/reference/android/graphics/drawable/NinePatchDrawable.html#NinePatchDrawable%28android.content.res.Resources , android.graphics.Bitmap, byte[], android.graphics.Rect, java.lang.String) pskink -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=enattachment: 9 patched.JPG
Re: [android-developers] Re: Problem with StateListDrawables not found in 1.5 but there from 1.6 onwards
Kostya, even the spinner didnt work as expected.. Its image too got expanded.Though i gave it to a button. I have attached screen shots 1st one has 2 images left one is larger text and right one is smaller text The white border on the left and right hand side of the button is expanding for larger text which is what i dont want ... The 2nd image is the spinner image On Wed, May 5, 2010 at 5:51 PM, Alok Kulkarni kulsu...@gmail.com wrote: Does not make any difference between both ir CreateFromStream and CreateFromPath Apparantly i am having a problem creatnig the image in the Draw9 patch.. I have attached the screen shot. I can see that the corners are getting stretched even when i have specified stretching at the centre.. Help please :):) On Wed, May 5, 2010 at 4:49 PM, skink psk...@gmail.com wrote: On May 5, 8:48 am, Alok Kulkarni kulsu...@gmail.com wrote: Okay i have a question here .. I am trying to use the draw9patch tool in the sdk folder. I took an image btn_media_player.9 from the SDK folder path which skink had given In the code i did the following String path = data/data/com.android.test.themes/default/images/btn_media_player.9.png; Drawable npd = NinePatchDrawable.createFromPath(path); btn.setBackgroundDrawable(npd); But this is not working.. The image is getting stretched.I have attached the screenshot. Am i doing anything wrong ? try createFromStream pskink -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=enattachment: Difference.JPGattachment: spinner.JPG
Re: [android-developers] Re: Problem with StateListDrawables not found in 1.5 but there from 1.6 onwards
Thanks a lot Kostya for those links..You and Skink have attended to my problems patiently throughout the day :) I tried the following Bitmap bmp = BitmapFactory.decodeFile(data/data/com.android.test.themes/fin2.9.png); byte[] bmpChunks = bmp.getNinePatchChunk(); NinePatchDrawable npd2 = new NinePatchDrawable(bmp, bmpChunks, npd.getBounds(), fin2.9.png); i didnt know what to give as the 3rd and 4th parameter to NinePatchDrawable construcor so the third parameter ie Rect was a rectangle returned by the same button drawable object which was created earlier. My bitmap object bmp is getting created but the getNinePatchChunk() method is returning null. The doc for this function itself says :- Returns an optional array of private data, used by the UI system for some bitmaps. Not intended to be called by applications. So apparantly i am not getting a solution to this problem.. Is there any other way out .. :( :( Thanks, Alok On Wed, May 5, 2010 at 7:58 PM, skink psk...@gmail.com wrote: On May 5, 11:30 am, Kostya Vasilyev kmans...@gmail.com wrote: Alok, Found this discussion about creating nine-patches programmatically. Hope this is useful. also NinePatchDrawable sources will be useful, see inflate() method http://www.netmite.com/android/mydroid/donut/frameworks/base/graphics/java/android/graphics/drawable/NinePatchDrawable.java pskink -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] EditText Image changing look when given at runtime.
Hi guys, I am having an EditText. If i specify image for the EditText in the layout XML file (android:background) it looks different and looks different when i specify it at runtime EditText et = (EditText)findViewById(R.drawable.et1); et.setBackgroundDrawable(Main.themes.getDrawable(EDRAWABLES.EditTextBackgroundImage)); Both codes point to the same image. When i specify the image at runtime , the EditText leaves a margin at the top and bottom of the cursor in the edittext which does not happen when i do it in XML. I have attached the screenshots of both images. Top image is the one drawn from XML and bottom one is given at runtime. I am not getting the difference ? Actually i am facing similar problems with other Widgets too if i change the logic of specifying the drawable at runtime and not at compile time.. Is this the default SDK behaviour ? Thanks, Alok -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=enattachment: EditTextProblem.JPG
Re: [android-developers] Re: Problem with StateListDrawables not found in 1.5 but there from 1.6 onwards
Yes i had created the image fin2.9.png using draw9patch tool.Frankly speaking i am not getting how to use the second method :) Its going like a bouncer to me :) Thanks a lot, Alok 2010/5/5 Kostya Vasilyev kmans...@gmail.com Are you using a NinePatch file (fin2.9.png) created with Android's draw9patch tool? If not, you should be, as a test. The docs say that the ninepatch chunk is stored as a chunk in the 9.png file itself - the lines along the edges of the image are just there for convenience. If that doesn't help, maybe you could try one of the other method for loading the bitmap. -- Kostya Alok Kulkarni kulsu...@gmail.com писал(а) в своём письме Wed, 05 May 2010 19:35:40 +0400: Thanks a lot Kostya for those links..You and Skink have attended to my problems patiently throughout the day :) I tried the following Bitmap bmp = BitmapFactory.decodeFile(data/data/com.android.test.themes/fin2.9.png); byte[] bmpChunks = bmp.getNinePatchChunk(); NinePatchDrawable npd2 = new NinePatchDrawable(bmp, bmpChunks, npd.getBounds(), fin2.9.png); i didnt know what to give as the 3rd and 4th parameter to NinePatchDrawable construcor so the third parameter ie Rect was a rectangle returned by the same button drawable object which was created earlier. My bitmap object bmp is getting created but the getNinePatchChunk() method is returning null. The doc for this function itself says :- Returns an optional array of private data, used by the UI system for some bitmaps. Not intended to be called by applications. So apparantly i am not getting a solution to this problem.. Is there any other way out .. :( :( Thanks, Alok On Wed, May 5, 2010 at 7:58 PM, skink psk...@gmail.com wrote: On May 5, 11:30 am, Kostya Vasilyev kmans...@gmail.com wrote: Alok, Found this discussion about creating nine-patches programmatically. Hope this is useful. also NinePatchDrawable sources will be useful, see inflate() method http://www.netmite.com/android/mydroid/donut/frameworks/base/graphics/java/android/graphics/drawable/NinePatchDrawable.java pskink -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com android-developers%2bunsubscr...@googlegroups.comandroid-developers%252bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Kostya Vasilyev - WiFi Manager + pretty widget - http://kmansoft.wordpress.com/sw -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: Problem with StateListDrawables not found in 1.5 but there from 1.6 onwards
It would be great if you could help me giving an example of using the inflate method and the NinePatchDrawable constructor. Thanks, Alok. 2010/5/5 Alok Kulkarni kulsu...@gmail.com Yes i had created the image fin2.9.png using draw9patch tool.Frankly speaking i am not getting how to use the second method :) Its going like a bouncer to me :) Thanks a lot, Alok 2010/5/5 Kostya Vasilyev kmans...@gmail.com Are you using a NinePatch file (fin2.9.png) created with Android's draw9patch tool? If not, you should be, as a test. The docs say that the ninepatch chunk is stored as a chunk in the 9.png file itself - the lines along the edges of the image are just there for convenience. If that doesn't help, maybe you could try one of the other method for loading the bitmap. -- Kostya Alok Kulkarni kulsu...@gmail.com писал(а) в своём письме Wed, 05 May 2010 19:35:40 +0400: Thanks a lot Kostya for those links..You and Skink have attended to my problems patiently throughout the day :) I tried the following Bitmap bmp = BitmapFactory.decodeFile(data/data/com.android.test.themes/fin2.9.png); byte[] bmpChunks = bmp.getNinePatchChunk(); NinePatchDrawable npd2 = new NinePatchDrawable(bmp, bmpChunks, npd.getBounds(), fin2.9.png); i didnt know what to give as the 3rd and 4th parameter to NinePatchDrawable construcor so the third parameter ie Rect was a rectangle returned by the same button drawable object which was created earlier. My bitmap object bmp is getting created but the getNinePatchChunk() method is returning null. The doc for this function itself says :- Returns an optional array of private data, used by the UI system for some bitmaps. Not intended to be called by applications. So apparantly i am not getting a solution to this problem.. Is there any other way out .. :( :( Thanks, Alok On Wed, May 5, 2010 at 7:58 PM, skink psk...@gmail.com wrote: On May 5, 11:30 am, Kostya Vasilyev kmans...@gmail.com wrote: Alok, Found this discussion about creating nine-patches programmatically. Hope this is useful. also NinePatchDrawable sources will be useful, see inflate() method http://www.netmite.com/android/mydroid/donut/frameworks/base/graphics/java/android/graphics/drawable/NinePatchDrawable.java pskink -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com android-developers%2bunsubscr...@googlegroups.comandroid-developers%252bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Kostya Vasilyev - WiFi Manager + pretty widget - http://kmansoft.wordpress.com/sw -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Set Image resource as package path in XML for runtime images
Hi, Can i do this :- Set the image background path as package:imageName Example.. At runtime , my package is com.test.android .Inside that i have an image whose path i want to mention in the XML layout file as android:src = com.test.android/img1 for an ImageButton. I saw an SDK reference for ImageView as android:src = @[+][package:]type:name .. But i am not getting how to use it.. I think it must not be possibe , but if there is any way , please specify.. The reason why i want to do this is that , when i specify a drawable at runtime for my image buttons, i change the images according to Focus received , or onKeyup, KeyDown.. but its not working as expected.When i mention the same thing as style under drawable , it works fine. So if my theme is going to change at runtime , i want to set the drawable at runtime , keepnig the path same in the xml. Thanks , Alok -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email 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: Set Image resource as package path in XML for runtime images
Attached is a sample OK button screen shot seen on the UI The left one is created using XML as follows Button android:id=@+id/btnAddPlaylistOK android:layout_height=wrap_content android:text=OK android:layout_gravity=center_horizontal android:textColor=@color/white android:textStyle=bold android:typeface=normal android:clickable=true android:background=@drawable/button_style android:drawableLeft=@drawable/button_left_style android:drawableRight=@drawable/button_right_style android:gravity=center_vertical|center_horizontal|center android:layout_width=55px android:layout_marginTop=10dip android:layout_marginLeft=30dip And in drawable ,* button_style.xml *?xml version=1.0 encoding=utf-8? selector xmlns:android=http://schemas.android.com/apk/res/android; item android:drawable=@drawable/btns_mid_up_320x480 / /selector* button_left_style.xml* ?xml version=1.0 encoding=utf-8? selector xmlns:android=http://schemas.android.com/apk/res/android; item android:drawable=@drawable/btns_lft_up_320x480 / /selector ?xml version=1.0 encoding=utf-8? item android:drawable=@drawable/btns_rt_up_320x480 / /selector *button_right_style.xml* ?xml version=1.0 encoding=utf-8? selector xmlns:android=http://schemas.android.com/apk/res/android; item android:drawable=@drawable/btns_rt_up_320x480 / /selector Now insead of using the style in xml , i am trying to do that in code. The defination of Button is same in the XML except the android:background=@drawable/button_style android:drawableLeft=@drawable/button_left_style android:drawableRight=@drawable/button_right_style have been removed and inseat , i have done the following in code . btn.setBackgroundDrawable(getResources().getDrawable( R.drawable.btns_mid_up_320x480)); btn.setCompoundDrawablesWithIntrinsicBounds(getResources().getDrawable( R.drawable.btns_lft_up_320x480), null, getResources() .getDrawable(R.drawable.btns_rt_up_320x480), null); The right image in the attached screen shot shows that everything is distored. I tried adjusting the layout_width, layout_heighyt , but its not working.. Thanks, Alok On Mon, Apr 19, 2010 at 4:29 PM, Alok Kulkarni kulsu...@gmail.com wrote: Hi, Can i do this :- Set the image background path as package:imageName Example.. At runtime , my package is com.test.android .Inside that i have an image whose path i want to mention in the XML layout file as android:src = com.test.android/img1 for an ImageButton. I saw an SDK reference for ImageView as android:src = @[+][package:]type:name .. But i am not getting how to use it.. I think it must not be possibe , but if there is any way , please specify.. The reason why i want to do this is that , when i specify a drawable at runtime for my image buttons, i change the images according to Focus received , or onKeyup, KeyDown.. but its not working as expected.When i mention the same thing as style under drawable , it works fine. So if my theme is going to change at runtime , i want to set the drawable at runtime , keepnig the path same in the xml. Thanks , Alok -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=enattachment: Ok btn.JPG
Re: [android-developers] Re: Database insertion timings
@Walter, i tried that out. Instead of sb.toString() , i put the insert statement string over there with Compile statement format.. Its taking *27* *seconds *!! The database schema is as follows Table *Artist* id Integer Primary Key name nvarchar(200) Table *Album* name nvarchar(200) label nvarchar(200) multiple_artists integer artist_id integer id integer Primary Key Table *Songs* artist_id integer album_id integer id integer Primary Key name nvarchar(200) On Mon, Apr 12, 2010 at 9:26 PM, Dave Johnston john...@gmail.com wrote: On Apr 12, 7:50 am, Alok Kulkarni kulsu...@gmail.com wrote: Hi, I am inserting around 7000 to 8000 records in my database having 4 tables each having 3 to 4 columns.Its taking me around 22 seconds to do the insertion which is i think is too long. Can you post the schema of the database you're inserting into? -d -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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: Database insertion timings
I do not have any indices for my tables at all. Each of the tables Artist, Albumn and Songs has 4,5,5 columns respectively. Using Raw query as Yahel said improves the speed to some extent . Inserting 7000 records takes 18 seconds instead of 22 but thats not much as in total , i am going to insert 3 to 4 entries , which will take hell lot of time.. Using raw queries is not much helpful as the data itself might contain quotes and double quotes. Thanks , Alok. On Tue, Apr 13, 2010 at 11:32 AM, Bob Kerns r...@acm.org wrote: It is often better to insert all the data and THEN create the indexes. I couldn't tell you about Sqlite. You may want to create the primary index, but create all the other indexes later. On Apr 12, 5:33 pm, Zsolt Vasvari zvasv...@gmail.com wrote: No, database writing is extremely slow especially with many indecies. In my app, I am getting maybe 10 insers a seconds into a table with 20 columns and 15 indecies. As my app is probably 99.9% reads, I didn't try optimizing the writes too much, not sure if it's even possible. On Apr 13, 12:33 am, Yahel kaye...@gmail.com wrote: Ok, you are right if the pre and the iphone are 10x faster, it can't be right. I don't see anything wrong in your code, so only two things come to mind : - Instead of using ContentValues, try to create an insert sql statement and send it to via SQLiteDatabase.execSQL to see if there is any improvement - Maybe it's not the database writing that is slow but the reading from wherever your getting the data ? Yahel On 12 avr, 12:31, Alok Kulkarni kulsu...@gmail.com wrote: Ok, @Yahel:- For the insertion of same records on a Palm device(Say Palm Pre) , its taking 3 seconds.. On an IPhone , its taking 1 or 2 seconds.. Here is an example of what i am doing.. private Boolean addAlbumDB(int AlbumId, String Name, String Label, int MultipleArtists, int ArtistId) { long result = -1; try { ContentValues initialValues = new ContentValues(); initialValues.put(KEY_ID, AlbumId); initialValues.put(KEY_NAME, Name); initialValues.put(KEY_LABEL, Label); initialValues.put(KEY_ARTIST_ID, ArtistId); initialValues.put(KEY_MULTIPLE_ARTISTS, MultipleArtists); result = db.insert(DATABASE_TABLE, null, initialValues); } catch (Exception e) { Log.i(Exception in addAlbumDB, + e.toString()); return false; } if (result == -1) return false; return true; } The above function is called for around 2000 times.. Similarly there are 2 3 more functions for other tables. Thanks, Alok. On Mon, Apr 12, 2010 at 2:33 PM, Michael Rueger mike.rue...@gmail.comwrote: On 4/12/2010 10:59 AM, Yahel wrote: Hi Alok, Posting some logic, or some sql would help us see if you are missing something :) (excessive) use of indices comes to mind :-) Michael Yahel On 12 avr, 08:50, Alok Kulkarnikulsu...@gmail.com wrote: Hi, I am inserting around 7000 to 8000 records in my database having 4 tables each having 3 to 4 columns.Its taking me around 22 seconds to do the insertion which is i think is too long. I am using transaction while doing this without which its taking around 55 seconds. According to SQLite documentation , inserting 1 records in a database takes time around 2 to 3 seconds. Am i missing something , or is the behaviour correct? Thanks, Alok -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.comandroid-developers%2Bunsubs cr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject.- Hide quoted text - - Show quoted text - -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group
Re: [android-developers] Re: Database insertion timings
@mobDev, Ending transaction On Tue, Apr 13, 2010 at 12:59 PM, Alok Kulkarni kulsu...@gmail.com wrote: I do not have any indices for my tables at all. Each of the tables Artist, Albumn and Songs has 4,5,5 columns respectively. Using Raw query as Yahel said improves the speed to some extent . Inserting 7000 records takes 18 seconds instead of 22 but thats not much as in total , i am going to insert 3 to 4 entries , which will take hell lot of time.. Using raw queries is not much helpful as the data itself might contain quotes and double quotes. Thanks , Alok. On Tue, Apr 13, 2010 at 11:32 AM, Bob Kerns r...@acm.org wrote: It is often better to insert all the data and THEN create the indexes. I couldn't tell you about Sqlite. You may want to create the primary index, but create all the other indexes later. On Apr 12, 5:33 pm, Zsolt Vasvari zvasv...@gmail.com wrote: No, database writing is extremely slow especially with many indecies. In my app, I am getting maybe 10 insers a seconds into a table with 20 columns and 15 indecies. As my app is probably 99.9% reads, I didn't try optimizing the writes too much, not sure if it's even possible. On Apr 13, 12:33 am, Yahel kaye...@gmail.com wrote: Ok, you are right if the pre and the iphone are 10x faster, it can't be right. I don't see anything wrong in your code, so only two things come to mind : - Instead of using ContentValues, try to create an insert sql statement and send it to via SQLiteDatabase.execSQL to see if there is any improvement - Maybe it's not the database writing that is slow but the reading from wherever your getting the data ? Yahel On 12 avr, 12:31, Alok Kulkarni kulsu...@gmail.com wrote: Ok, @Yahel:- For the insertion of same records on a Palm device(Say Palm Pre) , its taking 3 seconds.. On an IPhone , its taking 1 or 2 seconds.. Here is an example of what i am doing.. private Boolean addAlbumDB(int AlbumId, String Name, String Label, int MultipleArtists, int ArtistId) { long result = -1; try { ContentValues initialValues = new ContentValues(); initialValues.put(KEY_ID, AlbumId); initialValues.put(KEY_NAME, Name); initialValues.put(KEY_LABEL, Label); initialValues.put(KEY_ARTIST_ID, ArtistId); initialValues.put(KEY_MULTIPLE_ARTISTS, MultipleArtists); result = db.insert(DATABASE_TABLE, null, initialValues); } catch (Exception e) { Log.i(Exception in addAlbumDB, + e.toString()); return false; } if (result == -1) return false; return true; } The above function is called for around 2000 times.. Similarly there are 2 3 more functions for other tables. Thanks, Alok. On Mon, Apr 12, 2010 at 2:33 PM, Michael Rueger mike.rue...@gmail.comwrote: On 4/12/2010 10:59 AM, Yahel wrote: Hi Alok, Posting some logic, or some sql would help us see if you are missing something :) (excessive) use of indices comes to mind :-) Michael Yahel On 12 avr, 08:50, Alok Kulkarnikulsu...@gmail.com wrote: Hi, I am inserting around 7000 to 8000 records in my database having 4 tables each having 3 to 4 columns.Its taking me around 22 seconds to do the insertion which is i think is too long. I am using transaction while doing this without which its taking around 55 seconds. According to SQLite documentation , inserting 1 records in a database takes time around 2 to 3 seconds. Am i missing something , or is the behaviour correct? Thanks, Alok -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.comandroid-developers%2Bunsubs cr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject.- Hide quoted text - - Show quoted text - -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android
Re: [android-developers] Re: Database insertion timings
@mobDev, I have followed some links , example http://www.higherpass.com/Android/Tutorials/Accessing-Data-With-Android-Cursors/3/ where they were doing setTransactionSuccessful before ending transaction. Removing that statement does not have an effect. Even if i do say String tempName = Artist; String tempVal = Enrique; int tempId = 0; for(i = 0;i 7000;i++) { tempId++; addArtistDB(tempID,tempName,tempVal1); } It takes 20 seconds .So there is not much time required for accessing the data i want to put into database. The actual insertion itself is taking so much time. As Sqlite is native to Android , i assume it must be fast enough. One more thing , Same amount of insertions on a Windows Mobile Device , using a Third Party SQLite DLL , its taking 5 to 6 seconds.. Its not that i am blaming android , but i am getting frustrated now :( :( Thanks , Alok. On Tue, Apr 13, 2010 at 1:07 PM, Alok Kulkarni kulsu...@gmail.com wrote: @mobDev, Ending transaction On Tue, Apr 13, 2010 at 12:59 PM, Alok Kulkarni kulsu...@gmail.comwrote: I do not have any indices for my tables at all. Each of the tables Artist, Albumn and Songs has 4,5,5 columns respectively. Using Raw query as Yahel said improves the speed to some extent . Inserting 7000 records takes 18 seconds instead of 22 but thats not much as in total , i am going to insert 3 to 4 entries , which will take hell lot of time.. Using raw queries is not much helpful as the data itself might contain quotes and double quotes. Thanks , Alok. On Tue, Apr 13, 2010 at 11:32 AM, Bob Kerns r...@acm.org wrote: It is often better to insert all the data and THEN create the indexes. I couldn't tell you about Sqlite. You may want to create the primary index, but create all the other indexes later. On Apr 12, 5:33 pm, Zsolt Vasvari zvasv...@gmail.com wrote: No, database writing is extremely slow especially with many indecies. In my app, I am getting maybe 10 insers a seconds into a table with 20 columns and 15 indecies. As my app is probably 99.9% reads, I didn't try optimizing the writes too much, not sure if it's even possible. On Apr 13, 12:33 am, Yahel kaye...@gmail.com wrote: Ok, you are right if the pre and the iphone are 10x faster, it can't be right. I don't see anything wrong in your code, so only two things come to mind : - Instead of using ContentValues, try to create an insert sql statement and send it to via SQLiteDatabase.execSQL to see if there is any improvement - Maybe it's not the database writing that is slow but the reading from wherever your getting the data ? Yahel On 12 avr, 12:31, Alok Kulkarni kulsu...@gmail.com wrote: Ok, @Yahel:- For the insertion of same records on a Palm device(Say Palm Pre) , its taking 3 seconds.. On an IPhone , its taking 1 or 2 seconds.. Here is an example of what i am doing.. private Boolean addAlbumDB(int AlbumId, String Name, String Label, int MultipleArtists, int ArtistId) { long result = -1; try { ContentValues initialValues = new ContentValues(); initialValues.put(KEY_ID, AlbumId); initialValues.put(KEY_NAME, Name); initialValues.put(KEY_LABEL, Label); initialValues.put(KEY_ARTIST_ID, ArtistId); initialValues.put(KEY_MULTIPLE_ARTISTS, MultipleArtists); result = db.insert(DATABASE_TABLE, null, initialValues); } catch (Exception e) { Log.i(Exception in addAlbumDB, + e.toString()); return false; } if (result == -1) return false; return true; } The above function is called for around 2000 times.. Similarly there are 2 3 more functions for other tables. Thanks, Alok. On Mon, Apr 12, 2010 at 2:33 PM, Michael Rueger mike.rue...@gmail.comwrote: On 4/12/2010 10:59 AM, Yahel wrote: Hi Alok, Posting some logic, or some sql would help us see if you are missing something :) (excessive) use of indices comes to mind :-) Michael Yahel On 12 avr, 08:50, Alok Kulkarnikulsu...@gmail.com wrote: Hi, I am inserting around 7000 to 8000 records in my database having 4 tables each having 3 to 4 columns.Its taking me around 22 seconds to do the insertion which is i think is too long. I am using transaction while doing this without which its taking around 55 seconds. According to SQLite documentation , inserting 1 records in a database takes time around 2 to 3 seconds. Am i missing something , or is the behaviour correct? Thanks, Alok -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers
Re: [android-developers] Re: Problem accessing Layer-List items
Actually i do not have anyidea regarding this :0 I refered to that code given on a forum .. Its really workng nice , but according to different themes , i need to change the color of primary and secondary progress .. Any way on how to do that ? Thanks, Alok. On Mon, Apr 12, 2010 at 8:46 PM, MobDev developm...@mobilaria.com wrote: hhmm, are you sure they are getting a layer-id if they are not specified as layers ? I have no experience in that but I see that those already have a R-id and you are trying to use that same id as a layer-id ? On 12 apr, 15:48, Alok Kulkarni kulsu...@gmail.com wrote: Hi guys I have a Style declared as follows *XML:* ?xml version=1.0 encoding=utf-8? layer-list xmlns:android=http://schemas.android.com/apk/res/android; item android:id=@android:id/background android:drawable= @drawable/progbar2_320x480 /item item android:id=@android:id/secondaryProgress clip shape solid android:color=#4A7116 / /shape /clip /item item android:id=@android:id/progress clip shape solid android:color=#95BB1C / /shape /clip /item /layer-list I want to change the color of progressbar and secondary progressbar at runtime. How can i do that.. There is a function in LayerDrawable as * * findDrawableByLayerId(android.R.id.progress); or * * findDrawableByLayerId(android.R.id.secondaryProgress); but i am not getting how to use that.. Thanks , Alok -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Database insertion timings
Hi, I am inserting around 7000 to 8000 records in my database having 4 tables each having 3 to 4 columns.Its taking me around 22 seconds to do the insertion which is i think is too long. I am using transaction while doing this without which its taking around 55 seconds. According to SQLite documentation , inserting 1 records in a database takes time around 2 to 3 seconds. Am i missing something , or is the behaviour correct? Thanks, Alok -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject.
Re: [android-developers] Re: Database insertion timings
Ok, @Yahel:- For the insertion of same records on a Palm device(Say Palm Pre) , its taking 3 seconds.. On an IPhone , its taking 1 or 2 seconds.. Here is an example of what i am doing.. private Boolean addAlbumDB(int AlbumId, String Name, String Label, int MultipleArtists, int ArtistId) { long result = -1; try { ContentValues initialValues = new ContentValues(); initialValues.put(KEY_ID, AlbumId); initialValues.put(KEY_NAME, Name); initialValues.put(KEY_LABEL, Label); initialValues.put(KEY_ARTIST_ID, ArtistId); initialValues.put(KEY_MULTIPLE_ARTISTS, MultipleArtists); result = db.insert(DATABASE_TABLE, null, initialValues); } catch (Exception e) { Log.i(Exception in addAlbumDB, + e.toString()); return false; } if (result == -1) return false; return true; } The above function is called for around 2000 times.. Similarly there are 2 3 more functions for other tables. Thanks, Alok. On Mon, Apr 12, 2010 at 2:33 PM, Michael Rueger mike.rue...@gmail.comwrote: On 4/12/2010 10:59 AM, Yahel wrote: Hi Alok, Posting some logic, or some sql would help us see if you are missing something :) (excessive) use of indices comes to mind :-) Michael Yahel On 12 avr, 08:50, Alok Kulkarnikulsu...@gmail.com wrote: Hi, I am inserting around 7000 to 8000 records in my database having 4 tables each having 3 to 4 columns.Its taking me around 22 seconds to do the insertion which is i think is too long. I am using transaction while doing this without which its taking around 55 seconds. According to SQLite documentation , inserting 1 records in a database takes time around 2 to 3 seconds. Am i missing something , or is the behaviour correct? Thanks, Alok -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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: Database insertion timings
I have started the transaction before the 1st insert , and ended it after the last insert Thanks, Alok. On Mon, Apr 12, 2010 at 4:01 PM, Alok Kulkarni kulsu...@gmail.com wrote: Ok, @Yahel:- For the insertion of same records on a Palm device(Say Palm Pre) , its taking 3 seconds.. On an IPhone , its taking 1 or 2 seconds.. Here is an example of what i am doing.. private Boolean addAlbumDB(int AlbumId, String Name, String Label, int MultipleArtists, int ArtistId) { long result = -1; try { ContentValues initialValues = new ContentValues(); initialValues.put(KEY_ID, AlbumId); initialValues.put(KEY_NAME, Name); initialValues.put(KEY_LABEL, Label); initialValues.put(KEY_ARTIST_ID, ArtistId); initialValues.put(KEY_MULTIPLE_ARTISTS, MultipleArtists); result = db.insert(DATABASE_TABLE, null, initialValues); } catch (Exception e) { Log.i(Exception in addAlbumDB, + e.toString()); return false; } if (result == -1) return false; return true; } The above function is called for around 2000 times.. Similarly there are 2 3 more functions for other tables. Thanks, Alok. On Mon, Apr 12, 2010 at 2:33 PM, Michael Rueger mike.rue...@gmail.comwrote: On 4/12/2010 10:59 AM, Yahel wrote: Hi Alok, Posting some logic, or some sql would help us see if you are missing something :) (excessive) use of indices comes to mind :-) Michael Yahel On 12 avr, 08:50, Alok Kulkarnikulsu...@gmail.com wrote: Hi, I am inserting around 7000 to 8000 records in my database having 4 tables each having 3 to 4 columns.Its taking me around 22 seconds to do the insertion which is i think is too long. I am using transaction while doing this without which its taking around 55 seconds. According to SQLite documentation , inserting 1 records in a database takes time around 2 to 3 seconds. Am i missing something , or is the behaviour correct? Thanks, Alok -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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: Database insertion timings
This is a standard class DatabaseHelper extending SQLiteOpenHelper... private static class DatabaseHelper extends SQLiteOpenHelper { DatabaseHelper(Context context, String databaseName) { super(context, databaseName, null, DATABASE_VERSION); } @Override public void onCreate(SQLiteDatabase db) { // Nothing to do } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { Log .w(Upgrade, Upgrading database from version + oldVersion + to + newVersion + , which will destroy all old data); db.execSQL(DROP TABLE IF EXISTS titles); onCreate(db); } } Then i have private SQLiteDatabase db; This db object is used to perform insert operations. Thanks, Alok. // ---opens the database--- public void open() throws SQLException { db = DBHelper.getWritableDatabase(); } On Mon, Apr 12, 2010 at 6:20 PM, MobDev developm...@mobilaria.com wrote: do you have some code specifically showing the sequence and the syntax ? AAfaik a transaction SHOULD make it faster accroding to this documentation : http://web.utk.edu/~jplyon/sqlite/SQLite_optimization_FAQ.html#transactionshttp://web.utk.edu/%7Ejplyon/sqlite/SQLite_optimization_FAQ.html#transactions On 12 apr, 12:32, Alok Kulkarni kulsu...@gmail.com wrote: I have started the transaction before the 1st insert , and ended it after the last insert Thanks, Alok. On Mon, Apr 12, 2010 at 4:01 PM, Alok Kulkarni kulsu...@gmail.com wrote: Ok, @Yahel:- For the insertion of same records on a Palm device(Say Palm Pre) , its taking 3 seconds.. On an IPhone , its taking 1 or 2 seconds.. Here is an example of what i am doing.. private Boolean addAlbumDB(int AlbumId, String Name, String Label, int MultipleArtists, int ArtistId) { long result = -1; try { ContentValues initialValues = new ContentValues(); initialValues.put(KEY_ID, AlbumId); initialValues.put(KEY_NAME, Name); initialValues.put(KEY_LABEL, Label); initialValues.put(KEY_ARTIST_ID, ArtistId); initialValues.put(KEY_MULTIPLE_ARTISTS, MultipleArtists); result = db.insert(DATABASE_TABLE, null, initialValues); } catch (Exception e) { Log.i(Exception in addAlbumDB, + e.toString()); return false; } if (result == -1) return false; return true; } The above function is called for around 2000 times.. Similarly there are 2 3 more functions for other tables. Thanks, Alok. On Mon, Apr 12, 2010 at 2:33 PM, Michael Rueger mike.rue...@gmail.com wrote: On 4/12/2010 10:59 AM, Yahel wrote: Hi Alok, Posting some logic, or some sql would help us see if you are missing something :) (excessive) use of indices comes to mind :-) Michael Yahel On 12 avr, 08:50, Alok Kulkarnikulsu...@gmail.com wrote: Hi, I am inserting around 7000 to 8000 records in my database having 4 tables each having 3 to 4 columns.Its taking me around 22 seconds to do the insertion which is i think is too long. I am using transaction while doing this without which its taking around 55 seconds. According to SQLite documentation , inserting 1 records in a database takes time around 2 to 3 seconds. Am i missing something , or is the behaviour correct? Thanks, Alok -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com android-developers%2bunsubscr...@googlegroups.comandroid-developers%252bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more
[android-developers] Problem accessing Layer-List items
Hi guys I have a Style declared as follows *XML:* ?xml version=1.0 encoding=utf-8? layer-list xmlns:android=http://schemas.android.com/apk/res/android; item android:id=@android:id/background android:drawable= @drawable/progbar2_320x480 /item item android:id=@android:id/secondaryProgress clip shape solid android:color=#4A7116 / /shape /clip /item item android:id=@android:id/progress clip shape solid android:color=#95BB1C / /shape /clip /item /layer-list I want to change the color of progressbar and secondary progressbar at runtime. How can i do that.. There is a function in LayerDrawable as * * findDrawableByLayerId(android.R.id.progress); or * * findDrawableByLayerId(android.R.id.secondaryProgress); but i am not getting how to use that.. Thanks , Alok -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject.
Re: [android-developers] Re: Database insertion timings
Before the 1st insert call i am doing db.beginTransaction(); for(i = 0 i 2000 ; i++) addAlbumDB(); for(i = 0 i 3000 ; i++) addArtistDB(); for(i = 0 i 2000 ; i++) addSongDB(); try { db.setTransactionSuccessful(); } finally { db.endTransaction(); } On Mon, Apr 12, 2010 at 7:18 PM, MobDev developm...@mobilaria.com wrote: I don't see a specific transaction ??? Anyways transaction should only be used if you have multiple actions you are doing on your database (like several insert/update operations)... On 12 apr, 15:43, Alok Kulkarni kulsu...@gmail.com wrote: This is a standard class DatabaseHelper extending SQLiteOpenHelper... private static class DatabaseHelper extends SQLiteOpenHelper { DatabaseHelper(Context context, String databaseName) { super(context, databaseName, null, DATABASE_VERSION); } @Override public void onCreate(SQLiteDatabase db) { // Nothing to do } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { Log .w(Upgrade, Upgrading database from version + oldVersion + to + newVersion + , which will destroy all old data); db.execSQL(DROP TABLE IF EXISTS titles); onCreate(db); } } Then i have private SQLiteDatabase db; This db object is used to perform insert operations. Thanks, Alok. // ---opens the database--- public void open() throws SQLException { db = DBHelper.getWritableDatabase(); } On Mon, Apr 12, 2010 at 6:20 PM, MobDev developm...@mobilaria.com wrote: do you have some code specifically showing the sequence and the syntax ? AAfaik a transaction SHOULD make it faster accroding to this documentation : http://web.utk.edu/~jplyon/sqlite/SQLite_optimization_FAQ.html#transa..http://web.utk.edu/%7Ejplyon/sqlite/SQLite_optimization_FAQ.html#transa.. .http://web.utk.edu/%7Ejplyon/sqlite/SQLite_optimization_FAQ.html#tran.. . On 12 apr, 12:32, Alok Kulkarni kulsu...@gmail.com wrote: I have started the transaction before the 1st insert , and ended it after the last insert Thanks, Alok. On Mon, Apr 12, 2010 at 4:01 PM, Alok Kulkarni kulsu...@gmail.com wrote: Ok, @Yahel:- For the insertion of same records on a Palm device(Say Palm Pre) , its taking 3 seconds.. On an IPhone , its taking 1 or 2 seconds.. Here is an example of what i am doing.. private Boolean addAlbumDB(int AlbumId, String Name, String Label, int MultipleArtists, int ArtistId) { long result = -1; try { ContentValues initialValues = new ContentValues(); initialValues.put(KEY_ID, AlbumId); initialValues.put(KEY_NAME, Name); initialValues.put(KEY_LABEL, Label); initialValues.put(KEY_ARTIST_ID, ArtistId); initialValues.put(KEY_MULTIPLE_ARTISTS, MultipleArtists); result = db.insert(DATABASE_TABLE, null, initialValues); } catch (Exception e) { Log.i(Exception in addAlbumDB, + e.toString()); return false; } if (result == -1) return false; return true; } The above function is called for around 2000 times.. Similarly there are 2 3 more functions for other tables. Thanks, Alok. On Mon, Apr 12, 2010 at 2:33 PM, Michael Rueger mike.rue...@gmail.com wrote: On 4/12/2010 10:59 AM, Yahel wrote: Hi Alok, Posting some logic, or some sql would help us see if you are missing something :) (excessive) use of indices comes to mind :-) Michael Yahel On 12 avr, 08:50, Alok Kulkarnikulsu...@gmail.com wrote: Hi, I am inserting around 7000 to 8000 records in my database having 4 tables each having 3 to 4 columns.Its taking me around 22 seconds to do the insertion which is i think is too long. I am using transaction while doing this without which its taking around 55 seconds. According to SQLite documentation , inserting 1 records in a database takes time around 2 to 3 seconds. Am i missing something , or is the behaviour correct? Thanks, Alok -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com android-developers%2bunsubscr...@googlegroups.comandroid
Re: [android-developers] Re: Database insertion timings
Each of these above functions insert records in 3 seperate tables in the same database. Thanks , Alok On Mon, Apr 12, 2010 at 7:51 PM, Alok Kulkarni kulsu...@gmail.com wrote: Before the 1st insert call i am doing db.beginTransaction(); for(i = 0 i 2000 ; i++) addAlbumDB(); for(i = 0 i 3000 ; i++) addArtistDB(); for(i = 0 i 2000 ; i++) addSongDB(); try { db.setTransactionSuccessful(); } finally { db.endTransaction(); } On Mon, Apr 12, 2010 at 7:18 PM, MobDev developm...@mobilaria.com wrote: I don't see a specific transaction ??? Anyways transaction should only be used if you have multiple actions you are doing on your database (like several insert/update operations)... On 12 apr, 15:43, Alok Kulkarni kulsu...@gmail.com wrote: This is a standard class DatabaseHelper extending SQLiteOpenHelper... private static class DatabaseHelper extends SQLiteOpenHelper { DatabaseHelper(Context context, String databaseName) { super(context, databaseName, null, DATABASE_VERSION); } @Override public void onCreate(SQLiteDatabase db) { // Nothing to do } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { Log .w(Upgrade, Upgrading database from version + oldVersion + to + newVersion + , which will destroy all old data); db.execSQL(DROP TABLE IF EXISTS titles); onCreate(db); } } Then i have private SQLiteDatabase db; This db object is used to perform insert operations. Thanks, Alok. // ---opens the database--- public void open() throws SQLException { db = DBHelper.getWritableDatabase(); } On Mon, Apr 12, 2010 at 6:20 PM, MobDev developm...@mobilaria.com wrote: do you have some code specifically showing the sequence and the syntax ? AAfaik a transaction SHOULD make it faster accroding to this documentation : http://web.utk.edu/~jplyon/sqlite/SQLite_optimization_FAQ.html#transa..http://web.utk.edu/%7Ejplyon/sqlite/SQLite_optimization_FAQ.html#transa.. .http://web.utk.edu/%7Ejplyon/sqlite/SQLite_optimization_FAQ.html#tran.. . On 12 apr, 12:32, Alok Kulkarni kulsu...@gmail.com wrote: I have started the transaction before the 1st insert , and ended it after the last insert Thanks, Alok. On Mon, Apr 12, 2010 at 4:01 PM, Alok Kulkarni kulsu...@gmail.com wrote: Ok, @Yahel:- For the insertion of same records on a Palm device(Say Palm Pre) , its taking 3 seconds.. On an IPhone , its taking 1 or 2 seconds.. Here is an example of what i am doing.. private Boolean addAlbumDB(int AlbumId, String Name, String Label, int MultipleArtists, int ArtistId) { long result = -1; try { ContentValues initialValues = new ContentValues(); initialValues.put(KEY_ID, AlbumId); initialValues.put(KEY_NAME, Name); initialValues.put(KEY_LABEL, Label); initialValues.put(KEY_ARTIST_ID, ArtistId); initialValues.put(KEY_MULTIPLE_ARTISTS, MultipleArtists); result = db.insert(DATABASE_TABLE, null, initialValues); } catch (Exception e) { Log.i(Exception in addAlbumDB, + e.toString()); return false; } if (result == -1) return false; return true; } The above function is called for around 2000 times.. Similarly there are 2 3 more functions for other tables. Thanks, Alok. On Mon, Apr 12, 2010 at 2:33 PM, Michael Rueger mike.rue...@gmail.com wrote: On 4/12/2010 10:59 AM, Yahel wrote: Hi Alok, Posting some logic, or some sql would help us see if you are missing something :) (excessive) use of indices comes to mind :-) Michael Yahel On 12 avr, 08:50, Alok Kulkarnikulsu...@gmail.com wrote: Hi, I am inserting around 7000 to 8000 records in my database having 4 tables each having 3 to 4 columns.Its taking me around 22 seconds to do the insertion which is i think is too long. I am using transaction while doing this without which its taking around 55 seconds. According to SQLite documentation , inserting 1 records in a database takes time around 2 to 3 seconds. Am i missing something , or is the behaviour correct? Thanks, Alok -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe