Last active
August 29, 2015 13:56
-
-
Save msdalp/9297781 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.test.db; | |
import android.app.Activity; | |
import android.os.Bundle; | |
import android.util.Log; | |
import java.util.LinkedList; | |
import java.util.List; | |
public class MainActivity extends Activity { | |
public static String TAG = "MyDbActivity"; | |
public static MyDb MyDb; | |
@Override | |
public void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.main); | |
MyDb = new MyDb(this); | |
List<Data> data = new LinkedList<Data>(); | |
data.add(new Data(1, 2032, "data1")); | |
if (MyDb.addData(data)) { | |
Log.d("Data value is:", MyDb.getDataValue(1L)); | |
} | |
} | |
@Override | |
protected void onDestroy() { | |
super.onDestroy(); | |
MyDb.close(); | |
MyDb = null; | |
} | |
public class Data { | |
public long id; | |
public long dataId; | |
public String value; | |
public Data() { | |
} | |
public Data(long _id, long _dataId, String _value) { | |
this.id = _id; | |
this.dataId = _dataId; | |
this.value = _value; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment