Essentially I have it set up where the EditText field gets populated onClick (of a cell in ListView) to a certain word. I set that words color to green and it is green when present in the EditText field. Only issue is when I send that text to ListView, the text I set green in EditText is no longer green, it is the same color as the rest of the text. Anyone know of a solution for this?
public void onItemClick(AdapterView<?> a, View v, int position,
long id) {
int skull = R.drawable.image05;
Drawable image = getResources().getDrawable(skull);
if(images[imageId] == skull){
Toast.makeText(ChatRoom2.this, "Skull", Toast.LENGTH_LONG)
.show();
String next = "<font color='#13b602'>@Skull</font>";
editText.setText(Html.fromHtml(next));
editText.setSelection(editText.getText().length());
}
else{
Toast.makeText(ChatRoom2.this, "clicked", Toast.LENGTH_LONG)
.show();
}
The code above populates the EditText Field
addButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// String message2;
message = editText.getText().toString();
RowItems item = new RowItems(images[imageId], message);
if (message.isEmpty()){
Toast.makeText(ChatRoom2.this, "Say Something", Toast.LENGTH_LONG)
.show();
}
else {
adapter.add(item);
adapter.notifyDataSetChanged();
}
editText.setText("");
//minimize keyboard bitch
InputMethodManager imm = (InputMethodManager)getSystemService(Context.
INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);
}
});
The code above is when the message is sent to ListView