package com.registerevent;
import android.app.Activity;
import android.os.Bundle;
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 {
Button b1, b2;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
b1 = (Button) findViewById(R.id.button1);
b2 = (Button) findViewById(R.id.button2);
b1.setOnClickListener(bListener);
b2.setOnClickListener(bListener);
}
private OnClickListener bListener = new OnClickListener()
{
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
String label = ((Button)v).getText().toString();
Toast.makeText(getBaseContext(), "you click" +label, Toast.LENGTH_LONG).show();
}
};
@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;
}
}
Showing posts with label android views. Show all posts
Showing posts with label android views. Show all posts
Tuesday, 21 May 2013
Registering events for views
Labels:forex, iqoption, pubg Hacked
android application development tutorial,
android development tutorial,
android programming video tutorial,
android tutorial video,
android video tutorial,
android views
Subscribe to:
Posts (Atom)