I m going through ListField,..I m getting problem when i click on the selected index....
I want the code,when i click on the selected index,it is showing all the profiles for the particular index
public class ListEmployees extends MainScreen implements ListFieldCallback
{
ListField list;
String[] items= {"Srikanth","Pradeep","Ranjith"};
public ListEmployees()
{
setTitle("List Screen");
list = new ListField();
list.setSize(3);
list.setCallback(this);
add(list);
}
using switch case
public void drawListRow(ListField listField, Graphics g, int index,int y, int width)
{
int a= listField.getSelectedIndex();
g.drawText(items[a], 0, y,0,50);
switch(a)
{
case 0 :
g.setColor(Color.GREEN);
Bitmap srikanthImg = Bitmap.getBitmapResource("srikanth.jpg");
if(list.getSelectedIndex()==0)
showMessage(srikanthImg,"Srikanth","1363");
else
break;
//Dialog.alert("The selected element is: " + Integer .toString ());
break;
case 1 :
g.setColor(Color.GREEN);
Bitmap PradeepImg = Bitmap.getBitmapResource("pradeep.jpg");
showMessage(PradeepImg,"Pradeep","1303");
break;
case 2 :
g.setColor(Color.GREEN);
Bitmap ranjithImg = Bitmap.getBitmapResource("ranjith.jpg");
showMessage(ranjithImg,"ranjith","1333");
break;
default :
Dialog.alert("No Information Found !!!");
}
}
private void showMessage(Bitmap map, String name1, String empId1) {
// TODO Auto-generated method stub
String data = name1 + "\n"+empId1;
UiEngine ui = Ui.getUiEngine();
Screen screen = new Dialog(Dialog.D_OK, data, Dialog.OK, map, FIELD_HCENTER);
ui.queueStatus(screen, 1, true);
ListFieldCallback.drawListRow()
is just for drawing a list item representation on UI.Looks like you are looking for how to catch on-list click event. If yes, then override
ListField.navigationClick()
.