Download presentation
Presentation is loading. Please wait.
1
ארועים ומאזינים android
2
תרשים זרימה של אירוע
5
public class EventActivity extends Activity
{ EditText etin; TextView tvout; Button bt1; protected void onCreate(Bundle savedInstanceState) super.onCreate(savedInstanceState); setContentView(R.layout.activity_event); etin=(EditText) findViewById(R.id.etword); tvout=(TextView) findViewById(R.id.tvoutput); bt1=(Button) findViewById(R.id.btcheck); } public void onClick(View v) String st; if (bt1==v) st=etin.getText().toString(); tvout.setText(st);
8
public class EventActivity extends Activity implements OnClickListener
{ EditText etin; TextView tvout; Button btPush; Button btClear; protected void onCreate(Bundle savedInstanceState) super.onCreate(savedInstanceState); setContentView(R.layout.activity_event); etin=(EditText) findViewById(R.id.etword); tvout=(TextView) findViewById(R.id.tvoutput); btPush=(Button) findViewById(R.id.btcheck); btClear=(Button) findViewById(R.id.btclear); btPush.setOnClickListener(this); btClear.setOnClickListener(this); } public void onClick(View v) String st="???????"; if (btPush==v) st=etin.getText().toString(); if (btClear==v) st="#########"; etin.setHint(null); tvout.setText(st);
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.