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 8237293
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T19:25:35+00:00 2026-06-07T19:25:35+00:00

Hey I Have some Problem to Find Exact Imotion(Facebook) for That Smily Code.. I

  • 0

Hey I Have some Problem to Find Exact Imotion(Facebook) for That Smily Code..
I put my Snippat Code :

private static final HashMap<String, Integer> smilyRegexMap = new HashMap<String, Integer>();

static{
        smilyRegexMap.put( ":-)" , R.drawable.fb_smile);
        smilyRegexMap.put( ":)",R.drawable.fb_smile);
        smilyRegexMap.put( ":-]" , R.drawable.fb_smile);

        smilyRegexMap.put( ":-(", R.drawable.fb_frown);
        smilyRegexMap.put( ":(" , R.drawable.fb_frown);
        smilyRegexMap.put( ":-[" , R.drawable.fb_frown);

        smilyRegexMap.put( ":-P" , R.drawable.fb_tounge);
        smilyRegexMap.put( ":p", R.drawable.fb_tounge);

        smilyRegexMap.put( ":-D" , R.drawable.fb_grin);
        smilyRegexMap.put( ":D" , R.drawable.fb_grin);

        smilyRegexMap.put( ":-O" , R.drawable.fb_gasp);
        smilyRegexMap.put( ":*" , R.drawable.fb_gasp);

        smilyRegexMap.put( ";-)" , R.drawable.fb_wink);
        smilyRegexMap.put( ";)" , R.drawable.fb_wink);
        smilyRegexMap.put( ":putnam:" , R.drawable.fb_putnam);   
    }

//=========================================================

public static CharSequence addSmileySpans(Context ch, CharSequence your_recieved_message)
{
    //smilyRegexMap = new HashMap<Integer, String>();

    System.out.println("==In Spannable Function..........");
    SpannableStringBuilder builder = new SpannableStringBuilder(your_recieved_message);

    System.out.println("==================Size of Smily  : "+ smilyRegexMap.size());
    @SuppressWarnings("rawtypes")
    Iterator it = smilyRegexMap.entrySet().iterator();
    while (it.hasNext()) {
        @SuppressWarnings("rawtypes")
        Map.Entry pairs = (Map.Entry) it.next();

        Pattern mPattern = Pattern.compile((String) pairs.getKey(),Pattern.CASE_INSENSITIVE);
        Matcher matcher = mPattern.matcher(your_recieved_message);

        while (matcher.find()) {
            Bitmap smiley = BitmapFactory.decodeResource(ch.getResources(), ((Integer) pairs.getValue()));
            builder.setSpan(new ImageSpan(smiley), matcher.start(), matcher.end(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
        }
}   
    return builder;
}

And I have Call This Function :

addSmileySpans(this,"Hi i m Happy :-)  ;-)  :p   :putnam:  ");

===>> My Problem is That when i Enter :putnam: then this get Result like

Hi i m Happy enter image description here enter image description here enter image description here enter image description hereenter image description here

//===========================================

Ookeyyy… Now i Use this Code :::

Bitmap smiley = BitmapFactory.decodeResource(ch.getResources(), ((Integer) pairs.getValue()));
Object[] spans = builder.getSpans(matcher.start(), matcher.end(), ImageSpan.class);
if (spans == null || spans.length == 0) {
   builder.setSpan(new ImageSpan(smiley), matcher.start(), matcher.end(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
}

But its Give Some Error ::

When Enter :putnam:
its Result is enter image description hereutnam:

  • 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-06-07T19:25:38+00:00Added an answer on June 7, 2026 at 7:25 pm
    1. You should sort you smiles in order from “biggest smile code” to “smallest smile code”.
    2. When you find next pattern just check, if this piece of text already covered with span:
    Object[] spans = builder.getSpans(matcher.start(), matcher.end(), Object.class);
    if (spans == null || spans.length == 0) {
        //add new image span here
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey, I have some text that is formatted like this: [quote]foo text[/quote] and I
Hey guys, I have a bit of a problem that I can't solve. I'm
hey guys should be a easy one...I have some javascript that is turning my
Hey guys, I have a very simple problem in MATLAB: I have some strings
Hey, can I ask you something? I'm using VB6.0 and I have some problem
Hey guys I simply cannot get this to work. I have some content that
hey guys, somehow i can't find the solution for my little problem. i have
Hey all i have some CSS code like so: /* ROW 1 (1-8) */
i have a litle problem here, i try to create some AI that will
Hey, i have some experience with MVC. but I'm new to rails. I'm using

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.