hello below is my code of database that fetch value from database and fill
in listview. when we click on tab then screen will crash the application.
path = "/data/data/"
+ mContext.getApplicationContext().getPackageName()
+ "/databases/" + "call_history.db";
db= ((Activity)
mContext).openOrCreateDatabase(path,SQLiteDatabase.CREATE_IF_NECESSARY,null);
db.setVersion(1);
db.setLocale(Locale.getDefault());
db.setLockingEnabled(true);
cur=db.query("history", null,"call_type='r'",null, null, null,null);
//Cursor cur = db.query("history",null, null, null, null, null, null);
cur.moveToFirst();
while (cur.isAfterLast() == false) {
hm = new HashMap<String, Object>();
hm.put(CONTACTKEY, cur.getString(1));
hm.put(DURATION,"call duration:"+ cur.getString(2));
hm.put(STIME,"call start time:"+cur.getString(3));
myBooks2.add(hm);
cur.moveToNext();
}
cur.close();
On Tue, Mar 6, 2012 at 10:33 AM, moktarul anam <[email protected]> wrote:
> Hi Jagruti Sangani,
> *There is some problem in ur program. one problem may be ur not closing
> database after fetching data from database. *
> *better share ur database code *
> *
> *
> *Moktarul anam *
> *
> *
> On Monday, 5 March 2012 14:50:12 UTC+5:30, Jagruti Sangani wrote:
>>
>> hello,
>> i have use the sqlite databse for storing and retrive the value during
>> application run.It is work perfectly when i run my apllication on
>> emulator but when i run my application on phone then when try to get
>> data from database then it will crash the application.So anybody know
>> hot to use the sqlit database on phone work.
>>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en