Hi all
I am android Developer. I developed a project.
Alerm :
User can set date time . A alerm will trigger when time is matching.
My work:
Two Java Class:-- MyDate Class ,SqlDatabase class;
Mydata will catch user data and pass it to the sql class.
I catch that date , time and store in sqlite database with java
coding.
this two class is work fine.I check it.
I use Four class to handle ALerm .
BrodcastReceiver:---- Reboot, ALermManager;
Services:----WAkeFullIntent service class ,APpservice class.
Reboot running when system is rebooting. It is running before system
is switching off.
It is call Alermmanager after some time .I set the time.
"mgr.setRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP,
SystemClock.elapsedRealtime()+120000,
PERIOD,
pi);"
Alermmanager direct call Appservice class wittout any work.
It send "" WakefulIntentService.sendWakefulWork(context,
AppService.class);""
Appservice class call WakefullIntentService without any work.
public AppService() {
super("AppService");
wakefullIntent class work and send to AlermManager class.
after work alerm manager will send appservice class .
I catch system current date .it is work in fine.
then I open database and try to catch database data.
My code ----
Calendar cal = Calendar.getInstance();
//SimpleDateFormat df = new SimpleDateFormat("MM/dd/
yyyy hh:mm:ss");
SimpleDateFormat df = new
SimpleDateFormat("d:M:yyyy");
SimpleDateFormat d = new SimpleDateFormat("H:m");
df.setLenient(false);
d.setLenient(false);
String s = df.format(cal.getTime());
String t = df.format(cal.getTime());
System.out.println("sssssssssssssssssssss.........."+s);
//
System.out.println("\naaaaaaaaaaaaaaaaaaaaaaaaaaaa...");
//dbAddEvent=new MultiColumndb(this);
db.open();
aa=Long.parseLong(s);
Cursor cr=db.getAddEvent(aa);
if (cr.moveToFirst())
{
do {
Log.v("ArrayList","RowCount :"+cr.getPosition()+" "+"Column
Count :"+cr.getString(0)+" "+cr.getString(1));
date[i]=cr.getString(0);
//
title[positionsEvents]=addEventsCr.getString(1);
//Log.v("titles", title[positionsEvents]);
//positionsEvents++;
} while (cr.moveToNext());
cr.close();
db.close();
};
System.out.println(date[i]);
//String a=Alert.getString(0).toString()
+Alert.getString(1).toString()+Alert.getString(2).toString();
//String b=Alert.getString(1).toString();
} catch (Exception e) {
// TODO: handle exception
Log.e("Exception", e.getMessage(), e);
}
I use this code in onHandleIntent method in wakefullIntent Service.
I use this code in doWakefulWork in APPservice class.
I use this code in Reboot class .
Everywhere I get A error that is
Null
Java.lang.nullpointerException.
SO what is my fault. If anyone help me .
Please help me .
--
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