Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5968291
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T20:04:09+00:00 2026-05-22T20:04:09+00:00

In Android messaging, when click on attach it open the list of content provider

  • 0

In Android messaging, when click on attach it open the list of content provider like Camera, Gallery, Audio, Video etc. How to open the same list on button click?
Like this :
enter image description here

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T20:04:10+00:00Added an answer on May 22, 2026 at 8:04 pm

    What you want is actually a little complex: you need to call a method like this in your Activity

    private void showAddAttachmentDialog() {
             AlertDialog.Builder builder = new AlertDialog.Builder(this);
             builder.setIcon(R.drawable.ic_dialog_attach);
             builder.setTitle(R.string.add_attachment);
    
             AttachmentTypeSelectorAdapter mAttachmentTypeSelectorAdapter = new AttachmentTypeSelectorAdapter(this, AttachmentTypeSelectorAdapter.MODE_WITH_SLIDESHOW);
             }
             builder.setAdapter(mAttachmentTypeSelectorAdapter, new DialogInterface.OnClickListener() {
                 public void onClick(DialogInterface dialog, int which) {
                     addAttachment(mAttachmentTypeSelectorAdapter.buttonToCommand(which), replace);
                     dialog.dismiss();
                 }
             });
    
             builder.show();
         }
    

    to show the dialog, and then this is the actual implementation of the selection adapter.

    package com.android.mms.ui;
    
    import com.android.mms.MmsConfig;
    import com.android.mms.R;
    
    import android.content.Context;
    
    import java.util.ArrayList;
    import java.util.List;
    
    /**
     * An adapter to store icons and strings for attachment type list.
     */
    public class AttachmentTypeSelectorAdapter extends IconListAdapter {
        public final static int MODE_WITH_SLIDESHOW    = 0;
        public final static int MODE_WITHOUT_SLIDESHOW = 1;
    
        public final static int ADD_IMAGE               = 0;
        public final static int TAKE_PICTURE            = 1;
        public final static int ADD_VIDEO               = 2;
        public final static int RECORD_VIDEO            = 3;
        public final static int ADD_SOUND               = 4;
        public final static int RECORD_SOUND            = 5;
        public final static int ADD_SLIDESHOW           = 6;
    
        public AttachmentTypeSelectorAdapter(Context context, int mode) {
            super(context, getData(mode, context));
        }
    
        public int buttonToCommand(int whichButton) {
            AttachmentListItem item = (AttachmentListItem)getItem(whichButton);
            return item.getCommand();
        }
    
        protected static List<IconListItem> getData(int mode, Context context) {
            List<IconListItem> data = new ArrayList<IconListItem>(7);
            addItem(data, context.getString(R.string.attach_image),
                    R.drawable.ic_launcher_gallery, ADD_IMAGE);
    
            addItem(data, context.getString(R.string.attach_take_photo),
                    R.drawable.ic_launcher_camera, TAKE_PICTURE);
    
            addItem(data, context.getString(R.string.attach_video),
                    R.drawable.ic_launcher_video_player, ADD_VIDEO);
    
            addItem(data, context.getString(R.string.attach_record_video),
                    R.drawable.ic_launcher_camera_record, RECORD_VIDEO);
    
            if (MmsConfig.getAllowAttachAudio()) {
                addItem(data, context.getString(R.string.attach_sound),
                        R.drawable.ic_launcher_musicplayer_2, ADD_SOUND);
            }
    
            addItem(data, context.getString(R.string.attach_record_sound),
                    R.drawable.ic_launcher_record_audio, RECORD_SOUND);
    
            if (mode == MODE_WITH_SLIDESHOW) {
                addItem(data, context.getString(R.string.attach_slideshow),
                        R.drawable.ic_launcher_slideshow_add_sms, ADD_SLIDESHOW);
            }
    
            return data;
        }
    
        protected static void addItem(List<IconListItem> data, String title,
                int resource, int command) {
            AttachmentListItem temp = new AttachmentListItem(title, resource, command);
            data.add(temp);
        }
    
        public static class AttachmentListItem extends IconListAdapter.IconListItem {
            private int mCommand;
    
            public AttachmentListItem(String title, int resource, int command) {
                super(title, resource);
    
                mCommand = command;
            }
    
            public int getCommand() {
                return mCommand;
            }
        }
    }
    

    This is actually how the messaging dialog does it (the class above is from the MMS app) and you can see all the gory details by going to https://android.googlesource.com/platform/packages/apps/Mms/+/master/src/com/android/mms/ui and looking at the ComposeMessageActivity’s showAddAttachmentDialog method and the AttachmentTypeSelectorAdapter.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to add Push messaging to my Phonegap Android App and believe
Is there a way to open up the Messaging Activity on android with a
I want to implement SMS text counter like feature as in Android default messaging
Is Android development restrictive in any way like the iPhone , or can you
Android's messaging app, located in projects/platform/packages/apps/Mms.git has a class called RecipientsEditor. I would like
After reading some posts like this one: Choose File Dialog It appears that Android
I am developing an android messaging application. Is there a good spam filtering algorithm
I know that the SMS content provider is not part of the public API
I'm writing an Android app which will be making use of the cloud-2-device messaging
My app has an instant messaging feature. So it has a contact list.. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.