public class ButtonClickActivity extends Activity {
private Button m_button;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
LinearLayout m_linear = new LinearLayout(this);
m_linear.setOrientation(LinearLayout.VERTICAL);
m_button = new Button(this);
m_button.setText("Hello World");
m_button.setOnClickListener(new Button.OnClickListener(){
public void onClick(View arg0) {
m_button.setText("click");
}
});
m_linear.addView(m_button);
setContentView(m_linear);
}
}
No comments:
Post a Comment