Skip to content

Instantly share code, notes, and snippets.

@aztack
Created January 22, 2012 03:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aztack/1655223 to your computer and use it in GitHub Desktop.
Save aztack/1655223 to your computer and use it in GitHub Desktop.
set/get text of TextView
package com.Android.HelloAndroid;
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.widget.TextView;
public class TextViewDemo extends Activity
{
private static final String TAG = "HelloAndroid";
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
TextView desc = (TextView)findViewById(R.id.description);
Log.d(TAG,desc.getText().toString());
desc.setText("Hello Android!");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment