android - ListView of Contacts -


I should have a list view of my contacts I use the Google sample code The problem is that I have a single contact repeatedly Gym

  • Jim
  • Jim
  • Jim <
  • Anna
  • Anna
  • Anna
  • ...

    How do I make a separate list of my contacts Can I get it?

      Expands LISTView List of Public Class Contacts LoaderManager.LoaderCallbacks & lt; Cursor & gt; {Simple cursor adapter mAdapter; Fixed final string [] Projection = new string [] {ContactsContract.Data._ID, ContactsContract.Data.DISPLAY_NAME}; Fixed Last String Selection = Contact Contact Contact. IN_VISIBLE_GROUP + "= '" + ("1") + "'"; @ Override Protected Zero (Bundle Saved Instantstate) {Super. NET (Saved Instantstate); // progress progress bar to progress progress bar display progress bar = progress bar = new progress bar (this); Progress Bar. Seat Output (New Layout Prarm (WRAP_CONTENT, Gravity.CENTER);) ProgressBar.setIndeterminate (true); GetListView () setEmptyView (Progressbar) // should add the progress bar to the original of the layout ViewGroup root = (ViewGroup) findViewById (android.R.id.content); root.addView (Progressbar); // For cursor adapter, specify which columns are entered from the string [] columns = {ContactsContract.Data.DISPLAY_NAME}; Int [] toViews = {android.R.id.text1}; // TextView in simple_list_item_1 // Create an empty adapter We will use to display the loaded data. // We pass the null to the cursor, then update it to onload () mAdapter = New SimpleCaptor Adapter (this, Android R.Lt.simple_l_l_item_1_1, empty, from column, to view, 0); setListAdapter (mAdapter); // Prepare the loader, either reconnect with the existing one, // or Get a new start GetLoaderManager (). InitLoader (0, empty, this); } // is called when a new loader public loader & lt; Cursor & gt; OnCreateLoader (int id, bundle arguments) {// will now create a cursor loader and return it which will make the cursor // to display the data. Return the new cursor loader (this, contact contact data. CONTENT_URI, projection, selection, blank, contact communication .DISPLAY_NAME + "COLLATE LOCALIZED ASC"); } // When a previously created loader has loaded loaded on public Zero (collar> loader, cursor data) {// Swap the new cursor.) MAdapter.swapCursor (data); } // When a pre-built loader is reset, on the call, the data is not available on the public zero onLoaderReset (loader & lt; cursor & gt; loader) // // it is called when onLoadFinished () // provided above The last cursor to be done is to be closed. We need to make sure that we do not use it / not mAdapter.swapCursor (zero); } @ Override Public Wide OnlistEystemClick (ListView L, View V, Int Position, Long ID) {// String Item Value = (string) l.getItemAtPosition (status); }}    

    [line] in your line with string [contact] Contact] from Data.DISPLAY_NAME}; Try

      contactsContract.Data.DISPLAY_NAME   

      instead of contacts  .contacts.DISPLAY_NAME_PRIMARY < / Code>  

    You can represent any number or email address of that data or whatever you can read, while contacts are one Individuals representing entries

  • Comments

    Popular posts from this blog

    Java - Error: no suitable method found for add(int, java.lang.String) -

    java - JPA TypedQuery: Parameter value element did not match expected type -

    c++ - static template member variable has internal linkage but is not defined -