Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6796863
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T18:32:20+00:00 2026-05-26T18:32:20+00:00

I am using a customlistfield by extending VerticalFieldManager, and for the row I am

  • 0

I am using a customlistfield by extending VerticalFieldManager, and for the row I am usingf another CustoRowManager that extends Manager. The CustomRowManager has 2 TextField and a BitmapField . This list is implemented for a live xml feed. For loading the bitmapfield I am displaying placeholders which is then replaced by the actual image from background thread. I am not able to figure out how I should replace place holders with the bitmapfield. using invalidate() is one option, but on which element I should perform it.

public class CustomList extends VerticalFieldManager{
private int totalHeight = 0;
private int screenHeight = 0;
private int scrollPosition = 0;

protected void sublayout(int width, int height)
{
    width = 480;
    height = 230;
            super.sublayout(width,height);
    setExtent(width, height);
}   

protected boolean navigationClick(int status, int time)
{
    int index;
    System.out.println("CLICKED!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
    if ((status & KeypadListener.STATUS_FOUR_WAY) == KeypadListener.STATUS_FOUR_WAY) 
        {           
        index = this.getFieldWithFocusIndex();
        UiApplication.getUiApplication().pushScreen(new TopNewsScreen(_vec, index));
        }
    return true;
}   

Bitmap _bmp = null;
BitmapField _bmF = null;
Object _Obj = null;
TopNews _topNews = null;
String _headStr = null, _metaStr = null;
CustTextField _headNews = null, _metaData = null;
CustomRow _custRow = null;
Vector _vec;

public CustomList(Vector _vec,long _property)
{
    super(_property);
    this._vec = new Vector();
    this._vec = _vec;

    int _size = _vec.size();
    int i ;

    for(i = 0; i <_size; i++)
    {   
        _headStr = new String();
        _metaStr = new String();
        _bmp = Bitmap.getBitmapResource("img/1.jpg");
        _bmF = new BitmapField(_bmp);

        _topNews = (TopNews)_vec.elementAt(i);
        _headStr = _topNews.getHeadline();
        _metaStr = _topNews.getMetaData();

        int _newsLeng = _headStr.length(), alert = 0;

        if(_newsLeng <= 35)
        {
            alert = 0;
        }else if(_newsLeng>35&&_newsLeng<=70)
        {
            alert = 1;
        }else {
            alert = 2;
            _headStr = this.truncate(_headStr,70);

        }
        _custRow = new CustomRow(alert);

        _headNews = new CustTextField(_headStr,25,0x05235b,TextField.NON_FOCUSABLE);
        _metaData = new CustTextField(_metaStr,15,0x666666,TextField.NON_FOCUSABLE);

        _custRow.add(_headNews);
        _custRow.add(_metaData);
        _custRow.add(_bmF);

        super.add(_custRow);


    }
}



String truncate(String value, int length)
{
      if (value != null && value.length() > length)
        value = value.substring(0, length);
      return value;
}
}

class CustomRow extends Manager implements FocusChangeListener{

private int  _headLeng;
private NullField _focus = null;

CustomRow(int _headLeng)
{
    super(Manager.FOCUSABLE|
            Manager.NO_HORIZONTAL_SCROLL
            |Manager.NO_VERTICAL_SCROLL);

    this._headLeng = _headLeng;
    _focus = new NullField(NullField.FOCUSABLE);
    _focus.setFocusListener(CustomRow.this);
    this.add(_focus);

}

protected void sublayout(int width, int height) 
{
    if(_headLeng==0)
    {
    layoutChild(getField(0),0,0);  
    setPositionChild(getField(0),0 , 0);

    layoutChild(getField(1),360,20);  
    setPositionChild(getField(1),10 , 10);

    layoutChild(getField(2),300, 20);
    setPositionChild(getField(2), 10, 65);

    layoutChild(getField(3),90,65);
    setPositionChild(getField(3), 380, 10);

    }else
    {
    /*  layoutChild(getField(0),0,0);  
        setPositionChild(getField(0),0 , 0);

        layoutChild(getField(1),360,20);  
        setPositionChild(getField(1),10 , 10);

        layoutChild(getField(2),300, 20);   
        setPositionChild(getField(2), 10, 50);

        layoutChild(getField(3),90,65);
        setPositionChild(getField(3), 380, 10);     */
        layoutChild(getField(0),0,0);  
        setPositionChild(getField(0),0 , 0);

        layoutChild(getField(1),360,20);  
        setPositionChild(getField(1),10 , 10);

        layoutChild(getField(2),300, 20);
        setPositionChild(getField(2), 10, 65);

        layoutChild(getField(3),90,65);
        setPositionChild(getField(3), 380, 10);

    }

    height = 80;
    width = 480;  
    setExtent(width, height);
}
protected void paint(Graphics graphics)
{
    graphics.setColor(Color.GRAY);
    graphics.drawLine(10, 79, Display.getWidth()-10, 79);
    super.paint(graphics);
}

public void focusChanged(Field field, int eventType) {
    // TODO Auto-generated method stub
    this.getManager().invalidate();
}



protected void paintBackground(Graphics g) {
      int prevBg = g.getBackgroundColor();
      if (_focus.isFocus()) {
        g.setBackgroundColor(Color.LIGHTBLUE);
      } else {
        g.setBackgroundColor(Color.WHITE);
      }
      g.clear();
      g.setBackgroundColor(prevBg);
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T18:32:20+00:00Added an answer on May 26, 2026 at 6:32 pm

    the below link has answer for the question, I should change the name to Blackberry lazyloading.

    http://supportforums.blackberry.com/t5/Java-Development/Clumsy-layout-invalidate/m-p/1398763

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using C#, I need a class called User that has a username, password, active
Using ASP.NET MVC there are situations (such as form submission) that may require a
Using TortoiseSVN against VisualSVN I delete a source file that I should not have
Using android 2.3.3, I have a background Service which has a socket connection. There's
Using report builder 3.0, I have a report that queries a cube. How do
Using Entity Framework CodeFirst, how do I create a created datetime column that gets
Using the http://www.ifans.com/forums/showthread.php?t=132024 post from another question i am allowing the user to enter
Using CRM 4, I have an entity form that contains a tab with an
using chrome 15 on osx 10.6.8 When adding event listeners, I've found that putting
Using Browserlab, it appears that the background image is not centred in Firefox7 for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.