Monday, April 12, 2010

Use of Navigation Click with ListField

package com.rim.listimplement;// Package name

// Import API's
import net.rim.device.api.ui.UiApplication;
import net.rim.device.api.ui.component.Dialog;
import net.rim.device.api.ui.component.LabelField;
import net.rim.device.api.ui.component.ObjectListField;
import net.rim.device.api.ui.container.MainScreen;

//Entering into the Appliction
public class List extends UiApplication {
public static void main(String[] args)
{
List theapp = new List();
theapp.enterEventDispatcher();

}
public List()
{
pushScreen(new first());
}

}
/ MAin screen of the class
class first extends MainScreen
{
ObjectListField mylist = new ObjectListField()// Creating ObjectListField
{
// Implementing Navigation Click
protected boolean navigationClick(int status, int time)
{
int selectedindex = mylist.getSelectedIndex();
String it = (String)mylist.get(mylist, selectedindex);
lb = new LabelField(it,LabelField.ELLIPSIS);
Dialog.alert("value"+lb);
return true;
}
};
LabelField lb ;
public first()
{// Getting Values From ListField
super();
String[] item = new String[] {"One","Two","Three"};
mylist.set(item);
add(mylist);


}





}

4 comments:

  1. hi.. i m new to blackberry .is it possible to play flv videos from url in a blackberry device,any code samples?

    ReplyDelete
  2. It is helped me a lot but I am having a problem when I clicked on other button it still invoke event navigationClick().

    Please help me!

    ReplyDelete