Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
Skripsi
Posts: 89
Registered: ‎09-03-2009
My Device: Not Specified
Accepted Solution

set reminder in BB

hi all,

 

i want to make reminder for my application...

 

what is the best between invoke Calendar or Task (ToDoList) ?

 

i've tried invoke ToDoList, but i can't set reminder for my task...then i try invoke Calendar and got exception...

 

Here is my code to invoke Calendar

EventList _eventList = null;
try {
	// Creates/Opens an instance of the specified PIM list (Event List) in Read/Write mode.
	_eventList = (EventList)PIM.getInstance().openPIMList(PIM.EVENT_LIST, PIM.READ_WRITE);

	// Creates a new Event
	BlackBerryEvent bbEvent = (BlackBerryEvent)_eventList.createEvent();


	bbEvent.addString(BlackBerryEvent.NOTE, BlackBerryEvent.ATTR_NONE, "tes task");
	bbEvent.addDate(BlackBerryEvent.DATE, BlackBerryEvent.ATTR_NONE, HttpDateParser.parse("2009-11-23"));
	// Checks the Event List to determine if the ALLDAY field is supported
	if(_eventList.isSupportedField(BlackBerryEvent.ALLDAY)) {
	// Checks the event to determine if ALLDAY attribute as already be set
		if(bbEvent.countValues(BlackBerryEvent.ALLDAY) > 0) {
			bbEvent.setBoolean(BlackBerryEvent.ALLDAY,0,Event.ATTR_NONE,true);
		} else {
			bbEvent.addBoolean(BlackBerryEvent.ALLDAY,Event.ATTR_NONE,true);
		}
	}
	Dialog.inform("added");
} catch(PIMException e) {
	Dialog.inform("failed");
}

 

 

And this is my code to invoke ToDoList (but still i can't set Reminder for my task)

 

try{
	ToDoList list = (ToDoList)PIM.getInstance().openPIMList(PIM.TODO_LIST, PIM.WRITE_ONLY);
	ToDo newTask = list.createToDo();
	newTask.addString(ToDo.SUMMARY, PIMItem.ATTR_NONE, txtTask.getText());
	newTask.addDate(ToDo.DUE, 0, HttpDateParser.parse("2009-03-13"));
	//newTask.addInt(net.rim.blackberry.api.pdap.BlackBerryToDo.REMINDER,ToDo.ATTR_NONE,0);
	//PIMItem.setDate(BlackBerryToDo.REMINDER,);
	newTask.commit();

	Dialog.inform("Task added");
}catch(Exception e){
	e.printStackTrace();
	Dialog.inform("exception");
}

 

 

please help,

 

thanks...

Please use plain text.
Developer
belberry
Posts: 265
Registered: ‎08-27-2009
My Device: Not Specified

Re: set reminder in BB

Hi try this piece of code for Task Application and see if it helps to u im any way................

 

 

import javax.microedition.pim.*;
import net.rim.blackberry.api.invoke.*;
import net.rim.blackberry.api.pdap.*;



public void TaskApplication()
    {
        try
        {            
            ToDoList tdl = (ToDoList)PIM.getInstance().openPIMList(PIM.TODO_LIST, PIM.READ_WRITE);
            ToDo todo = tdl.createToDo();           
                
            //todo.addInt(ToDo.PRIORITY, ToDo.ATTR_NONE, 3);
            //String value = TimerClass.getCurrentDate();
            //long crt_date = (Long.parseLong(value));
            //todo.addDate(ToDo.DUE, ToDo.ATTR_NONE, crt_date);                          
          
            
                 //For Setting Heading
                 todo.addString(ToDo.SUMMARY, 0, "Set heading"); 
            
                //For Changing Status          
                todo.addInt(BlackBerryToDo.STATUS, ToDo.ATTR_NONE, BlackBerryToDo.STATUS_IN_PROGRESS);               
                
                //For changing Priority
                if (tdl.isSupportedField(ToDo.PRIORITY)) 
                {
                    todo.addInt(ToDo.PRIORITY, ToDo.ATTR_NONE, 5); //3 -> High  , 4 -> Normal
                }
                
                
                 if (tdl.isSupportedField(ToDo.DUE)) 
                {
                    Date date;
                    date = new Date(System.currentTimeMillis());
                    System.out.println("DATE"+ date.toString());
                    long longDate=date.getTime();      
                    //todo.addDate(ToDo.DUE, ToDo.ATTR_NONE,(longDate + 17280000));
                    todo.addDate(ToDo.DUE, ToDo.ATTR_NONE,(longDate));
                }         
                            
               
            Invoke.invokeApplication(Invoke.APP_TYPE_TASKS, new TaskArguments( TaskArguments.ARG_NEW, todo));
        }
        
            catch(Exception e)
            {
            System.out.println("Exception "+ e);   
            }
        
    }

 

Please use plain text.
Developer
belberry
Posts: 265
Registered: ‎08-27-2009
My Device: Not Specified

Re: set reminder in BB

try this piece of Code for Task Application and see if it helps u in any way

 

import javax.microedition.pim.*;
import net.rim.blackberry.api.invoke.*;
import net.rim.blackberry.api.pdap.*;



public void TaskAPI()
    {
        try
        {            
            ToDoList tdl = (ToDoList)PIM.getInstance().openPIMList(PIM.TODO_LIST, PIM.READ_WRITE);
            ToDo todo = tdl.createToDo();           
                
                                     
          
            
                 //For Setting Heading
                 todo.addString(ToDo.SUMMARY, 0, "Set heading if Required"); 
            
                //For Changing Status          
                todo.addInt(BlackBerryToDo.STATUS, ToDo.ATTR_NONE, BlackBerryToDo.STATUS_IN_PROGRESS);               
                
                //For changing Priority
                if (tdl.isSupportedField(ToDo.PRIORITY)) 
                {
                    todo.addInt(ToDo.PRIORITY, ToDo.ATTR_NONE, 5); //3 -> High  , 4 -> Normal
                }
                
                
                 if (tdl.isSupportedField(ToDo.DUE)) 
                {
                    Date date;
                    date = new Date(System.currentTimeMillis());
                    System.out.println("DATE"+ date.toString());
                    long longDate=date.getTime();      
                    //todo.addDate(ToDo.DUE, ToDo.ATTR_NONE,(longDate + 17280000));
                    todo.addDate(ToDo.DUE, ToDo.ATTR_NONE,(longDate));
                }         
            
					               

            Invoke.invokeApplication(Invoke.APP_TYPE_TASKS, new TaskArguments( TaskArguments.ARG_NEW, todo));
        }
        
            catch(Exception e)
            {
            System.out.println("Exception "+ e);   
            }
        
    }

 

Please use plain text.
Developer
Skripsi
Posts: 89
Registered: ‎09-03-2009
My Device: Not Specified

Re: set reminder in BB

[ Edited ]

thanks belberry for your response..

 

i've tried to change my code like this:

 

try{	
ToDoList list = (ToDoList)PIM.getInstance().openPIMList(PIM.TODO_LIST, PIM.WRITE_ONLY);
BlackBerryToDo newTask = (BlackBerryToDo)list.createToDo();
newTask.addString(BlackBerryToDo.SUMMARY, PIMItem.ATTR_NONE, txtTask.getText());
newTask.addDate(BlackBerryToDo.DUE, 0, HttpDateParser.parse("2009-03-13"));
newTask.addDate(BlackBerryToDo.REMINDER, 0, HttpDateParser.parse("2009-03-13"));
newTask.addInt(BlackBerryToDo.STATUS, ToDo.ATTR_NONE, BlackBerryToDo.STATUS_IN_PROGRESS);
RepeatRule rule = new RepeatRule();
rule.setInt(RepeatRule.FREQUENCY, RepeatRule.DAILY);
newTask.setRepeat(rule);

newTask.commit();

Dialog.inform("Task added");
}catch(Exception e){
Dialog.alert("error "+e.getMessage());
}

 

 

but it seems i couldn't set END date for reminder in my new task...so it will remind user every day...

 

how can i set END date for reminder in todo list ?

 

thanks

Please use plain text.
Developer
Skripsi
Posts: 89
Registered: ‎09-03-2009
My Device: Not Specified

Re: set reminder in BB

i've solved my problem,..

Please use plain text.
Developer
belberry
Posts: 265
Registered: ‎08-27-2009
My Device: Not Specified

Re: set reminder in BB

 

 

      ok thank u ............. i want to have a snooze option to this task that once task application raises the reminder then we have Open/Marked Compledted/Dismiss button option. along with these  i need to have extra button sayong snooze to raise the task alarm after some 10mins of time........is it possible to put this snooze button when task application raises the reminder.

Please use plain text.
Developer
Skripsi
Posts: 89
Registered: ‎09-03-2009
My Device: Not Specified

Re: set reminder in BB

 


belberry wrote:

 

 

      ok thank u ............. i want to have a snooze option to this task that once task application raises the reminder then we have Open/Marked Compledted/Dismiss button option. along with these  i need to have extra button sayong snooze to raise the task alarm after some 10mins of time........is it possible to put this snooze button when task application raises the reminder.


 

maybe you should make custom reminder application if you need so many feature that BB can't afford..

 

Please use plain text.
Developer
belberry
Posts: 265
Registered: ‎08-27-2009
My Device: Not Specified

Re: set reminder in BB

can u help i this reminder applicati how to develop it.............

Please use plain text.