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;@Overrideprotected 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(){@Overridepublic void onClick(View v) {// TODO Auto-generated method stubString label = ((Button)v).getText().toString();Toast.makeText(getBaseContext(), "you click" +label, Toast.LENGTH_LONG).show();}};@Overridepublic 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 application development tutorial. Show all posts
Showing posts with label android application development tutorial. 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:
Comments (Atom)