Example usage for android.widget TextView append

List of usage examples for android.widget TextView append

Introduction

In this page you can find the example usage for android.widget TextView append.

Prototype

public final void append(CharSequence text) 

Source Link

Document

Convenience method to append the specified text to the TextView's display buffer, upgrading it to android.widget.TextView.BufferType#EDITABLE if it was not already editable.

Usage

From source file:de.j4velin.mapsmeasure.Dialogs.java

/**
 * @param c the Context/*from   ww  w. j  a  va2  s  .  c o  m*/
 * @return the about dialog
 */
public static Dialog getAbout(final Context c) {
    AlertDialog.Builder builder = new AlertDialog.Builder(c);
    builder.setTitle(R.string.about);

    TextView tv = new TextView(c);
    int pad = (Util.dpToPx(c, 10));
    tv.setPadding(pad, pad, pad, pad);

    try {
        tv.setText(R.string.about_text);
        tv.append(c.getString(R.string.app_version,
                c.getPackageManager().getPackageInfo(c.getPackageName(), 0).versionName));
        tv.setMovementMethod(LinkMovementMethod.getInstance());
    } catch (NameNotFoundException e1) {
        // should not happen as the app is definitely installed when
        // seeing the dialog
        e1.printStackTrace();
    }
    builder.setView(tv);
    builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(final DialogInterface dialog, int which) {
            dialog.dismiss();
        }
    });
    return builder.create();
}

From source file:com.skalski.websocketsclient.ActivityMain.java

static void appendText(TextView textView, String text, int textColor) {

    int start;//w  ww.  j  a v a 2s.  com
    int end;

    start = textView.getText().length();
    textView.append(text);
    end = textView.getText().length();

    Spannable spannableText = (Spannable) textView.getText();
    spannableText.setSpan(new ForegroundColorSpan(textColor), start, end, 0);
}

From source file:com.lloydtorres.stately.region.RegionOverviewRecyclerAdapter.java

public static void initFounder(Context c, TextView tv, String founder, String founded) {
    if (!"0".equals(founder)) {
        String founderProper = SparkleHelper.getNameFromId(founder);
        SparkleHelper.activityLinkBuilder(c, tv, founder, founder, founderProper,
                ExploreActivity.EXPLORE_NATION);
    } else {/*from w  w w  . j av a 2 s  .  c  om*/
        tv.setText(c.getString(R.string.region_filler_none));
    }

    if (!"0".equals(founded)) {
        tv.append(" " + String.format(Locale.US, c.getString(R.string.region_founded_append), founded));
    }
}

From source file:rus.cpuinfo.Ui.Fragments.CpuInfoAboutFragment.java

@Nullable
@Override//from   w  ww.ja v  a 2  s . c  o  m
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    View r = inflater.inflate(R.layout.fragment_about, container, false);

    TextView txv = (TextView) r.findViewById(R.id.txv_version);
    txv.append(rus.cpuinfo.BuildConfig.VERSION_NAME);

    return r;
}

From source file:com.android.jhansi.designchallenge.AboutFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // retain this fragment
    setRetainInstance(true);/* w ww  .  j a  v  a  2 s  .c  om*/
    View view;
    String versionName = BuildConfig.VERSION_NAME;
    view = inflater.inflate(R.layout.fragment_about, container, false);
    TextView textViewVersion = (TextView) view.findViewById(R.id.versionTextView);
    textViewVersion.append(versionName);
    return view;
}

From source file:com.lyricaloriginal.picturediaryapp.OssActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_oss);
    InputStream is = null;//from   w  ww  . j  ava 2  s . co m
    try {
        is = getAssets().open("apache_license.txt");
        List<String> lines = IOUtils.readLines(is, "UTF-8");
        TextView v = (TextView) findViewById(R.id.apacheLicTextView);
        for (String l : lines) {
            v.append(l + "\n");
        }
    } catch (IOException ex) {
        Log.e("DIARY", ex.getMessage(), ex);
    } finally {
        IOUtils.closeQuietly(is);
    }
}

From source file:com.javierd.about.DirtFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    View dirtView = inflater.inflate(R.layout.dirt_fragment, container, false);

    TextView dirtVersion = (TextView) dirtView.findViewById(R.id.dirt_version);
    String version = Utils.getDuVersion();
    dirtVersion.append(" ");

    // Inflate the layout for this fragment
    return dirtView;
}

From source file:com.aogp.about.AOGPFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    View aogpView = inflater.inflate(R.layout.aogp_fragment, container, false);

    TextView AOGPVersion = (TextView) aogpView.findViewById(R.id.aogp_version);
    String version = Utils.getAOGPVersion();
    AOGPVersion.append(" ");

    // Inflate the layout for this fragment
    return aogpView;
}

From source file:com.javierd.about.AboutFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    View aboutView = inflater.inflate(R.layout.about_fragment, container, false);

    TextView aboutTitle = (TextView) aboutView.findViewById(R.id.about_title);
    String version = Utils.getDuVersion();
    aboutTitle.append(" AOSPLUS");

    TextView aboutText = (TextView) aboutView.findViewById(R.id.about);
    aboutText.setText(Utils.readRawFile(AboutActivity.appContext, R.raw.about_dirtyunicorns));

    // Inflate the layout for this fragment
    return aboutView;
}

From source file:com.aogp.about.AboutFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    View aboutView = inflater.inflate(R.layout.about_fragment, container, false);

    TextView aboutTitle = (TextView) aboutView.findViewById(R.id.about_title);
    String version = Utils.getAOGPVersion();
    aboutTitle.append(" AOGP ");

    TextView aboutText = (TextView) aboutView.findViewById(R.id.about);
    aboutText.setText(Utils.readRawFile(AboutActivity.appContext, R.raw.about_aogp));

    // Inflate the layout for this fragment
    return aboutView;
}