How to Get a list of Emails that are available in Gmail app when i want to enter email id in an edittext?

How to Get a list of Emails that are available in Gmail app when i want to enter email id in an edittext?

You cannot achieve this through Edittext, you should use AutoCompleteTextView
<AutoCompleteTextView
android:id="@+id/autoCompleteTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
in you Activity File in onCreate
    AutoCompleteTextView autoComplete = (AutoCompleteTextView) findViewById(R.id.autoCompleteTextView); 
    String selectedEmail;
    List<String> emails = new ArrayList<>();
    Pattern emailPattern = Patterns.EMAIL_ADDRESS; // API level 8+
    //get runtime permission
    Account[] accounts = AccountManager.get(YourActivityName.this).getAccounts();
    int i=0;
    for (Account account : accounts) {
        if (emailPattern.matcher(account.name).matches()) {
            String possibleEmail = account.name+"\n";
            emails.add(possibleEmail);
        }
    }
   ArrayAdapter<String> adapter = new ArrayAdapter<String>
   (this,android.R.layout.simple_list_item_1,emails);
   autoComplete.setAdapter(adapter);
   //default selected email
   selectedEmail = emails.get(0);
   autoComplete.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
        @Override
        public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
            // You can get the user selected email here    
            String selectedEmail = emails.get(position)
        }
        @Override
        public void onNothingSelected(AdapterView<?> parent) {
        }
    });
in your manifest you need to add permission
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
if you are developing for API>=23(Marshmallow) then you also need to get runtime permissions. Follow this for runtime permissions
https://developer.android.com/training/permissions/requesting.html
 
    
    Anyone looking at this now this feature with this exact dialog is called Sign in Hints!
