### : 목차 구분 기호
--- : 목차 내에 항목 구분 기호
@@@ : 태그 용도
--- : 목차 내에 항목 구분 기호
@@@ : 태그 용도
,,, : 같은 목차 내에 구분 기호
목차
1. 이론 및 정보
2. 설정 및 그 밖에
3. 소스코드 또는 실습
4. 과제
###################################
1. 이론 및 정보
-----------------------------------
* 안드로이드 DataBase
sqlite
1. SharedPreference - 자체적으로 파일로 저장, 환경설정시 많이 이용
2. 파일 저장(내부 메모리, 외장 메모리)
3. 네트워크를 이용하는 방법, Upload 해서
4. 데이터베이스를 이용
Sqlite은 디비 파일만 복사해서 다른 곳에서 쓸 수 있음
sqlite.org
-----------------------------------
* 어제 받은 구글 키는 개발용 키임
실제 배포할때 쓰는 배포용 키는 어떻게 만들까?
배포용 키는 프로젝틀 완성을 해서 증명을 해야함
완성은 apk파일로 만들어야함
-----------------------------------
* DDMS에서 File Explorer 에서 Data안에 Data를 들어 가면 어플이 있음
contacts 어플 안에는 database 파일이 있음
-----------------------------------
* 안드로이드 디비 생성 방법
외부에서 만들어서 넣기
코드에서 만드는 방법 - 보통 이걸 이용
-----------------------------------
* adb.exe 안드로이드 시스템을 관리하는 프로그램
혹시나 문제가 생기면 이 프로그램을 강제로 끄면 됨
위치
~\android-sdk\platform-tools\adb.exe
F:\study\android-sdk\platform-tools>adb shell
sqlite3 /data/data/com.android.providers.contacts/databases/contacts2.db
-----------------------------------
* 문제 발생
F:\study\android-sdk\platform-tools>adb shell
error: more than one device/emulator
error: more than one device/emulator
-----------------------------------
###################################
2. 설정 및 그 밖에
-----------------------------------
###################################
2. 설정 및 그 밖에
-----------------------------------
* 이미지 복사
/LbsApp/res/drawable-ldpi/pin.png
-----------------------------------
* 프로젝트 생성
DBApp
-----------------------------------
* 배포용 어플 만들기, 배포키 만들기
LbsApp 우크릭 - Export
F:\study\LbsAppProject>keytool -list -v -alias Lbs -keystore LbsApp.keystore
키 저장소 비밀번호 입력:
별칭 이름: Lbs
생성 날짜: 2015. 7. 9
항목 유형: PrivateKeyEntry
인증서 체인 길이: 1
인증서[1]:
소유자: CN=study, L=seoul, C=ko
발행자: CN=study, L=seoul, C=ko
일련 번호: 60facf88
적합한 시작 날짜: Thu Jul 09 10:34:42 KST 2015, 종료 날짜: Sat Jun 15 10:34:42 KST 2115
인증서 지문:
MD5: 11:61:D9:43:2F:68:CC:B9:45:1D:15:79:C3:54:62:15
SHA1: 92:8B:85:22:FB:63:B4:05:E1:B1:19:D0:FA:F6:3F:2A:30:25:AB:2D
SHA256: A9:41:10:DC:C0:EE:62:23:1F:88:88:71:2F:C1:48:D5:F6:AF:B8:FA:E8:75:C4:8D:6E:7A:9B:B2
:4D:5C:64:B2
서명 알고리즘 이름: SHA256withRSA
버전: 3
확장:
#1: ObjectId: 2.5.29.14 Criticality=false
SubjectKeyIdentifier [
KeyIdentifier [
0000: 42 70 C1 DD D2 F7 17 E2 5B B3 87 E5 4C 9B D3 D6 Bp......[...L...
0010: D6 4F 5A 17 .OZ.
]
키 저장소 비밀번호 입력:
별칭 이름: Lbs
생성 날짜: 2015. 7. 9
항목 유형: PrivateKeyEntry
인증서 체인 길이: 1
인증서[1]:
소유자: CN=study, L=seoul, C=ko
발행자: CN=study, L=seoul, C=ko
일련 번호: 60facf88
적합한 시작 날짜: Thu Jul 09 10:34:42 KST 2015, 종료 날짜: Sat Jun 15 10:34:42 KST 2115
인증서 지문:
MD5: 11:61:D9:43:2F:68:CC:B9:45:1D:15:79:C3:54:62:15
SHA1: 92:8B:85:22:FB:63:B4:05:E1:B1:19:D0:FA:F6:3F:2A:30:25:AB:2D
SHA256: A9:41:10:DC:C0:EE:62:23:1F:88:88:71:2F:C1:48:D5:F6:AF:B8:FA:E8:75:C4:8D:6E:7A:9B:B2
:4D:5C:64:B2
서명 알고리즘 이름: SHA256withRSA
버전: 3
확장:
#1: ObjectId: 2.5.29.14 Criticality=false
SubjectKeyIdentifier [
KeyIdentifier [
0000: 42 70 C1 DD D2 F7 17 E2 5B B3 87 E5 4C 9B D3 D6 Bp......[...L...
0010: D6 4F 5A 17 .OZ.
]
-----------------------------------
* sqlite 좀 더 편하게 쓸 수 있는 프로그램 준비
sqlitebrowser.org
https://github.com/sqlitebrowser/sqlitebrowser/releases/download/v3.7.0/sqlitebrowser-3.7.0-win32.exe
-----------------------------------
* 스프링 준비
spring.io
Learn more about STS
http://dist.springsource.com/release/STS/3.7.0.RELEASE/dist/e4.5/spring-tool-suite-3.7.0.RELEASE-e4.5-win32.zip
-----------------------------------
* DDMS에서 contacts2.db 를 꺼내옴
* 안드로이드에서 DB 1MB 이상이라면 배포시 한번에 넣지 말고
따로 다운 받는게 좋음
-----------------------------------
* DB 생성 확인
-----------------------------------
###################################
3. 소스코드 또는 실습
-----------------------------------
3. 소스코드 또는 실습
-----------------------------------
3-1
WorkSpace : ~\study\AndroidWork
WorkSpace : ~\study\AndroidWork
/LbsApp/src/com/uticleTest1/lbsapp/GoogleMapActivity.java
package com.uticleTest1.lbsapp;
import android.app.Activity;
import android.content.Context;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Bundle;
import android.widget.Toast;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.MapFragment;
import com.google.android.gms.maps.model.LatLng;
public class GoogleMapActivity extends Activity {
private GoogleMap map;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_googlemap);
map = ((MapFragment) getFragmentManager().findFragmentById(R.id.map))
.getMap();
if (map != null) {
Toast.makeText(getApplicationContext(), "map avaliable",
Toast.LENGTH_SHORT).show();
}
LocationManager locManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
locManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER,
100000, 5, new LocationListener() {
public void onStatusChanged(String provider, int status, Bundle extras) {}
public void onProviderEnabled(String provider) {}
public void onProviderDisabled(String provider) {}
public void onLocationChanged(Location location) {
Double lat = location.getLatitude();
Double lon = location.getLongitude();
// 위 두개를 묶는 DTO
LatLng curPoint = new LatLng(lat, lon);
// 위치 이동 및 확대
map.animateCamera(CameraUpdateFactory.newLatLngZoom(curPoint, 15));
// 인공위성 실제 사진으로 보기
map.setMapType(GoogleMap.MAP_TYPE_SATELLITE);
}
});
}
}
4. 과제
-----------------------------------
import android.app.Activity;
import android.content.Context;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Bundle;
import android.widget.Toast;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.MapFragment;
import com.google.android.gms.maps.model.LatLng;
public class GoogleMapActivity extends Activity {
private GoogleMap map;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_googlemap);
map = ((MapFragment) getFragmentManager().findFragmentById(R.id.map))
.getMap();
if (map != null) {
Toast.makeText(getApplicationContext(), "map avaliable",
Toast.LENGTH_SHORT).show();
}
LocationManager locManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
locManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER,
100000, 5, new LocationListener() {
public void onStatusChanged(String provider, int status, Bundle extras) {}
public void onProviderEnabled(String provider) {}
public void onProviderDisabled(String provider) {}
public void onLocationChanged(Location location) {
Double lat = location.getLatitude();
Double lon = location.getLongitude();
// 위 두개를 묶는 DTO
LatLng curPoint = new LatLng(lat, lon);
// 위치 이동 및 확대
map.animateCamera(CameraUpdateFactory.newLatLngZoom(curPoint, 15));
// 인공위성 실제 사진으로 보기
map.setMapType(GoogleMap.MAP_TYPE_SATELLITE);
}
});
}
}
-----------------------------------
3-2
WorkSpace : ~\study\AndroidWork
/LbsApp/src/com/uticleTest1/lbsapp/ItemOverlayActivity.java
package com.uticleTest1.lbsapp;
import android.app.Activity;
import android.os.Bundle;
import android.widget.Toast;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.GoogleMap.OnMapClickListener;
import com.google.android.gms.maps.MapFragment;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;
public class ItemOverlayActivity extends Activity {
private GoogleMap map;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_googlemap);
map = ((MapFragment) getFragmentManager().findFragmentById(R.id.map))
.getMap();
if (map != null) {
Toast.makeText(getApplicationContext(), "map avaliable",
Toast.LENGTH_SHORT).show();
}
/*
// 지도 위에 이미지를 띄울 수 있게 해주는 객체
// 띄울 이미지 갯수 마다 만들어 주면 됨
MarkerOptions marker = new MarkerOptions();
// 띄울 이미지 불러옴
marker.icon(BitmapDescriptorFactory.fromResource(R.drawable.pin));
// 코드 절약을 위해 위도 경도를 정함
LatLng curPoint = new LatLng(37.5729043,126.9920667);
// 위치를 구한다
marker.position(curPoint);
map.animateCamera(CameraUpdateFactory.newLatLngZoom(curPoint, 15));
map.addMarker(marker);
*/
// 지도 터치시에 해당 부분에 이미지 띄우기
map.setOnMapClickListener(new OnMapClickListener() {
public void onMapClick(LatLng arg0) {
MarkerOptions marker = new MarkerOptions();
marker.icon(BitmapDescriptorFactory.fromResource(R.drawable.pin));
marker.position(arg0);
// 기본에 있던 내용 삭제
map.clear();
map.animateCamera(CameraUpdateFactory.newLatLngZoom(arg0, 15));
map.addMarker(marker);
}
});
}
}
import android.app.Activity;
import android.os.Bundle;
import android.widget.Toast;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.GoogleMap.OnMapClickListener;
import com.google.android.gms.maps.MapFragment;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;
public class ItemOverlayActivity extends Activity {
private GoogleMap map;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_googlemap);
map = ((MapFragment) getFragmentManager().findFragmentById(R.id.map))
.getMap();
if (map != null) {
Toast.makeText(getApplicationContext(), "map avaliable",
Toast.LENGTH_SHORT).show();
}
/*
// 지도 위에 이미지를 띄울 수 있게 해주는 객체
// 띄울 이미지 갯수 마다 만들어 주면 됨
MarkerOptions marker = new MarkerOptions();
// 띄울 이미지 불러옴
marker.icon(BitmapDescriptorFactory.fromResource(R.drawable.pin));
// 코드 절약을 위해 위도 경도를 정함
LatLng curPoint = new LatLng(37.5729043,126.9920667);
// 위치를 구한다
marker.position(curPoint);
map.animateCamera(CameraUpdateFactory.newLatLngZoom(curPoint, 15));
map.addMarker(marker);
*/
// 지도 터치시에 해당 부분에 이미지 띄우기
map.setOnMapClickListener(new OnMapClickListener() {
public void onMapClick(LatLng arg0) {
MarkerOptions marker = new MarkerOptions();
marker.icon(BitmapDescriptorFactory.fromResource(R.drawable.pin));
marker.position(arg0);
// 기본에 있던 내용 삭제
map.clear();
map.animateCamera(CameraUpdateFactory.newLatLngZoom(arg0, 15));
map.addMarker(marker);
}
});
}
}
-----------------------------------
3-3
WorkSpace : ~\study\AndroidWork
/DBApp/AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.dbapp"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="21" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="FirstActivity"></activity>
<activity android:name="SecondActivity"></activity>
</application>
</manifest>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.dbapp"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="21" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="FirstActivity"></activity>
<activity android:name="SecondActivity"></activity>
</application>
</manifest>
-----------------------------------
3-4
WorkSpace : ~\study\AndroidWork
/DBApp/res/layout/activity_main.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="onBtnFirst"
android:text="First Exam" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="onBtnSecond"
android:text="Second Exam" />
</LinearLayout>
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="onBtnFirst"
android:text="First Exam" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="onBtnSecond"
android:text="Second Exam" />
</LinearLayout>
-----------------------------------
3-5
WorkSpace : ~\study\AndroidWork
/DBApp/src/com/example/dbapp/MainActivity.java
package com.example.dbapp;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
public void onBtnFirst(View v) {
startActivity(new Intent(MainActivity.this, FirstActivity.class));
}
public void onBtnSecond(View v) {
startActivity(new Intent(MainActivity.this, SecondActivity.class));
}
}
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
public void onBtnFirst(View v) {
startActivity(new Intent(MainActivity.this, FirstActivity.class));
}
public void onBtnSecond(View v) {
startActivity(new Intent(MainActivity.this, SecondActivity.class));
}
}
-----------------------------------
3-6
WorkSpace : ~\study\AndroidWork
/DBApp/res/layout/activity_first.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="onBtnDb"
android:text="Create Or Open Database" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="onBtnTable"
android:text="Create Table" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="onBtnSelect"
android:text="Select" />
<TextView
android:id="@+id/tvResult"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp" />
</LinearLayout>
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="onBtnDb"
android:text="Create Or Open Database" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="onBtnTable"
android:text="Create Table" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="onBtnSelect"
android:text="Select" />
<TextView
android:id="@+id/tvResult"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp" />
</LinearLayout>
-----------------------------------
3-7
WorkSpace : ~\study\AndroidWork
/DBApp/src/com/example/dbapp/FirstActivity.java
package com.example.dbapp;
import android.app.Activity;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
/*
* openOrCreateDatabase - 매우 기본적인 방식, 수작업이 많음
* SqliteOpenHelper - 대부분 이걸 씀
*/
public class FirstActivity extends Activity {
private TextView tvResult;
private SQLiteDatabase database;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_first);
tvResult = (TextView) findViewById(R.id.tvResult);
}
public void onBtnDb(View v) {
// DB 생성, 처음에 한번만 만들어짐
database = openOrCreateDatabase("testDB1.db", MODE_PRIVATE, null);
tvResult.setText("DB is connected");
}
public void onBtnTable(View v) {
try {
String sql = "Create Table tbltest1(id integer, name text)";
database.execSQL(sql);
tvResult.setText("Table is created Successful!\n");
} catch (Exception e) {
}
}
public void onBtnSelect(View v) {
String sql = "select * from tbltest1 where id = 2";
Cursor cursor = database.rawQuery(sql, null);
if (cursor != null) {
int count = cursor.getCount();
tvResult.append("count : " + count + "\n");
for(int i = 0; i<count;i++){
cursor.moveToNext();
String msg = cursor.getInt(0) + ", " +cursor.getString(1);
tvResult.append(msg+"\n");
}
}
}
}
import android.app.Activity;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
/*
* openOrCreateDatabase - 매우 기본적인 방식, 수작업이 많음
* SqliteOpenHelper - 대부분 이걸 씀
*/
public class FirstActivity extends Activity {
private TextView tvResult;
private SQLiteDatabase database;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_first);
tvResult = (TextView) findViewById(R.id.tvResult);
}
public void onBtnDb(View v) {
// DB 생성, 처음에 한번만 만들어짐
database = openOrCreateDatabase("testDB1.db", MODE_PRIVATE, null);
tvResult.setText("DB is connected");
}
public void onBtnTable(View v) {
try {
String sql = "Create Table tbltest1(id integer, name text)";
database.execSQL(sql);
tvResult.setText("Table is created Successful!\n");
} catch (Exception e) {
}
}
public void onBtnSelect(View v) {
String sql = "select * from tbltest1 where id = 2";
Cursor cursor = database.rawQuery(sql, null);
if (cursor != null) {
int count = cursor.getCount();
tvResult.append("count : " + count + "\n");
for(int i = 0; i<count;i++){
cursor.moveToNext();
String msg = cursor.getInt(0) + ", " +cursor.getString(1);
tvResult.append(msg+"\n");
}
}
}
}
-----------------------------------
3-8
WorkSpace : ~\study\AndroidWork
/DBApp/src/com/example/dbapp/SecondActivity.java
package com.example.dbapp;
import android.app.Activity;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.database.sqlite.SQLiteOpenHelper;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
public class SecondActivity extends Activity {
private TextView tvResult;
private SQLiteDatabase database;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_first);
tvResult = (TextView) findViewById(R.id.tvResult);
}
public void onBtnDb(View v) {
DbHelper dbhelper = new DbHelper(this, "testdb2.db", null, 1);
dbhelper.getWritableDatabase();
}
public void onBtnTable(View v) {
}
public void onBtnSelect(View v) {
}
class DbHelper extends SQLiteOpenHelper{
// 생성자를 호출해야지만 DB가 생성 됨
public DbHelper(Context context, String name, CursorFactory factory,
int version) {
super(context, name, factory, version);
}
@Override
public void onCreate(SQLiteDatabase db) {
// 생성 될때 호출 되는 메서드 , 한번만 호출 되는 듯
tvResult.append("Database is Created successful!\n");
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
// TODO Auto-generated method stub
}
@Override
public void onOpen(SQLiteDatabase db) {
super.onOpen(db);
tvResult.append("Database is Connected successful!\n");
}
}
}
import android.app.Activity;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.database.sqlite.SQLiteOpenHelper;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
public class SecondActivity extends Activity {
private TextView tvResult;
private SQLiteDatabase database;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_first);
tvResult = (TextView) findViewById(R.id.tvResult);
}
public void onBtnDb(View v) {
DbHelper dbhelper = new DbHelper(this, "testdb2.db", null, 1);
dbhelper.getWritableDatabase();
}
public void onBtnTable(View v) {
}
public void onBtnSelect(View v) {
}
class DbHelper extends SQLiteOpenHelper{
// 생성자를 호출해야지만 DB가 생성 됨
public DbHelper(Context context, String name, CursorFactory factory,
int version) {
super(context, name, factory, version);
}
@Override
public void onCreate(SQLiteDatabase db) {
// 생성 될때 호출 되는 메서드 , 한번만 호출 되는 듯
tvResult.append("Database is Created successful!\n");
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
// TODO Auto-generated method stub
}
@Override
public void onOpen(SQLiteDatabase db) {
super.onOpen(db);
tvResult.append("Database is Connected successful!\n");
}
}
}
-----------------------------------
###################################4. 과제
-----------------------------------
* 금일 한 내용중 전체적으로 안되는 부분이 많아서 제대로 못함
adb.exe로 sqlite 못들어감
-----------------------------------###################################
'OpenFrameWork' 카테고리의 다른 글
오픈프레임워크_Day84 (0) | 2015.07.13 |
---|---|
오픈프레임워크_Day83 (0) | 2015.07.10 |
오픈프레임워크_Day81 (0) | 2015.07.08 |
오픈프레임워크_Day80 (0) | 2015.07.07 |
오픈프레임워크_Day79 (0) | 2015.07.06 |