package com.android.net;
import android.app.Activity;
import android.os.Bundle;
import android.view.Gravity;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.Toast;
public class REC extends Activity
{
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
//북쪽의 이벤트를 처리를 위해 버튼 객체 생성.
ImageButton ImageButton01 = (ImageButton)this.findViewById(R.id.ImageButton01);
ImageButton ImageButton02 = (ImageButton)this.findViewById(R.id.ImageButton02);
ImageButton ImageButton03 = (ImageButton)this.findViewById(R.id.ImageButton03);
ImageButton ImageButton04 = (ImageButton)this.findViewById(R.id.ImageButton04);
//이벤트 다는 방법
ImageButton01.setOnClickListener(new OnClickListener()
{
@Override
public void onClick(View arg0)
{
Toast toast = Toast.makeText(REC.this, "북쪽 보아@@", Toast.LENGTH_SHORT);
toast.setGravity(Gravity.CENTER,0,0);
toast.show();
}
});
ImageButton02.setOnClickListener(new OnClickListener()
{
@Override
public void onClick(View arg0)
{
Toast toast = Toast.makeText(REC.this, "동쪽 근영~", Toast.LENGTH_SHORT);
toast.setGravity(Gravity.CENTER, 0, 0);
toast.show();
}
});
ImageButton03.setOnClickListener(new OnClickListener()
{
@Override
public void onClick(View arg0)
{
Toast.makeText(REC.this, "남쪽", Toast.LENGTH_SHORT).show();
}
});
ImageButton04.setOnClickListener(new OnClickListener()
{
@Override
public void onClick(View arg0)
{
Toast.makeText(REC.this, "서쪽", Toast.LENGTH_SHORT).show();
}
});
}
}
'안드로이드' 카테고리의 다른 글
사과농장에 안드로이드 테블릿 키우기[LG Gpad v410] (0) | 2016.02.13 |
---|---|
[Android] 지하철 어플 만들기 1탄(탭레이아웃) (0) | 2010.08.26 |
[Android]AlertDialog 옵티머스Q, 안드로1 구분하기 (0) | 2010.08.24 |
[안드로이드] 그림그리기 (0) | 2010.08.16 |
[안드로이드] 글자쓰기 (0) | 2010.08.16 |