Search code examples
blackberrybuttonlistfield

ListField and button focus issue in same screen


Hello all i stuck at one problem. I have implemented a ListField in one Screen. On top of the Screen i have used one HorizontalFieldManager to hold a TitleLabel and Two Butons. I have pushed some screen on all the rows of the listfield. My problem is, letSuppose when i am on 4th row and i have selected what i want then when i clicking on the button, then the button worked but the screen which i have implemented at 4th row also appear how to avoid it. I am testing it on storm 9550 simulator and using Blackberry eclipse plugin5.0 . I am running out of idea please help me .

navigation click is like this

protected boolean navigationClick(int status, int time) {

    selectListAndButton();
    return true;

}       

//And here is the selectListAndButton Method

private selectListAndButton(){
 Field field = getFieldWithFocus().getLeafFieldWithFocus();
    if(field == backCustomButton){
        //Popped the active Screen

    }else if(field == saveCustomButton){
        //Saving some Data to the Database And pushing another Screen here
                    // problem comes here if i am at 2nd row of the listfield and selects  
                     something from there and clicked on the button the screen which was  

                     implemented at 2nd row also appears   

    }

    else if (_list.getSelectedIndex() == 0){    
        //Called a date picker

    }
            else if (_list.getSelectedIndex() == 1){    
        //Pushed some another screen 

    }

           else if (_list.getSelectedIndex() == ){  
        //Pushed some another screen 

    }

Solution

  • I had solved it. but posting the answer late. I just dropped the idea of using ListField because i dont have so much rows to add. So i have just used the little trick rather using ListField i have used HorizontalFieldManager and its look like a List so everything working fine.

    Thanks cheers :)