-1

I want to display country flags with respect to phone-numbers in my contact lists like rebtel(Screen shot shown below).

enter image description here

Lucifer
  • 29,392
  • 25
  • 90
  • 143
Gangadhar Nimballi
  • 1,534
  • 3
  • 18
  • 46

3 Answers3

1

Parse the phone number and get the international prefix, then you can use Wikipedia: List_of_country_calling_codes to get the country. You can implement a Map with key being the international prefix and key the country name.

jabaldonedo
  • 25,822
  • 8
  • 77
  • 77
  • I am getting international prefix with http://stackoverflow.com/questions/16809508/extract-code-country-from-phone-number-libphonenumber/16835306#16835306 – Gangadhar Nimballi Apr 01 '14 at 10:09
1

Here I am giving you the logic part,

You can get the ISD code and flag image from this link http://en.wikipedia.org/wiki/List_of_country_calling_codes#Alphabetical_listing_by_country_or_region

You need to make two Array variables,

 String [] countryCode  = new String { "+91","+92", ... };
 int [] country = new int { R.drawable.91.png, R.drawable.92.png,.... };

 // Considering here 91.png is india's map

Now get the phone number from contact list , suppose you have +91987654321. So remove first + sign and compare 91 to all the resources images. When match found, put that image with the contact.

Lucifer
  • 29,392
  • 25
  • 90
  • 143
1

You can use this library for your Requirement.

Go to detail you can show country flag and country code with use of this.

Pranav P
  • 1,755
  • 19
  • 39