[android-developers] Get details of contact in single query
Hi all I am trying to get contact information from the contact database using ContentResolver with these field want to get name, number, FORMATTED_ADDRESS, PHOTO details for a contact in one single query. So basically I need to make 3 queries per contact to obtain these details. What I want to know is that, is there a simpler and more efficient way to achieve what this. but using the below code i am getting exception. java.lang.IllegalArgumentException: Invalid column data1 Can any body help me for finding the solution for the same. Uri uri= ContactsContract.Contacts.CONTENT_URI; String[] projection= new String[] { ContactsContract.Contacts._ID, ContactsContract.Contacts.DISPLAY_NAME, ContactsContract.CommonDataKinds.Phone.NUMBER, ContactsContract.CommonDataKinds.StructuredPostal.FORMATTED_ADDRESS, ContactsContract.CommonDataKinds.Photo.PHOTO}; String selection = ContactsContract.Contacts.HAS_PHONE_NUMBER + = '1'; String[] selectionArgs = null; String sortOrder = ContactsContract.Contacts.DISPLAY_NAME + COLLATE LOCALIZED ASC; Cursor contacts = getContentResolver().query(uri, projection, selection, selectionArgs, sortOrder); -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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 details of contact in single query
Thanks Asheesh for your reply but it uses Contect URI Contacts.People which is depricated http://developer.android.com/reference/android/provider/Contacts.People.html it is suggected to use ContactsContracthttp://developer.android.com/reference/android/provider/ContactsContract.html in place of Contact.People, but using ContactsContracthttp://developer.android.com/reference/android/provider/ContactsContract.html we have to make separate query and have separate cursor for each query i.e. PHONE, ADDRESS, PHOTO, ORGANISATION.etc, and i am using CursorAdapter for displaying these information in the list and it can accept only one cursor. Thanks Anieeh. On Friday, June 15, 2012 9:54:03 AM UTC+5:30, asheesh arya wrote: just go through this link http://thinkandroid.wordpress.com/2010/01/19/retrieving-contact-information-name-number-and-profile-picture/ -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] How to get Connections of Linkedin profile in android
Hi all I am trying to get the Connections or user's friends info from LinkedIn using LinkedIn jar and example in google code google code, but i wont get Connections using linkedInApiClient.getConnectionsForCurrentUser() this method call it returns null, but i can access user current profile info using linkedInApiClient.getProfileForCurrentUser() can any body suggest me how to get User connections information in linkedIn in android. Or guide me the the wright way. Thanks in Advance. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Total Available memory for Memory Management logic.
Hi all I am having problem with releasing memory problem, i have a Hashmap in which i am adding Bitmap object, and the no. of bitmaps are quite large. for this reason i am getting OutOfMemoryError. So for this i have decided to release Bitmap whic is least used from Collection, on memory crunch or system getting low heap memory. For getting current memory available i used ActivityManager.MemoryInfo.availMem but it gives total RAM size memory, not Available Heap memory. And i found that this memory is not getting updated on releasing Bitmap from collection. Then i have used these three method Debug.getNativeHeapAllocatedSize() Debug.getNativeHeapFreeSize() Debug.getNativeHeapSize() but found the NativeHeapSize goes on increasing upto some certain say 16MB changing after that an outOfMemoryError occur. In this also i found that the NativeHeapAllocatedSize and getNativeHeapSize not decreasing on releasing Bitmap from collection. So please help me for solving the problem if anyone facing the same problem and fixed earlier it. My problem is i want to calculate Max Available application memory allocated and currently available memory, for such that if currently available memory goes beyond the Threshold memory i will release some Bitmap from the collection and GC will reclaim the memory and free it without generating error. Thanks in advance Anieeh -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email 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: Total Available memory for Memory Management logic.
Thanks Latimerius For your quick reply, yes i need an early warning (even before you actually run out of heap) because after an error occur OutOfMemory and then if i release some memory and restart the same operation it will give the same error since the GC wont collect the free memory as soon as we released some bitmap memory. And the same will happen over and over, and it increase the overhead of re-Starting the same task. Thanks in Advance Anieeh On Apr 25, 9:12 pm, Latimerius l4t1m3r...@googlemail.com wrote: I asked a similar question recently: http://groups.google.com/group/android-developers/browse_thread/threa... Check it out, Romain gave some good explanations there. If you'd just like to free some memory on out-of-memory condition you shouldn't need exact numbers (those are hard to get as explained in the linked topic). Why don't you just catch OutOfMemoryError and handle it by freeing your least recently used bitmaps, then perhaps restart the operation that caused the fault? Do you need an early warning (even before you actually run out of heap) for some reason? On Wed, Apr 25, 2012 at 5:57 PM, Anieeh animesh.andr...@gmail.com wrote: Hi all I am having problem with releasing memory problem, i have a Hashmap in which i am adding Bitmap object, and the no. of bitmaps are quite large. for this reason i am getting OutOfMemoryError. So for this i have decided to release Bitmap whic is least used from Collection, on memory crunch or system getting low heap memory. For getting current memory available i used ActivityManager.MemoryInfo.availMem but it gives total RAM size memory, not Available Heap memory. And i found that this memory is not getting updated on releasing Bitmap from collection. Then i have used these three method Debug.getNativeHeapAllocatedSize() Debug.getNativeHeapFreeSize() Debug.getNativeHeapSize() but found the NativeHeapSize goes on increasing upto some certain say 16MB changing after that an outOfMemoryError occur. In this also i found that the NativeHeapAllocatedSize and getNativeHeapSize not decreasing on releasing Bitmap from collection. So please help me for solving the problem if anyone facing the same problem and fixed earlier it. My problem is i want to calculate Max Available application memory allocated and currently available memory, for such that if currently available memory goes beyond the Threshold memory i will release some Bitmap from the collection and GC will reclaim the memory and free it without generating error. Thanks in advance Anieeh -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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] Re: Re : passing data between activities
Hi Vivek you have created Intent for starting activity and passed intent as a parameter in startActivity(Intent) method like this in A class Intent intent = new Intent(this, B.class); intent.putExtra(Voilation1, USING CELLULAR PHONE WHILE DRIVING(H)); intent.putExtra(Place1,chetpet signal); startActivity(intent); And In Class B Retrieve values in onCreate() method like this String strVoilation1 = getIntent().getStringExtra(Voilation1); String strPlace1 = getIntent().getStringExtra(Place1); That's it Or you can put the Serialized object or parceble object in the intent in your case you have a list of object of Voilations and Places, create a model class of it add each object in the ArrayList and put ArrayList into Intent, since ArrayList implemented serializable interface you can add it into intent. And get serialized object from other activity as a key value object from the intent. Thanks Regards Animesh Sinha On Mar 26, 3:53 pm, vivek elangovan elangovan.vi...@gmail.com wrote: Using DOMParser i m getting values and passing it to my IInd activity.In my IInd activity i need to display like this Violation : USING CELLULAR PHONE WHILE DRIVING(H) Place : chetpet signal Violation : WITHOUT HELMET Place : Tnagar signal On Monday, March 26, 2012 4:20:26 PM UTC+5:30, vivek elangovan wrote: Hi, This is how my xml looks like remarks offense violationWITHOUT HELMET/violation rule177-A/rule amnt100/amnt date26-3-2012/date placechetpet signal/place /offense offense violationUSING CELLULAR PHONE WHILE DRIVING(H)/violation rule177-H/rule amnt1000/amnt date20-3-2012 /date placeTnagar signal /place /offense /remarks On Monday, March 26, 2012 3:03:38 PM UTC+5:30, vivek elangovan wrote: hi members, I am having two activities in my project, In my Ist activity i m getting two values from my loop (for eg : Violation : WITHOUT HELMET and Violation : USING CELLULAR PHONE WHILE DRIVING(H) ) using putExtra i am passing these values to my IInd activity,what i need to display here is like this : violation : WITHOUT HELMET place : some place Violation : USING CELLULAR PHONE WHILE DRIVING(H) place : some place -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Extended Application life time.
hi all I have extended application class and in that i have kept an model object for global access which is single ton class and i have a service which runs continuously in background when no activity is running. And this background service uses that model object kept in Application class. Is our application instance will remain in memory when no activity is running and our service is running in background? or application object killed and our service will run continuously . so that Service will get the model object from Application. Thanks Anieeh -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email 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: Extended Application life time.
Thanks mark for your quick reply Terminate the process you mean user force stop the application or by memory crunch when android kills the service and application both. Actually my service is running continuously for syncing location to server at particular interval, Is there any better way to do this without using or running continuously in background. Thanks Anieeh On Feb 15, 6:54 pm, Mark Murphy mmur...@commonsware.com wrote: On Wed, Feb 15, 2012 at 8:50 AM, Anieeh animesh.andr...@gmail.com wrote: i have a service which runs continuously in background when no activity is running. This is not generally a good idea, unless the user specifically requested it (e.g., music player). Users think developers who create everlasting services are morons and go to great lengths to attack such apps with task killers, force stop in Settings, etc. And this background service uses that model object kept in Application class. Is our application instance will remain in memory when no activity is running and our service is running in background? Until the user or Android terminates your process, yes. or application object killed and our service will run continuously . so that Service will get the model object from Application. The Application object only goes away when the process does. -- Mark Murphy (a Commons Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy _Android Programming Tutorials_ Version 4.1 Available! -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Extended Application life time.
Thanks Mark I will do changes as you said, you have raised a good point an given suggestion for service force stop. Thanks Anieeh On Feb 15, 7:32 pm, Mark Murphy mmur...@commonsware.com wrote: On Wed, Feb 15, 2012 at 9:11 AM, Anieeh animesh.andr...@gmail.com wrote: for your quick reply Terminate the process you mean user force stop the application or by memory crunch when android kills the service and application both. All of the above. Actually my service is running continuously for syncing location to server at particular interval, Is there any better way to do this without using or running continuously in background. Absolutely. Use AlarmManager and an IntentService, please. -- Mark Murphy (a Commons Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy _Android Programming Tutorials_ Version 4.1 Available! -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: AlarmManager does not fire?
I think you have not registered Receiver in Activity with receiver object and intentFilter registerReceiver(android.content.BroadcastReceiver receiver, android.content.IntentFilter filter) Animesh S. Sinha. On Jan 27, 5:00 pm, Rudolf Polzer rudolf.pol...@i-r-p.de wrote: This is the stack when the receiver crashes: ActivityThread.handleReceiver(ActivityThread$ReceiverData) line: 2616 ActivityThread.access$3100(ActivityThread, ActivityThread $ReceiverData) line: 119 ActivityThread$H.handleMessage(Message) line: 1913 ActivityThread$H(Handler).dispatchMessage(Message) line: 99 -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Managing resources such as images, themes, colors.
Hi all I have an application which has two client and for both client i have different resources i.e. there images are different, themes are different, fonts, styles, etc. But my code base is same for both. And i have used XMLs for all above described item. How can i manage images, themes, etc. by changing single config variable or some other way such that if i build an app for one client the other client's resource should not be added in APK. Can anyone know how to solve this problem please help me. Thanks in Advance Anieeh -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Managing resources such as images, themes, colors.
Thanks for quick reply Skink but i am developing application on window is there any way on that. Thanks and regards Anieeh on linux you could create symbolic link to your res folder - this is how i'd do it withiout any effort 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.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Managing resources such as images, themes, colors.
Off-course Skink but all of sudden i cant change a platform, are you using Ubuntu or anything else and hows your developing platform, is it user friendly?, because i cant invest time to explore different platform my company wont give that much time. Thanks again. On Jan 25, 3:12 pm, skink psk...@gmail.com wrote: Anieeh wrote: Thanks for quick reply Skink but i am developing application on window is there any way on that. no idea then, or wait, change your platdorm - win32 is not for real developement :) 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.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Adjusting zoom level according to local area, city, country level area.
Hi all i am developing an application on which i am using Google maps using with MapView, and i am using Geocoder class for Geo coding and reverse-geocoding and i want to set a zoom level according to the place i search i.e. city, country, etc. zoom levels. Google maps app does this, but dont know how but i havent found any Google map API for such that thing. As well as i havent found any zoom level parameter in Geocoder or reverse-Geocoder class response such that i can set those value in the MapController.setZoom() method. Plz help me to find this solution if any one knows. Thanks in advance. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Regarding Call Intent
Hi Nageswara i hope i am getting your point of problem. Its very simple just call this intent and start an activity Intent callIntent = new Intent(Intent.ACTION_CALL); callIntent.setData(Uri.parse(tel:*Your Tel ph. No*)); startActivity(callIntent); And Give Permission in AndroidManifest for call. i.e. uses-permission android:name=android.permission.CALL_PHONE/ Hopefully it will solve your problem Thanks Regards Animesh S. Sinha. On Oct 22, 7:31 am, nageswara rao rajana nagu.raj...@gmail.com wrote: Hi, I am developing application in which when i click on button a call to particular number. Any one help me please. Thanking you. Nagu. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Broadcast receiver Activity is in foreground or stop.
Thanx Ali For your quick reply I have tried this in different way i.e. i am putting one boolean variable called isAppInFront in Application extended class and i am keep on updating this variable form onStart() and onStop() method but the problem is as i have said i have many activity so while switching one activity to another activity i.e. activityA and acivityB, activityA starts activityB in that activityB's onStart() method calls first and then activityA's onStop() so in that case may variable will not hold actual states. And i think the same Problem will have with the permanent Storage. But i have solved this temporarily by setting isAppInFront variable on onStart() method of all Activity i have and desetting that variable only form the exit point of my app say Dashboard in on onBackPressed() method coz it is called earlier than previous screen's onStart method and never close your activity by saying finish() method just call onBackPressed() in that call super.onBackPressed(), and your activity get closed form this. Thanks Regards Animesh Sinha. On Oct 21, 2:12 am, Ali Chousein ali.chous...@gmail.com wrote: You know when onPause()-OnStop()-onDestroy() of your activities are called. Inside one of these methods write your state to permanent storage (e.g. DB, shared preferences, even plain text file, you name it). Later on you can read which state you are in from permanent storage. I don't know if there are better ways of doing this, but this simple approach should work. - Ali Chousein Weather-Buddyhttp://weatherbuddy.blogspot.com/|http://twitter.com/weather_buddy Geo-Filtered Assistanthttp://geo-filtered-assistant.blogspot.com/ -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Broadcast receiver Activity is in foreground or stop.
Hi All I am developing an alarm based application in which a broadcast receiver is set, i want to show a notification in the notification bar for alarm and i have done that but my problem is i want to show a notification on notification bar only if no other Activity is on foreground, if any Activity is in foreground i will create an activity and show above it about alarm and i have many activity in my application. So Plz help me find out how to know my application is in foreground or it is stopped/closed. Thanks in Advance. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en