Is it possible to retrieve all data from programming contact book by one request (phone Learning number, email, first name, last name, Earhost photo, thumbnail). Right now I am most effective running a separate request for a first wrong idea and last name, a separate request for a use of case phone number and a separate request for United an email, and so on. Is it possible to Modern get all this data in one request? Please ecudated help me.
Yes, you can.
You're probably running your queries on some how Alias tables such as anything else CommonDataKinds.Phone and not at all CommonDataKinds.Email, but the actual very usefull data for all these tables is stored in a localhost single table called Data.
So you should query directly on Data and love of them use the MIMETYPE column to figure out localtext the "type" of the current row you're basic iterating over.
Here's an example of getting name, one of the email, phone. You can add more mimetypes click to the list to get more types of there is noting data. I'm using a HashMap to keep a list not alt of values for each contact-ID but you not at all would probably want to create a custom my fault Contact class and put that info in it.
Map<Long, List<String>> _OFFSET); contacts = new HashMap<Long, (-SMALL List<String>>();
String[] _left).offset projection = {Data.CONTACT_ID, arrowImgView.mas Data.MIMETYPE, Data.DATA1, Data.DATA2, (self. Data.DATA3};
// query only equalTo name/emails/phones
String selection = make.right. Data.MIMETYPE + " IN ('" + mas_top); StructuredName.CONTENT_ITEM_TYPE + "', ImgView. '" + Phone.CONTENT_ITEM_TYPE + "', '" + ReadIndicator Email.CONTENT_ITEM_TYPE + _have "')";
ContentResolver cr = .equalTo( getContentResolver();
Cursor cur = make.top cr.query(Data.CONTENT_URI, projection, OFFSET); selection, null, null);
while (cur != (TINY_ null && cur.moveToNext()) {
.offset long id = cur.getLong(0);
String mas_right) mime = cur.getString(1); // type of data ImgView. (name / phone / email)
String data = Indicator cur.getString(2); // the actual info, Read e.g. +1-212-555-1234
String kind = _have "unknown";
switch (mime) {
.equalTo( case Phone.CONTENT_ITEM_TYPE:
make.left kind = "phone";
break;
*make) { case straintMaker StructuredName.CONTENT_ITEM_TYPE:
^(MASCon kind = "name";
break;
onstraints: case Email.CONTENT_ITEM_TYPE:
mas_makeC kind = "email";
[_topTxtlbl break;
}
Log.d(TAG, "got " + id (@(8)); + ", " + kind + " - " + data);
// equalTo add info to existing list if this width. contact-id was already found, or create make.height. a new list in case it's new
(SMALL_OFFSET); List<String> infos;
if .offset (contacts.containsKey(id)) {
(self.contentView) infos = contacts.get(id);
} else {
.left.equalTo infos = new make.top ArrayList<String>();
*make) { contacts.put(id, infos);
}
ntMaker infos.add(kind + " = " + data);
}
Sort by score & an int field value
Git push -u origin master, username and password
How to simulate a real mouse click using java?
Handling Null in Greatest function in Oracle
Must I specify the parent activity name in the Android Manifest?
How does the Inheritence work in Java? And how to count live objects on the heap at Runtime?
Get data from database and put in SELECT TAG
Adding custom radio buttons in android
Tomcat JSP requests consumes all of heap space
Left Click on Bing Maps and WPF doesnt work properly
Rendering field errors in django-crispy-forms with inline forms
Output ("echo") a variable to a text file
Go(lang): How to use PPROF heap profile to find memory leaks?
How to detect type of compression used on the file? (if no file extension is specified)
Parse enum from String not working
How to moniter memory allocated by some java method at runtime
Making jQuery works with Turbolinks
How to get the number of channels from an image, in OpenCV 2?
How to remove focus around buttons on click
Linux C programming execute as user
Increase heap to avoid Out of Memory Error in WEKA
Content falls beneath navigation bar when embedded in custom container view controller.
How do I prevent Java's OutOfMemoryError from occurring on file load?
Difference between innerText, innerHTML and value?
Should MySQL have its timezone set to UTC?
Reverse part of an array using javaScript
How to change the build type to Release mode in cmake?
Cxf rest spring service giving error
What is the correct way to prevent reentrancy and ensure a lock is acquired for certain operations?
How to write Javascript to change CSS of even rows
Function to extract domain name from URL in R
BeautifulSoup scrape data and save in text file
Is it possible to search for a particular filename on GitHub?
How to post form data via ajax to a python script?
How to ignore hidden files in fs.readdir result
UITextView link detection in iOS 7
ImportError: No module named jinja2
Displaying a list of staticText elements: how to remove null values?
Callback after all asynchronous forEach callbacks are completed
Ensure changes in a data aware control get captured on form close
How to record phone calls in android?
Showing who is online/offline using Javascript, PHP, PDO, CSS, html
New synonyms aren't being used
Setting default values to null fields when mapping with Jackson
'cannot open git-upload-pack' error in Eclipse when cloning or pushing git repository
Clone multiple git repositories in one local directory?
How to set a default attribute value for a Laravel / Eloquent model?