简体   繁体   中英

Show QuickContact dialog

I have a Contact List app, where I need to asign to the contacts name the function to show QuickContact dialog window when touching it:

1个 2

At this moment, I do this procesing the QuickContactBadge that appears as a contact's thumbnail. This is, when I touch the thumbnail, it appears this dialog window.

This is the code snippet:

public class ContactsListFragment extends ListFragment implements AdapterView.OnItemClickListener, LoaderManager.LoaderCallbacks<Cursor> {
...

    private class ContactsAdapter extends CursorAdapter implements SectionIndexer {
    ...

        /** Generates the contact lookup Uri*/
        final Uri contactUri = Contacts.getLookupUri(
                cursor.getLong(ContactsQuery.ID),
                cursor.getString(ContactsQuery.LOOKUP_KEY));

        /** Binds the contact's lookup Uri to the QuickContactBadge*/
        holder.icon.assignContactUri(contactUri);

        /** Loads the thumbnail image pointed to by photoUri into the QuickContactBadge in a
         * background worker thread
         */
        mImageLoader.loadImage(photoUri, holder.icon);

After this, I've got this interface, that is called in other activity:

public interface OnContactsInteractionListener {
    /**
     * Called when a contact is selected from the ListView.
     * @param contactUri The contact Uri.
     */
    public void onContactSelected(Uri contactUri);

This is the main activity where this interface is called, and where I must implement the function to call to the QuickContact dialog window wich shows the contact information . This is what I don't know how to do.

public class ContactsListActivity extends FragmentActivity implements ContactsListFragment.OnContactsInteractionListener {
...

    public void onContactSelected(Uri contactUri) {
        //METHOD TO CALL QUICKCONTACT WINDOW
    }

只需调用此函数,我就能解决此问题:

QuickContact.showQuickContact(getActivity(), getListView(), uri, position, null);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM