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 8178723
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T23:49:58+00:00 2026-06-06T23:49:58+00:00

This is my custom listfield. public class Custom_ListField extends ListField implements ListFieldCallback { private

  • 0

This is my custom listfield.

public class Custom_ListField extends ListField implements ListFieldCallback {
private Vector rows;
private LabelField titletext, datetext, categorytext;
private Bitmap bg = Bitmap.getBitmapResource("list_bar.png");

public Custom_ListField(String title[], String date[], String category[]) {
    super(0, ListField.MULTI_SELECT);
    setRowHeight(80);
    setCallback(this);
    Background background = BackgroundFactory.createBitmapBackground(bg);
    setBackground(background);

    rows = new Vector();

    for (int x = 0; x < title.length; x++) {
        TableRowManager row = new TableRowManager();

        titletext = new LabelField(title[x], DrawStyle.ELLIPSIS
                | LabelField.USE_ALL_WIDTH | DrawStyle.LEFT);
        titletext.setFont(Font.getDefault().derive(Font.BOLD, 20));

        row.add(titletext);

        datetext = new LabelField(date[x], DrawStyle.ELLIPSIS
                | LabelField.USE_ALL_WIDTH | DrawStyle.LEFT);
        datetext.setFont(Font.getDefault().derive(Font.BOLD, 15));
        row.add(datetext);

        categorytext = new LabelField(category[x], DrawStyle.ELLIPSIS
                | LabelField.USE_ALL_WIDTH);
        //categorytext.setMargin(0, 0, 0, 100);
        categorytext.setFont(Font.getDefault().derive(Font.BOLD, 15));
        row.add(categorytext);
        rows.addElement(row);
    }
    setSize(rows.size());
}

public void drawListRow(ListField listField, Graphics g, int index, int y,
        int width) {
    Custom_ListField list = (Custom_ListField) listField;
    TableRowManager rowManager = (TableRowManager) list.rows
            .elementAt(index);
    rowManager.drawRow(g, 0, y, width, list.getRowHeight());
}

private class TableRowManager extends Manager {
    public TableRowManager() {
        super(0);
    }

    public void drawRow(Graphics g, int x, int y, int width, int height) {
        layout(width, height);

        setPosition(x, y);
        g.pushRegion(getExtent());
        subpaint(g);
        g.popContext();
    }

    protected void sublayout(int width, int height) {
        int fontHeight = Font.getDefault().getHeight();
        int preferredWidth = getPreferredWidth();

        Field field = getField(0);
        layoutChild(field, preferredWidth - 16, fontHeight + 1);
        setPositionChild(field, 5, 5);

        field = getField(1);
        layoutChild(field, 150, fontHeight);
        setPositionChild(field, 5, fontHeight + 5);

        field = getField(2);
        layoutChild(field, 150, fontHeight);
        setPositionChild(field, preferredWidth - 155, fontHeight + 5);

        setExtent(preferredWidth, getPreferredHeight());
    }

    public int getPreferredWidth() {
        return Graphics.getScreenWidth();
    }

    public int getPreferredHeight() {
        return getRowHeight();
    }
}

public Object get(ListField listField, int index) {
    return null;
}

public int getPreferredWidth(ListField listField) {
    return 0;
}

public int indexOfList(ListField listField, String prefix, int start) {
    return 0;
}
}

Where to set if clicked then push screen?

  • 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-06-06T23:50:00+00:00Added an answer on June 6, 2026 at 11:50 pm

    To do that you should override navigationClick(int status, int time). Then inside that get the selected item index by listField.getSelectedIndex() and do what ever you need with it.

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

Sidebar

Related Questions

This is my latest Custom_Listfield class. public class Custom_ListField extends ListField { private String[]
I have this custom class which extends EventDispatcher private var assetsManager:AssetManager; And this running
I have this custom class ... public class DrawView extends ImageView When I set
I am using this Custom Adapter for my ListView: public class SideMenuAdapter extends BaseAdapter
This is my custom string class (xstring.hpp): #include <vector> #include <sstream> namespace { using
I have this custom error handler: `class AppError extends ErrorHandler { function error404($params) {
I have this custom type: public struct PasswordString { private string value; public PasswordString(string
I have a screen which call a listfield . public class Main_AllLatestNews extends MainScreen
I have this custom filter for compress the output of my pages: public class
i create this custom actionlink public static IHtmlString CustomActionLink(this HtmlHelper htmlHelper, int userId, string

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.