06-15 08:51:42.292: ERROR/AndroidRuntime(11019): Caused by: android.database.sqlite.SQLiteException: bind or column index out of range: handle 0x249200 06-15 08:51:42.292: ERROR/AndroidRuntime(11019): at android.database.sqlite.SQLiteProgram.native_bind_string(Native Method) 06-15 08:51:42.292: ERROR/AndroidRuntime(11019): at android.database.sqlite.SQLiteProgram.bindString(SQLiteProgram.java:24..
안드로이드에서는 어댑터라는 객체가 있어서 뷰와 데이타를 연결해준다. 간단하게 문자열 리스트를 리스트뷰에 보여주도록 어댑터를 설정할 수 있다. 기본적으로 제공되는 어댑터 외에 내 입맛에 맞는 어댑터를 정의하여 리스트 뷰에 보여주고자 한다. 커스텀 항목 뷰 그리기 커스텀 어댑터 클래스 구현 커스텀 항목 뷰 그리기 커스텀 레이아웃을 XML로 디자인한다. 커스텀 어댑터 클래스 구현 어떤 정보를 레이아웃의 어느 위젯에 출력할지 지정하는 역할은 어댑터가 담당한다. BaseAdapter를 상속받아 추상 메서드를 재정의 한다. public class MyAdapter extends BaseAdapter { static final String TAG = "SheduleListAdapter"; private Context..
Layout XML 정의하기 SQLiteOpenHelper 구현하기 Activity 생성하기 Layout XML 정의하기 > SQLiteOpenHelper 구현하기 SQLiteOpenHelper 를 상속받아서 DB에 관련된 기능을 구현한다. public class MyDBHelper extends SQLiteOpenHelper { private static final String TAG = "MyDBHelper"; private static final int DATABASE_VERSION = 1; private static final String DB_NAME = "db_sample10"; public MyDBHelper(Context context, CursorFactory factory) { supe..
06-10 08:54:19.741: ERROR/AndroidRuntime(579): Caused by: android.database.sqlite.SQLiteException: near "AUTOINCREMENT": syntax error: CREATE TABLE schedule(_id INTEGER PRIMARY AUTOINCREMENT, content TEXT); SQL 문을 잘 못 작성하였다... SQLite Manager를 이용하여 SQL을 검증한 후에 사용한다.
From an adb remote shell, you can use the sqlite3 command-line program to manage SQLite databases created by Android applications. The sqlite3 tool includes many useful commands, such as .dump to print out the contents of a table and .schema to print the SQL CREATE statement for an existing table. The tool also gives you the ability to execute SQLite commands on the fly. 참고자료 Examining sqlite3 D..
안드로이는 SQLite database 를 모두 지원한다. 생성한 어떤 DB도 어플리케이션 안에서는 이름을 가지고 어떤 클래스에도 접근가능하지만, 어플리케이션 밖에서는 불가능하다. Android provides full support for SQLite databases. Any databases you create will be accessible by name to any class in the application, but not outside the application. 새 SQLite database를 만드는 권장하는 방법은 SQLiteOpenHelper 의 서브 클래스를 생성하고 onCreate() 메소드를 오버라이드하고 그 곳에서 관련명령을 실행한다. The recommended metho..
style은 View 나 window 의 외관이나 형식을 특정화시키는 속성의 집합이다. style은 높이, 패딩, 폰트 색깔, 폰트 사이트, 배경색상 등의 속성을 특정화시킨다. style은 XML 리소스에서 정의하므로 레이아웃과 분리할 수 있다. A style is a collection of properties that specify the look and format for a View or window. A style can specify properties such as height, padding, font color, font size, background color, and much more. A style is defined in an XML resource that is separate ..
A drawable resource is a general concept for a graphic that can be drawn to the screen and which you can retrieve with APIs such as getDrawable(int) or apply to another XML resource with attributes such as android:drawable and android:icon. There are several different types of drawables: drawable resource 는 스크린에 그릴수 있는 그래픽의 일반적인 개념이다. API를 부르거나 다른 XML 리소스에 적용시킨다. drawables의 여러가지 타입들이 있다. 참고자료 Dr..
버튼 상태값에 따라 색상을 변경시킨다. Define a color resources that changes based on the View state. Saved in res/color/ and accessed from the R.color class. 작업순서 res/color/filename.xml 에 selector를 정의한다. 레이아웃 XML 에서 속성 android:textColor의 값을 @color/filename 으로 설정한다. 참고문서 Color State List Resource 문법 xmlns:android="http://schemas.android.com/apk/res/android" 정해진 문자열 android:color 16진수 색상값, 반드시 #로 시작한다. 형식 : #RGB,..
안드로이드 커스텀 위젯을 만들고 위젯만의 이벤트 구현을 추가할 수 있다. 기존에 작성한 커스텀 위젯에서 EidtText에 글을 입력하고 버튼을 누르면 TextView에 그 내용이 출력되도록 만들고 싶다. 위젯클래스에서 이벤트 구현하기 위젯클래스에서 이벤트 구현하기 private void init(Context context){ this.context = context ; //레이아웃 xml 을 파싱하여 커스텀 뷰를 구성한다. LayoutInflater layoutInflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); view=layoutInflater.inflate(R.layout.sample09_w01,t..
자주 사용되는 화면은 커스텀 뷰로 만들어 재활용성을 높일 수 있다 커스텀 위젯 레이아웃 그리기 커스텀 위젯 클래스 만들기 커스텀 위젯 사용하기 1. 커스텀 위젯 레이아웃 그리기 원하는 디자인대로 레이아웃을 구성한다. 2. 커스텀 위젯 클래스 만들기 LinearLayout 상속받은 커스텀 위젯 클래스를 만든다. LayoutInflater 을 이용하여 레이아웃 XML 을 파싱하여 커스텀 뷰를 구성한다. 향후 레이아웃이 변경되면 쉽게 적용될 수 있다. public class customView extends LinearLayout { Context context ; View view; public customView(Context context) { super(context); init(context); } ..
브라우저 호출하기 단순히 웹 화면을 부를 때 사용한다. ※ WebView 와 구분하여 사용한다. protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Intent i = new Intent(Intent.ACTION_VIEW); Uri u = Uri.parse("http://angmang.tistory.com"); i.setData(u); startActivity(i); } 결과화면 참고자료 Web Apps Overview