Back to project page androidui.
The source code is released under:
MIT License
If you think the Android project androidui listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package course.examples.UI.RelativeLayout; /*www . ja v a 2 s .c om*/ import android.app.Activity; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; public class RelativeLayoutActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); final EditText textEntry = (EditText) findViewById(R.id.entry); final Button cancelButton = (Button) findViewById(R.id.cancel_button); cancelButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { // Clear the textEntry textEntry.setText(""); } }); final Button okButton = (Button) findViewById(R.id.ok_button); okButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { // Say Thanks! Toast.makeText( RelativeLayoutActivity.this, "Thanks", Toast.LENGTH_SHORT ).show(); textEntry.setText(""); } }); } }