Wednesday, December 18, 2013

[android-developers] How to implement Tagging Functionality?

I am trying to implement tagging functionality in my app. When user enter "," then string before "," will be select as a tag and background color i need to assign this string(tag) so user can understand this is tag.
See following image.  

And after clicking backspace(Android soft keyboard button) then background color of the previous tag will change and if I click backspace again then previous tag will remove from EditText.

See following image.

Here what i done yet.

int i = 0;  names.addTextChangedListener(new TextWatcher() {          @Override          public void onTextChanged(CharSequence s, int start, int before, int count) {              if(s.equals(","))              {                  String strTag = names.getText().toString();                  int txtLength = strTag.length()+3;                   tagArrray[i] = strTag;                   i++;                   names.setText("#"+strTag+"  ");                   names.setSelection(txtLength, txtLength);              }          }          @Override          public void afterTextChanged(Editable arg0) {              // TODO Auto-generated method stub                        }            @Override          public void beforeTextChanged(CharSequence arg0, int arg1,                  int arg2, int arg3) {              // TODO Auto-generated method stub                        }            });   

Where i stuck

  • How to assign background to string(tag) which is in EditText(or border to that string).
  • On clicking backspace change background color of last tag(may be i have two tag like "android", "Droid" then it will change color of "Droid" and clicking again backspace remove "Droid").

Please give me some hint or reference.

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
---
You received this message because you are subscribed to the Google Groups "Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate