package com.zp.cau;
import android.app.Activity;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.Toast;
public class DevilsCampAndroidActivity extends Activity implements OnClickListener {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
ImageView imageView1 = new ImageView(this);
imageView1.setImageResource(R.drawable.images);
Button button1 = (Button)findViewById(R.id.button1);
Button button2 = (Button)findViewById(R.id.button2);
Button button3 = (Button)findViewById(R.id.button3);
button1.setOnClickListener(this);
button2.setOnClickListener(this);
button3.setOnClickListener(this);
}
@Override
public void onClick(View v){
String btn = "";
if(v.getId() == R.id.button1) btn = "button1";
if(v.getId() == R.id.button2) btn = "button2";
if(v.getId() == R.id.button3) btn = "button3";
Toast.makeText(this, btn+" clicked", Toast.LENGTH_SHORT).show();
}
public boolean onTouchEvent(MotionEvent event){
super.onTouchEvent(event);
if(event.getAction() == MotionEvent.ACTION_DOWN){
return true;
}
return false;
}
}