Skip to content

Instantly share code, notes, and snippets.

@pratamawijaya
Created December 14, 2013 06:05
Show Gist options
  • Save pratamawijaya/7956140 to your computer and use it in GitHub Desktop.
Save pratamawijaya/7956140 to your computer and use it in GitHub Desktop.
mainactivity a
package id.pratama.testproject;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.Toast;
public class MainActivity extends Activity implements OnClickListener {
private Button btnSatu;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
btnSatu.setOnClickListener(this);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
@Override
public void onClick(View v) {
if (v == btnSatu)
Toast.makeText(this, "Hello", Toast.LENGTH_SHORT).show();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment