Welcome to the Official BlackBerry® Support Community Forums. This is your resource to discuss support topics with your peers, and learn from each other. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Java Development

Reply
Developer
ahmadahmad
Posts: 393
Registered: 05-31-2011
My Carrier: devel

access to calendar and tasks

hii, i need to retrieve all data registred in tasks ?

Please use plain text.
Contributor
rajenpurohit
Posts: 37
Registered: 06-29-2011

Re: access to calendar and tasks

If you want to check your tasks frm gmail, you can simply go to http://m.google.com/tasks to view your tasks.

The only limitation is... You can not retrieve it in offline mode.
----------------------------------------------------------------------------------------------------
“Please click on the ‘Kudos’ button if you really feel that you have been helped”
Please use plain text.
Developer
ahmadahmad
Posts: 393
Registered: 05-31-2011
My Carrier: devel

Re: access to calendar and tasks

this link is damaged!! and my ask, is retrieve the tasks saved on blackberry (go to Applications ---> Tasks)

Please use plain text.
Developer
ahmadahmad
Posts: 393
Registered: 05-31-2011
My Carrier: devel

Re: access to calendar and tasks

 

i found this code but i have three errors :
ToDoList todoList = (ToDoList)PIM.getInstance().openToDoList(PIM.TODO_LIST, PIM.READ_ONLY);
        Enumeration enum = todoList.items();
while (enum.hasMoreElements()) 
{
   ToDo task = (ToDo)enum.nextElement();
   int[] fieldIds = task.getFields();
   int id;
   for(int index = 0; index < fieldIds.length; ++index) 
   {
      id = fieldIds[index];
      if(task.getPIMList().getFieldDataType(id) == STRING) 
      {
         for(int j=0; j < task.countValues(id); ++j) 
         {
            String value = task.getString(id, j);
            System.out.println(task.getFieldLable(id) + "=" + value);
         }
      }
   }
}


the first on ToDoList todoList = (ToDoList)PIM.getInstance().openToDoList(PIM.TODO_LIST, PIM.READ_ONLY);
cannot find symbol
symbol  : method openToDoList(int,int)

the second:
 if(task.getPIMList().getFieldDataType(id) == STRING) 
cannot find symbol
symbol  : variable STRING

the third:
System.out.println(task.getFieldLable(id) + "=" + value);
cannot find symbol
symbol  : method getFieldLable(int)

 

Please use plain text.
Developer
rohit_marumamula
Posts: 29
Registered: 03-10-2011

Re: access to calendar and tasks

Hi,

 

I used this code and its working... try it out..

 

try

{

 

ToDoList todo=(ToDoList)PIM.getInstance().openPIMList( PIM.TODO_LIST, PIM.READ_ONLY);

}

catch(PIMException e) {

e.printStackTrace();

}

try{

 

Enumeration events = todo.items();

}

catch(PIMException e1) {

e1.printStackTrace();

}

ToDo toDo = (ToDo)events.nextElement();

Dialog.alert(toDo.getString(ToDo.NOTE, 0));

 

 

 

 

Please use plain text.
Developer
ahmadahmad
Posts: 393
Registered: 05-31-2011
My Carrier: devel

Re: access to calendar and tasks

 

in thi code i have an exception on

ToDo toDo = (ToDo)events.nextElement();

Dialog.alert(toDo.getString(ToDo.NOTE, 0));

 the error is IndexOutofBoundsException

Please use plain text.
Developer
peter_strange
Posts: 14,614
Registered: 07-14-2008

Re: access to calendar and tasks

Check the API documentation.  What does it say about this?

Please use plain text.
Developer
rohit_marumamula
Posts: 29
Registered: 03-10-2011

Re: access to calendar and tasks

 try pasting the line inside try.. mostly the error is because events is null.. try addin new tasks and run the app...

Please use plain text.