help me with this code and problem..

Problems with WiFi, SQLite ,Bluetooth, WiMax, Proxies, etc...

help me with this code and problem..

Postby b3n_hysteria » Thu Jun 11, 2009 5:31 am

i want to insert values into some table.. buat i got message in ddms android
"Uncaught handler: thread main exiting due to uncaught exception"

here come code
i call the method to insert into database table :

dbSaham.insertSaham(new Date(2009,12,2),new Time(2,23,12), Float.valueOf(saham.getOpen()),Float.valueOf(saham.getHigh()), Float.valueOf(saham.getLow()), Float.valueOf(saham.getChange()),Integer.parseInt(saham.getVolume()),Float.valueOf(saham.getLast() ));

here the construktor like this :

public Saham (){
symbol = "android";
last = "1.0";
date = "";
time = "";
change = "3";
open = "23";
high = "11";
low = "12";
volume = "11";
}

and the method to insert in database table is:
public void insertSaham(Date waktu,Time time,float open,float high,float low,float change,int volume,float last) throws FileNotFoundException
{
try {
String query = "insert into "+DATABASE_TABLE+ "(date,time,change,open,high,last,low,volume)values('bbbb','aaa',"+ change +","+open+","+high+","+last+","+low+","+volume+" );";
Log.d("inputan di insert :", query);
db.execSQL(query);
} finally {
if (db != null)
db.close();
}
}

thank's alot.. regards..
Attachments
problem.JPG
problem.JPG (170.1 KiB) Viewed 191 times
b3n_hysteria
Junior Developer
Junior Developer
 
Posts: 11
Joined: Thu May 07, 2009 1:38 pm

Top

Postby WarrenFaith » Thu Jun 11, 2009 2:02 pm

One variable in your call seems to be null.
Find out which one in debugging mode...
And try to use the Syntax-Highlighting
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. dbSaham.insertSaham(new Date(2009,12,2),
  2.  
  3.     new Time(2,23,12),
  4.  
  5.     Float.valueOf(saham.getOpen()),
  6.  
  7.     Float.valueOf(saham.getHigh()),
  8.  
  9.     Float.valueOf(saham.getLow()),
  10.  
  11.     Float.valueOf(saham.getChange()),
  12.  
  13.     Integer.parseInt(saham.getVolume()),
  14.  
  15.     Float.valueOf(saham.getLast()));
Parsed in 0.030 seconds, using GeSHi 1.0.8.4
WarrenFaith
Moderator
Moderator
 
Posts: 227
Joined: Fri Mar 13, 2009 10:59 am
Location: Berlin, Germany

Postby b3n_hysteria » Fri Jun 12, 2009 6:04 am

thank's for replay..
i've been done solve the problem.. i forgot
this code :
SQLiteDatabase nameDb = namesHelper.getWritableDatabase();

:D
thank's brur.. regards.. hehehehe
b3n_hysteria
Junior Developer
Junior Developer
 
Posts: 11
Joined: Thu May 07, 2009 1:38 pm

Top

Return to Networking & Database Problems

Who is online

Users browsing this forum: No registered users and 4 guests