현재 안드로이드 프로그래밍 정복(저자 김상형)
요 책으로 직접해보면서 공부중인데요....
예제가 나와있지만 손에 익힐겸 직접 손으로 예제도 치면서 공부할려고 하는중에....2번째 예제에서 알수없는 문제가 생겨서요...
package exam.AndroidFirst;
import android.app.*;
import android.os.*;
import android.view.*;
import android.widget.*;
public class AndroidFirst extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Button btn = (Button) findViewById(R.id.btn);
btn.setOnClickListener(new Button.OnClickListener() {
public void onClick(View v) {
EditText edit = (EditText) findViewById(R.id.edit);
String str = edit.getText().toString();
Toast.makeText(AndroidFirst.this, str, Toast.LENGTH_SHORT).show();
}
});
}
}
요게 .java 파일이구요
<?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"
>
<EdiText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/edit"
android:text="여기다입력"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/btn"
android:text="입력완료"
/>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/insa"
android:textColor="#ff0000"
android:textSize="20pt"
android:textStyle="italic"
/>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/anyoung"
android:textSize="20sp"
android:background="#0000ff"
/>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="사랑해"
android:textColor="#8000ff00"
android:textSize="5mm"
android:typeface="serif"
/>
<ImageView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:src="@drawable/test"
/>
</LinearLayout>
요게 레이아웃 xml 파일인데요.......
그거 어플 실행하면 강종 뜨는거 있잖아요? 그게 뜨면서 실행이 안되는데요.....
로그캣 보라고 하긴하는데....책에 있는거 그대로 친거라 문제 없어야 되는데..
저 위에 부분중에 잘못된 부분 있는지 확인좀 해주세용.....