private void saveRecents() {
   StringBuilder str = new StringBuilder();
   int c = size();
   for (int i = 0; i < c; i++) {
     Emojicon e = get(i);
     str.append(e.getEmoji());
     if (i < (c - 1)) {
       str.append(EmojiconRecentsManager.DELIMITER);
     }
   }
   SharedPreferences prefs = getPreferences();
   prefs.edit().putString(PREF_RECENTS, str.toString()).commit();
 }
Exemplo n.º 2
0
 @Override
 public View getView(int position, View convertView, ViewGroup parent) {
   View v = convertView;
   if (v == null) {
     v = View.inflate(getContext(), R.layout.emojicon_item, null);
     ViewHolder holder = new ViewHolder();
     holder.icon = (TextView) v.findViewById(R.id.emojicon_icon);
     v.setTag(holder);
   }
   Emojicon emoji = getItem(position);
   ViewHolder holder = (ViewHolder) v.getTag();
   holder.icon.setText(emoji.getEmoji());
   return v;
 }
 private void loadRecents() {
   SharedPreferences prefs = getPreferences();
   String str = prefs.getString(PREF_RECENTS, "");
   StringTokenizer tokenizer = new StringTokenizer(str, EmojiconRecentsManager.DELIMITER);
   while (tokenizer.hasMoreTokens()) {
     add(Emojicon.fromChars(tokenizer.nextToken()));
   }
 }