public class HttpProj extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        // 웹문서 소스 출력 영역 인식
        EditText et_Webpage_src = (EditText)findViewById(R.id.webpage_src);
        
        URL url = null;
        HttpURLConnection urlConnection = null;
        BufferedInputStream buf = null;
        
        try{
        //// URL 지정과 접속
        // 웹서버 URL 지정
        url = new URL("http://www.android.com/");
        // URL 접속
        urlConnection = (HttpURLConnection)url.openConnection();
       
        //// 웹문서 소스를 버퍼에 저장
        // 데이터 다운로드
        buf = new BufferedInputStream(urlConnection.getInputStream());
        // 데이터를 버퍼에 기록
        BufferedReader bufeader = new BufferedReader(new InputStreamReader(buf, "euc-kr"));
       
        String line = null;
        String page = "";
       
        // 버퍼의 웹문서 소스를 줄 단위로 읽어(line), page에 저장함.
        while((line = bufeader.readLine()) != null){
        page += line;
        }
       
        // page 내용을 화면에 출력
        et_Webpage_src.setText(page);
        }catch(Exception e){
        et_Webpage_src.setText(e.getMessage());
        }finally{
        //URL 연결해제
        urlConnection.disconnect();
        }
        
        
    }
}

'스마트폰 > 안드로이드' 카테고리의 다른 글

이미지뷰 두번째 공부.  (0) 2011.05.13
이미지뷰(ImageView) 공부.  (0) 2011.05.13
데이터 바인딩4 공부  (0) 2011.05.13
데이터 바인딩3 공부  (0) 2011.05.13
데이터 바인딩2 공부  (0) 2011.05.13
public class DataBWT4 extends Activity {
    private GridView gv;
    static final int IMGS[] = {R.drawable.a01,
        R.drawable.a02,
        R.drawable.a03,
        R.drawable.a04,
        R.drawable.a05,
        R.drawable.a06,
        R.drawable.a07,
        R.drawable.a08,
        R.drawable.a09,
        R.drawable.a10,
        R.drawable.a11,
        R.drawable.a12
    };
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        gv = (GridView)findViewById(R.id.GridView01);
        gv.setAdapter(new UserAdapter(this));
        
        gv.setOnItemClickListener(new AdapterView.OnItemClickListener() {

@Override
public void onItemClick(AdapterView<?> parent, View view, int position,
long arg3) {
Toast.makeText(DataBWT4.this, "선택 인덱스 : " + position, 0).show();
}
       
});
        
    }
}

class UserAdapter extends BaseAdapter{ // Controller
private Context c;
private ImageView iv;
UserAdapter(){
}
UserAdapter(DataBWT4 c){
this.c = c;
}
@Override
public int getCount() {
// TODO Auto-generated method stub
return DataBWT4.IMGS.length;
}

@Override
public Object getItem(int position) {
// TODO Auto-generated method stub
return DataBWT4.IMGS[position];
}

@Override
public long getItemId(int position) {
// TODO Auto-generated method stub
return position;
}

@Override
public View getView(int position, View convertView, ViewGroup parent) {
// TODO Auto-generated method stub
if(convertView == null){
iv = new ImageView(c);
iv.setLayoutParams(new GridView.LayoutParams(120,150));
//iv.setScaleType(ImageView.ScaleType.CENTER_CROP);
iv.setScaleType(ImageView.ScaleType.FIT_XY); //크기 고정 옵션
iv.setPadding(5, 5, 15, 5);
}else{
iv = (ImageView)convertView;
}
iv.setImageResource(DataBWT4.IMGS[position]);
return iv;
}
}

'스마트폰 > 안드로이드' 카테고리의 다른 글

이미지뷰(ImageView) 공부.  (0) 2011.05.13
웹 소스 찍기  (0) 2011.05.13
데이터 바인딩3 공부  (0) 2011.05.13
데이터 바인딩2 공부  (0) 2011.05.13
데이터 바인딩1 공부  (0) 2011.05.13
package kyy.dbw.test3;

import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.BaseAdapter;
import android.widget.Gallery;
import android.widget.ImageView;
import android.widget.Toast;

public class DataBWT3 extends Activity {
private Gallery g;
    static final int IMGS[] = {R.drawable.a01,
        R.drawable.a02,
        R.drawable.a03,
        R.drawable.a04,
        R.drawable.a05,
        R.drawable.a06,
        R.drawable.a07,
        R.drawable.a08,
        R.drawable.a09,
        R.drawable.a10,
        R.drawable.a11,
        R.drawable.a12
    };
    
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        g = (Gallery)findViewById(R.id.Gallery01); // VIEW       
        g.setAdapter(new UserAdapter(this));
        g.setOnItemClickListener(new AdapterView.OnItemClickListener() {

@Override
public void onItemClick(AdapterView<?> parent, View view, int position,
long arg3) {
Toast.makeText(DataBWT3.this, "선택 인덱스 : " + position, 0).show();
}
       
});
    }
}

class UserAdapter extends BaseAdapter{ // Controller
private Context c;
private ImageView iv;
UserAdapter(){
}
UserAdapter(DataBWT3 c){
this.c = c;
}
@Override
public int getCount() {
// TODO Auto-generated method stub
return DataBWT3.IMGS.length;
}

@Override
public Object getItem(int position) {
// TODO Auto-generated method stub
return DataBWT3.IMGS[position];
}

@Override
public long getItemId(int position) {
// TODO Auto-generated method stub
return position;
}

@Override
public View getView(int position, View convertView, ViewGroup parent) {
// TODO Auto-generated method stub
if(convertView == null){
iv = new ImageView(c);
iv.setLayoutParams(new Gallery.LayoutParams(120, 150));
iv.setScaleType(ImageView.ScaleType.CENTER_CROP);
//iv.setScaleType(ImageView.ScaleType.FIT_XY); //크기 고정 옵션
iv.setPadding(5, 5, 15, 5);
}else{
iv = (ImageView)convertView;
}
iv.setImageResource(DataBWT3.IMGS[position]);
return iv;
}
}

'스마트폰 > 안드로이드' 카테고리의 다른 글

웹 소스 찍기  (0) 2011.05.13
데이터 바인딩4 공부  (0) 2011.05.13
데이터 바인딩2 공부  (0) 2011.05.13
데이터 바인딩1 공부  (0) 2011.05.13
anim2(애니메이션) 공부  (0) 2011.05.13
public class DataBWT2 extends Activity 
implements AdapterView.OnItemClickListener {
//Model Case 1 
    private static final String ITEMS[] = 
    {
    "동백꽃", "개나리", "진달래", "철쭉", "백합", "튜울립", 
    "장미", "봉선화", "무궁화", "벗꽃", "살구꽃", "복숭아꽃", 
    "할미꽃", "에델바이스", "안개꽃", "카네이션", "들국화", 
    "가나다", "가나라", "가다라", "가지마", "가나다라", 
    "cat", "catch", "cast", "case", "casting", "cap"
    };
    private ListView lv; //View 
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        lv = (ListView)findViewById(R.id.ListView01);
        android.util.Log.i("lv", ""+lv);
        
        //m1(); //Model - Array 
        //m2(); //Model - List
        m3(); //Model - Xml 
    }
    //4. 자신 
    public void onItemClick (
AdapterView<?> parent, View view, int position, long id){
ArrayAdapter<String> aa = (ArrayAdapter<String>)parent.getAdapter();
Toast.makeText(this, 
"선택(4) : " + aa.getItem(position), 0).show();
}
    void m1(){
    ArrayAdapter<String> aa = new ArrayAdapter<String>(
            this, android.R.layout.simple_list_item_1, 
               ITEMS);
        lv.setAdapter(aa);
        /*//1. 익명(무명) 내부 
        AdapterView.OnItemClickListener listener = new AdapterView.OnItemClickListener() {
    public void onItemClick (
    AdapterView<?> parent, View view, int position, long id){
    ArrayAdapter<String> aa = (ArrayAdapter<String>)parent.getAdapter();
   
    Toast.makeText(DataBWT2.this, 
    "선택(1) : " + aa.getItem(position), 0).show();
    }
        };*/
        /*//2. 유명 내부 
        class A implements AdapterView.OnItemClickListener {
        public void onItemClick (
    AdapterView<?> parent, View view, int position, long id){
    ArrayAdapter<String> aa = (ArrayAdapter<String>)parent.getAdapter();
   
    Toast.makeText(DataBWT2.this, 
    "선택(2) : " + aa.getItem(position), 0).show();
    }
        }*/
        
        lv.setOnItemClickListener(this);
    }
    
    ArrayAdapter<String> aa;
    void m2(){
    List list = new Vector<String>();
    for(String item : ITEMS) list.add(item);
    aa = new ArrayAdapter<String>(this,
    android.R.layout.simple_list_item_1, list);
        lv.setAdapter(aa);
        lv.setOnItemClickListener(this);
    }
    ArrayAdapter adapter;
    void m3(){
    adapter = ArrayAdapter.createFromResource(
    this, R.array.animals, 
    android.R.layout.simple_list_item_1);
    lv.setAdapter(adapter);
        lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        public void onItemClick (
    AdapterView<?> parent, View view, int position, long id){
    //ArrayAdapter adapter = (ArrayAdapter)parent.getAdapter();
   
    Toast.makeText(DataBWT2.this, 
    "선택(xml) : " + adapter.getItem(position), 0).show();
    }
});
    }
}
/* 3. 제3클 
class B implements AdapterView.OnItemClickListener {
DataBWT2 d;
B(DataBWT2 d){
this.d = d;
}
public void onItemClick (
AdapterView<?> parent, View view, int position, long id){
ArrayAdapter<String> aa = (ArrayAdapter<String>)parent.getAdapter();
Toast.makeText(d, 
"선택(3) : " + aa.getItem(position), 0).show();
}
}*/

'스마트폰 > 안드로이드' 카테고리의 다른 글

데이터 바인딩4 공부  (0) 2011.05.13
데이터 바인딩3 공부  (0) 2011.05.13
데이터 바인딩1 공부  (0) 2011.05.13
anim2(애니메이션) 공부  (0) 2011.05.13
TabHost 공부.  (0) 2011.05.13
public class DataBWT1 extends Activity {
    private Spinner sp; //View
    private AutoCompleteTextView auto;
    private Button b;
    //Model Case 1 
    private static final String ITEMS[] = 
    {
    "동백꽃", "개나리", "진달래", "철쭉", "백합", "튜울립", 
    "장미", "봉선화", "무궁화", "벗꽃", "살구꽃", "복숭아꽃", 
    "할미꽃", "에델바이스", "안개꽃", "카네이션", "들국화",
    "가나다", "가나라", "가다라", "가지마", "가나다라",
    "cat", "catch", "cast", "case", "castring", "cacaotok"
    };
    List<String> list; // Model Case 2 
    ArrayAdapter<String> aa; //Controller
        
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
         
        sp = (Spinner)findViewById(R.id.spinner01);
        b = (Button)findViewById(R.id.Button01);
        sp.setPrompt("좋아하는 아이템 선택");
        
        auto = (AutoCompleteTextView)findViewById(R.id.AutoCompleteTextView01);
        //m1(); //Model - Array 
        //m2(); //Model - List
        //m3(); //Model - Xml
        //m1_1(); //Model - Array
        //m2_1(); //Model - List
        //m3_1(); //Model - Xml
    }   
    void m1_1(){
    aa = new ArrayAdapter<String>(this,
            android.R.layout.simple_dropdown_item_1line, ITEMS);
    auto.setAdapter(aa);
    b.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String item = auto.getText().toString();
showMsg("선택아이템 : " + item);
}
});    
    }
    void m2_1(){
    list = new Vector<String>();
    for(String item : ITEMS) list.add(item);
    aa = new ArrayAdapter<String>(this,
            android.R.layout.simple_spinner_dropdown_item, list);
    auto.setAdapter(aa);
   
    b.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String item = auto.getText().toString();
showMsg("선택아이템 : " + item);
}
});
    }
    void m3_1(){
    ArrayAdapter aa = 
    ArrayAdapter.createFromResource(this, R.array.animals, 
    android.R.layout.simple_spinner_item);
   
    auto.setAdapter(aa);
   
    b.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String item = auto.getText().toString();
showMsg("선택아이템 : " + item);
}
});
    }
    void m3(){
    /*final ArrayAdapter aa = 
    ArrayAdapter.createFromResource(this, R.array.animals, 
    android.R.layout.simple_spinner_item);*/
   
    ArrayAdapter aa = 
    ArrayAdapter.createFromResource(this, R.array.animals, 
    android.R.layout.simple_spinner_item);
   
    sp.setAdapter(aa);
   
    sp.setOnItemSelectedListener(
            new AdapterView.OnItemSelectedListener() {
            public void onItemSelected (AdapterView<?> parent, View view, int position, long id){
            ArrayAdapter aa = (ArrayAdapter)parent.getAdapter();
            String item = (String)aa.getItem(position);
            showMsg("선택 아이템 : "+ aa.getItem(position));
            }
            public void onNothingSelected (AdapterView<?> parent){
            }
    });
   
    }
    void m1(){
    aa = new ArrayAdapter<String>(this,
        android.R.layout.simple_spinner_item, ITEMS);
        aa.setDropDownViewResource(
        android.R.layout.simple_spinner_dropdown_item);
        sp.setAdapter(aa);
        
        sp.setOnItemSelectedListener(
        new AdapterView.OnItemSelectedListener() {
        public void onItemSelected (AdapterView<?> parent, View view, int position, long id){
        showMsg("선택 아이템 : "+ ITEMS[position]);
        }
        public void onNothingSelected (AdapterView<?> parent){
        }
});
    }
    void m2(){
    list = new Vector<String>();
    for(String item : ITEMS) list.add(item);
    aa = new ArrayAdapter<String>(this,
            android.R.layout.simple_spinner_item, list);
    aa.setDropDownViewResource(
            android.R.layout.simple_spinner_dropdown_item);
    sp.setAdapter(aa);
   
    sp.setOnItemSelectedListener(
        new AdapterView.OnItemSelectedListener() {
        public void onItemSelected (AdapterView<?> parent, View view, int position, long id){
        showMsg("선택 아이템(list) : "+ list.get(position));
        }
        public void onNothingSelected (AdapterView<?> parent){
        }
});
    }
    void showMsg(String msg){
    Toast.makeText(this, msg, Toast.LENGTH_SHORT).show();
    }
}

'스마트폰 > 안드로이드' 카테고리의 다른 글

데이터 바인딩3 공부  (0) 2011.05.13
데이터 바인딩2 공부  (0) 2011.05.13
anim2(애니메이션) 공부  (0) 2011.05.13
TabHost 공부.  (0) 2011.05.13
Activity Event 공부  (0) 2011.05.13
public class Ani02 extends Activity {
    private ImageView iv;
    private Animation an1, an2, an3, an4, an5;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        initAnim();
        iv = (ImageView)findViewById(R.id.ImageView01);
        
        iv.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
if(event.getAction() == MotionEvent.ACTION_DOWN){
iv.startAnimation(an1);
}
return false;
}
});
    }
    private void initAnim(){
   
    an1 = AnimationUtils.loadAnimation(this, R.anim.trans);
    an2 = AnimationUtils.loadAnimation(this, R.anim.rotate);
    an3 = AnimationUtils.loadAnimation(this, R.anim.alpha);
    an4 = AnimationUtils.loadAnimation(this, R.anim.scale);
    an5 = AnimationUtils.loadAnimation(this, R.anim.all);
    Animation.AnimationListener listener = new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationRepeat(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
if(animation == an1){
iv.startAnimation(an2);
}else if(animation == an2){
iv.startAnimation(an3);
}else if(animation == an3){
iv.startAnimation(an4);
}else if(animation == an4){
iv.startAnimation(an5);
}else{
}
}
};
    an1.setAnimationListener(listener);
    an2.setAnimationListener(listener);
    an3.setAnimationListener(listener);
    an4.setAnimationListener(listener);
    an5.setAnimationListener(listener);
    }
}

'스마트폰 > 안드로이드' 카테고리의 다른 글

데이터 바인딩2 공부  (0) 2011.05.13
데이터 바인딩1 공부  (0) 2011.05.13
TabHost 공부.  (0) 2011.05.13
Activity Event 공부  (0) 2011.05.13
안드로이드 개발 개요.  (0) 2011.05.02
- XML 디자인 파일
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
       android:orientation="vertical"
       android:layout_width="fill_parent"
       android:layout_height="fill_parent" >
       <TabHost
             android:id="@+id/tab_host"
             android:layout_width="fill_parent" 
             android:layout_height="fill_parent" > 
             <TabWidget
                    android:id="@android:id/tabs"
                    android:layout_gravity="bottom"
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content" />
             <FrameLayout
                    android:id="@android:id/tabcontent" 
                    android:layout_width="fill_parent"
                    android:layout_height="fill_parent">
                    <!-- android:paddingTop="69px" -->
                    
                     
                    <LinearLayout
                           android:id="@+id/tab_view1"
                           android:orientation="vertical"
                           android:layout_width="fill_parent"
                           android:layout_height="fill_parent" >
                           <!-- 
                          <WebView
                            android:id="@+id/WebView01"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"/>
                            -->
                             
<LinearLayout
                           android:orientation="horizontal"
                           android:layout_width="fill_parent"
                           android:layout_height="fill_parent" >                            
                           <EditText
                            android:id="@+id/EditText01"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_weight="1"/>
                           
                           <Button
                            android:id="@+id/Button01"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:text="입력"/>
                           
                           
                           <TextView
                            android:id="@+id/TextView01"
                            android:layout_width="fill_parent"
                            android:layout_height="wrap_content"/>
                        
                        
</LinearLayout>
                    </LinearLayout>    

                    <LinearLayout
                           android:id="@+id/tab_view2"
                           android:orientation="vertical"
                           android:layout_width="fill_parent"
                           android:layout_height="fill_parent" >
                           
                           <TextView
                            android:id="@+id/TextView02"
                            android:layout_width="fill_parent"
                            android:layout_height="fill_parent"/>
                    </LinearLayout>
                    <LinearLayout
                           android:id="@+id/tab_view3"
                           android:orientation="vertical"
                           android:layout_width="fill_parent"
                           android:layout_height="fill_parent" >
                           
                           <TextView
                            android:id="@+id/TextView03"
                            android:layout_width="fill_parent"
                            android:layout_height="fill_parent"/>
                    </LinearLayout>
             </FrameLayout>
       </TabHost>
</LinearLayout>

- 자바소스
public class AllNews extends Activity implements OnClickListener{
    @Override
public void onClick(View v) {
// TODO Auto-generated method stub
    String str_name = et.getText().toString();
    tv1.setText(str_name);
    //// 알림창을 띄움 : 시작 ////
AlertDialog.Builder alert = new AlertDialog.Builder(this);
alert.setTitle("알림창");
alert.setMessage("성명:" + str_name);
alert.setIcon(R.drawable.icon);
alert.setPositiveButton("확인", null);
alert.show();
}
/** Called when the activity is first created. */
    public void m1(){
    URL url = null;
   
        HttpURLConnection urlConnection = null;
        BufferedInputStream buf = null;
        
        try{
        //// URL 지정과 접속
        // 웹서버 URL 지정
        url = new URL("http://www.android.com/");
        // URL 접속
        urlConnection = (HttpURLConnection)url.openConnection();
       
        //// 웹문서 소스를 버퍼에 저장
        // 데이터 다운로드
        buf = new BufferedInputStream(urlConnection.getInputStream());
        // 데이터를 버퍼에 기록
        BufferedReader bufeader = new BufferedReader(new InputStreamReader(buf, "euc-kr"));
       
        String line = null;
        String page = "";
       
        // 버퍼의 웹문서 소스를 줄 단위로 읽어(line), page에 저장함.
        while((line = bufeader.readLine()) != null){
        page += line;
        }
       
        // page 내용을 화면에 출력
        tv1.setText(page);
        }catch(Exception e){
        tv1.setText(e.getMessage());
        }finally{
        //URL 연결해제
        urlConnection.disconnect();
        }
    }
    TextView tv1;
    WebView wv;
    Button bt;
    EditText et;
    LinearLayout layname;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        TabHost tabHost = (TabHost)findViewById(R.id.tab_host);
        tv1 = (TextView)findViewById(R.id.TextView01);
        et = (EditText)findViewById(R.id.EditText01);
        bt = (Button)findViewById(R.id.Button01);
        layname = (LinearLayout)findViewById(R.id.tab_view1);
        
        
        TextView tv2 = (TextView)findViewById(R.id.TextView02);
        TextView tv3 = (TextView)findViewById(R.id.TextView03);
        tabHost.setup();
          
        // Tab1 Setting 
        TabSpec tabSpec1 = tabHost.newTabSpec("Tab1");
        tabSpec1.setIndicator("신문, 뉴스"); // Tab Subject
        tabSpec1.setContent(R.id.tab_view1); // Tab Content
        tv1.setText("신문, 뉴스 페이지 입니다.");      
        tabHost.addTab(tabSpec1);
        bt.setOnClickListener(this);
        
        // Tab2 Setting
        TabSpec tabSpec2 = tabHost.newTabSpec("Tab2");
        tabSpec2.setIndicator("포털, IT"); // Tab Subject
        tabSpec2.setContent(R.id.tab_view2); // Tab Content
        tv2.setText("포털, IT 페이지 입니다.");
        tabHost.addTab(tabSpec2);
        
        // Tab3 Setting
        TabSpec tabSpec3 = tabHost.newTabSpec("Tab3");
        tabSpec3.setIndicator("방송, 해외"); // Tab Subject
        tabSpec3.setContent(R.id.tab_view3); // Tab Content
        tv3.setText("방송, 해외 페이지 입니다.");
        tabHost.addTab(tabSpec3);
        
        // show First Tab Content
        tabHost.setCurrentTab(0);
    }
}

'스마트폰 > 안드로이드' 카테고리의 다른 글

데이터 바인딩2 공부  (0) 2011.05.13
데이터 바인딩1 공부  (0) 2011.05.13
anim2(애니메이션) 공부  (0) 2011.05.13
Activity Event 공부  (0) 2011.05.13
안드로이드 개발 개요.  (0) 2011.05.02
public class ActivityEvent extends Activity {
    
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
    }
    
    public void onBackPressed(){
    //showMsg("onBackpressed");
    //showMsg("정말로 종료 할까요?");
    //finish();
    openDialog();
    }
    private void openDialog(){
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setMessage("정말로 종료 할까요?");
    builder.setPositiveButton("예", (OnClickListener) new InnerHandler());
    builder.setNegativeButton("아니요", null);
    builder.show();
    }
    class InnerHandler implements DialogInterface.OnCancelListener{

@Override
public void onCancel(DialogInterface dialog) {
// TODO Auto-generated method stub
finish();
}    
    }
    private void showMsg(String msg){
    Toast.makeText(this, msg, 0).show();
    }
    // Activity Event2
@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
// TODO Auto-generated method stub
    showMsg("KeyCode : " + keyCode + "KeyEvent : " + event);
return super.onKeyUp(keyCode, event);
}

    // Activity Event3
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
// TODO Auto-generated method stub
showMsg("KeyCode : " + keyCode + "KeyEvent : " + event);
return super.onKeyDown(keyCode, event);
}
    // Activity Event4
@Override
public boolean onTouchEvent(MotionEvent event) {
// TODO Auto-generated method stub
return super.onTouchEvent(event);
}
// Activity Event5
@Override
public void onUserInteraction() {
// TODO Auto-generated method stub
super.onUserInteraction();
}

스마트폰 키보드를 이용할 수 있다. 

'스마트폰 > 안드로이드' 카테고리의 다른 글

데이터 바인딩2 공부  (0) 2011.05.13
데이터 바인딩1 공부  (0) 2011.05.13
anim2(애니메이션) 공부  (0) 2011.05.13
TabHost 공부.  (0) 2011.05.13
안드로이드 개발 개요.  (0) 2011.05.02

+ Recent posts