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
Posts: 49
Registered: ‎01-17-2010
My Device: Curve 9300
Accepted Solution

Refresh a screen with a KeywordFilterField

How can I get the screen to refresh after deleting an entry from a KeywordFilterField?

 

If I close the screen and then reopen it, it appears correct, but I want the screen to refresh as soon as the entry is deleted. 

 

If it were a ListField, I could call setSize and setCallback, but those don't exist for a KeywordFilterField.

I've also tried invalidate, but it doesn't seem to work either.

 

thanks...

- Simulator 6.0.0.668 (9300)
- Windows 7 64bit
- Curve 9300 with App Version: 6.0.0.668 (2949)
Developer
Posts: 285
Registered: ‎08-26-2011
My Device: 9900
My Carrier: Not Specified

Re: Refresh a screen with a KeywordFilterField

Try to use the invalidate();  method when ever you delete the entry in the screen;

 

I am providing you a sample class how to refresh a screen; you can change according to your requirement;

 

public class SampleScreen extends MainScreen implements FieldChangeListener
{
    public SampleScreen()
    {
        createGUI();
    }
    
    public void createGUI()
    {
        //write all the code here;
    }

    public void fieldChange(Field field, int context)
    {
        if(field==clickButton)
        {
             deleteAll();
             createGUI();
             invalidate();
        }
    }
}

 

=================================================================================
Feel free to click LIKE button if the solution helps you;
--
Regards,

ALI SHAIK.
Highlighted
Developer
Posts: 49
Registered: ‎01-17-2010
My Device: Curve 9300

Re: Refresh a screen with a KeywordFilterField

Hi Ali,

 

Thanks for the reply, and that works in most cases, but with a KeywordFilterField, the fieldChanged method for the FieldChangeListener is never called.

 

It seems that the KeywordFilterField already implements a FieldChangeListener that overrides my screen's FieldChangeListener.

 

Have you tried your example with a KeywordFilterField?

 

Thanks...

- Simulator 6.0.0.668 (9300)
- Windows 7 64bit
- Curve 9300 with App Version: 6.0.0.668 (2949)
Developer
Posts: 49
Registered: ‎01-17-2010
My Device: Curve 9300

Re: Refresh a screen with a KeywordFilterField

[ Edited ]

For anyone iterested, the trick was to explicitly remove the entry from the filtered list using:

 

            Object selectedEntry = _keywordFilterField.getSelectedElement();
            _filteredList.elementRemoved(_list, selectedEntry);
            _list.remove(selectedEntry);  

- Simulator 6.0.0.668 (9300)
- Windows 7 64bit
- Curve 9300 with App Version: 6.0.0.668 (2949)