There are three class History, Databasehandlreone, DatabaseHandler. In History call there is one static method named addHistory(Record record). it calling the non static method which is in same class named calling(String u).
History
class History extends Activity{
public static long addHistory(Record record) {
String u=record.getURL();
History ss=new History();
ss.calling(u);
}
private void calling(String u) {
DatabaseHandlerone db=new DatabaseHandlerone(History.this);
try{
db.good(u);
}catch(Exception e){
Log.v("Error",e.toString());
}}}
In calling function, it calls the function named good which is in another class name Databasehandlerone.
DatabaseHandlerone.java
public class DatabaseHandlerone {
public DatabaseHandlerone(History history) {
// TODO Auto-generated constructor stub
}
public void good(String s){
try{
DatabaseHandler db=new DatabaseHandler(DatabaseHandlerone.this);
db.deleteall(s);
}catch(Exception e){
Log.v("Calling from DatabseHandler1",e.toString());
} }
In good function, deleteall function will be called which is another class called DatabaseHandler.
When I am calling db.deleteall(s). It showing Java.NullPointerException error. can anyone pls Help.
DatabseHandler.this
public class DatabaseHandler extends SQLiteOpenHelper {
public void deleteall(String s){
Log.v("value",s);
}
Logcat
02-21 11:46:35.941: D/libc-netbsd(22197): getaddrinfo: stackoverflow.com get result from proxy >>
02-21 11:46:35.943: D/ID Safe Utils(22197): leave sendOpenUrlBroadcast
02-21 11:46:35.959: V/Good(22197): http://stackoverflow.com/users
02-21 11:46:35.959: V/Calling(22197): http://stackoverflow.com/users
02-21 11:46:35.959: V/After Databse(22197): After DatabseHandler Calling
02-21 11:46:35.959: V/Value(22197): http://stackoverflow.com/users
02-21 11:46:35.959: V/String(22197): http://stackoverflow.com/users
02-21 11:46:35.960: V/DatabaseHandler()(22197): Afert SdCard
02-21 11:46:35.960: V/Calling from DatabseHandler1(22197): java.lang.NullPointerException
02-21 11:46:35.960: V/DatabaseHandler()(22197): Afert SdCard
02-21 11:46:35.960: V/Retreiving Values:(22197): java.lang.NullPointerException