Append and set text to TextView
import android.view.MenuItem;
import android.widget.TextView;
class TextViewUtil {
public static void appendText(TextView tv, String text){
tv.setText(tv.getText() + text);
}
public static void appendMenuItemText(TextView tv, MenuItem menuItem){
String title = menuItem.getTitle().toString();
tv.setText(tv.getText()+ "_n" + title);
}
public static void emptyText(TextView tv){
tv.setText("");
}
public static void setText(TextView tv, String text){
tv.setText(text);
}
}
Related examples in the same category