安卓自測試題——第十期
阿新 • • 發佈:2018-12-23
[mw_shl_code=java,true]public class MainActivity extends Activity implements OnClickListener
{
private Button mBtnLogin = (Button) findViewById(R.id.btn_login);
private TextView mTextViewUser;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mTextViewUser = (TextView) findViewById(R.id.textview_user);
mBtnLogin.setOnClickListener(this);
new Thread()
{
@Override
public void run()
{
mTextViewUser.setText(10);
}
}.start();
}
@Override
public void onClick(View v)
{
mTextViewUser.setText(20);
}
}[/mw_shl_code]
{
private Button mBtnLogin = (Button) findViewById(R.id.btn_login);
private TextView mTextViewUser;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mTextViewUser = (TextView) findViewById(R.id.textview_user);
mBtnLogin.setOnClickListener(this);
new Thread()
{
@Override
public void run()
{
mTextViewUser.setText(10);
}
}.start();
}
@Override
public void onClick(View v)
{
mTextViewUser.setText(20);
}
}[/mw_shl_code]