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

  • Home
  • SEARCH
  • 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 5934899
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T15:10:44+00:00 2026-05-22T15:10:44+00:00

I’m making an application in which there are few tabs on each tab click

  • 0

I’m making an application in which there are few tabs on each tab click a url is called and an online xml is parsed. The data from this xml is displayed. The problem is that when the data is dispalyed the tabs disappear and only appear when i press the back button of the simulator. Whereas the data should appear below the tabs.

Please help

My UI

public class TabControl extends UiApplication {

public TabControl() {
    TabControlScreen screen = new TabControlScreen();
    pushScreen(screen);
}

public static void main(String[] args) {
    TabControl app = new TabControl();
    app.enterEventDispatcher();
}

private class TabControlScreen extends MainScreen implements FocusChangeListener {

    private Bitmap backgroundBitmap = Bitmap.getBitmapResource("rednavnar.png");

    private LabelField tab1;
    private LabelField tab2;
    private LabelField tab3;


    private VerticalFieldManager tabArea;
    private VerticalFieldManager tab1Manager;
    private VerticalFieldManager tab2Manager;
    private VerticalFieldManager tab3Manager;

    public TabControlScreen() {

        LabelField appTitle = new LabelField("Energy", LabelField.ELLIPSIS | LabelField.USE_ALL_WIDTH | LabelField.FIELD_HCENTER);
        this.setTitle(appTitle);

        HorizontalFieldManager hManager = new HorizontalFieldManager( Manager.HORIZONTAL_SCROLL | Manager.HORIZONTAL_SCROLLBAR | Manager.USE_ALL_WIDTH | Manager.TOPMOST) {

            // Override the paint method to draw the background image.
            public void paint(Graphics graphics) {
                // Draw the background image and then call paint.
                graphics.drawBitmap(0, 0, 700, 100, backgroundBitmap, 0, 0);
                super.paint(graphics);
            }
        };
        tab1 = new LabelField("Top News", LabelField.FOCUSABLE | LabelField.HIGHLIGHT_FOCUS){
            protected boolean navigationClick(int status,int time){
                tabArea = displayTab1();
                return true;
            }
        };
        LabelField separator = new LabelField("|", LabelField.NON_FOCUSABLE);
        tab2 = new LabelField("Power", LabelField.FOCUSABLE | LabelField.HIGHLIGHT_FOCUS){
            protected boolean navigationClick(int status,int time){
                tabArea = displayTab2();
                return true;
            }
        };
        LabelField separator1 = new LabelField("|", LabelField.NON_FOCUSABLE);
        tab3 = new LabelField("Renewable Energy", LabelField.FOCUSABLE | LabelField.HIGHLIGHT_FOCUS){
            protected boolean navigationClick(int status,int time){
                tabArea = displayTab3();
                return true;
            }
        };


        tab1.setFocusListener(this);
        tab2.setFocusListener(this);
        tab3.setFocusListener(this);

        hManager.add(tab1);
        hManager.add(separator);
        hManager.add(tab2);
        hManager.add(separator1);
        hManager.add(tab3);

        add(hManager);
        add(new SeparatorField());

        tab1Manager = new VerticalFieldManager();
        tab2Manager = new VerticalFieldManager();
        tab3Manager = new VerticalFieldManager();
        tabArea = displayTab1();
        add(tabArea);

    }

    public void focusChanged(Field field, int eventType) {
        if (tabArea != null) {
            if (eventType == FOCUS_GAINED) {
                if (field == tab1) {
                    delete(tabArea);
                    tabArea = displayTab1();
                    add(tabArea);
                } else if (field == tab2) {
                    delete(tabArea);
                    tabArea = displayTab2();
                    add(tabArea);
                } else if (field == tab3) {
                    delete(tabArea);
                    tabArea = displayTab3();
                    add(tabArea);
                }
            }
        }
    }

    public VerticalFieldManager displayTab1() {

        UiApplication.getUiApplication().pushScreen(new News());
        return tab1Manager;
    }

    public VerticalFieldManager displayTab2() {

        UiApplication.getUiApplication().pushScreen(new Power());
        return tab2Manager;
    }

    public VerticalFieldManager displayTab3() {

        UiApplication.getUiApplication().pushScreen(new Energy());
        return tab3Manager;
    }

}
}

My News Main Screen

public class News extends MainScreen {
public News() {

    String xmlUrl = "http://182.71.5.53:9090/solr/core4/select/?q=*";

    String[][] urlData = XmlFunctions.getURLFromXml(xmlUrl);
    for (int i = 0; i < urlData.length; i++) {
        final String title = urlData[0][i];
        final String id = urlData[1][i];
        //add(new LinkLabel(title, i));
        add(new RichTextField(title){
            protected boolean navigationClick(int status,int time){

                String cId = id;
                String bodyUrl = "http://192.168.1.44:9090/solr/core0/select/?q="+cId+";
                String[][] bodyData = XmlFunctions.getBodyFromXml(bodyUrl);
                for(int j=0;j<bodyData.length;j++){
                    String body = bodyData[0][j];
                    add(new RichTextField(body));
                }
                return true;
            }
        });
        add(new SeparatorField());
    }
}
}

Now i want to open this news screen below the tabs
Please help

  • 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-22T15:10:45+00:00Added an answer on May 22, 2026 at 3:10 pm

    For your TabControl Class

    public class TabControl extends UiApplication {
    
        public TabControl() {
            TabControlScreen screen = new TabControlScreen();
            pushScreen(screen);
        }
    
        public static void main(String[] args) {
            TabControl app = new TabControl();
            app.enterEventDispatcher();
        }
    
        private class TabControlScreen extends MainScreen {
    
            private Bitmap backgroundBitmap = Bitmap.getBitmapResource("rednavnar.png");
    
            private LabelField tab1;
            private LabelField tab2;
            private LabelField tab3;
    
            private VerticalFieldManager tabArea;
    
            public TabControlScreen() {
    
                LabelField appTitle = new LabelField("Energy", LabelField.ELLIPSIS | LabelField.USE_ALL_WIDTH | LabelField.FIELD_HCENTER);
                this.setTitle(appTitle);
    
                HorizontalFieldManager hManager = new HorizontalFieldManager( Manager.HORIZONTAL_SCROLL | Manager.HORIZONTAL_SCROLLBAR | Manager.USE_ALL_WIDTH | Manager.TOPMOST) {
    
                    // Override the paint method to draw the background image.
                    public void paint(Graphics graphics) {
                        // Draw the background image and then call paint.
                        graphics.drawBitmap(0, 0, 700, 100, backgroundBitmap, 0, 0);
                        super.paint(graphics);
                    }
                };
                tab1 = new LabelField("Top News", LabelField.FOCUSABLE | LabelField.HIGHLIGHT_FOCUS){
                    protected boolean navigationClick(int status,int time){
                        delete(tabArea);
                        tabArea = displayTab1();
                        add(tabArea);
                        return true;
                    }
                };
                LabelField separator = new LabelField("|", LabelField.NON_FOCUSABLE);
                tab2 = new LabelField("Power", LabelField.FOCUSABLE | LabelField.HIGHLIGHT_FOCUS){
                    protected boolean navigationClick(int status,int time){
                        delete(tabArea);
                        tabArea = displayTab2();
                        add(tabArea);
                        return true;
                    }
                };
                LabelField separator1 = new LabelField("|", LabelField.NON_FOCUSABLE);
                tab3 = new LabelField("Renewable Energy", LabelField.FOCUSABLE | LabelField.HIGHLIGHT_FOCUS){
                    protected boolean navigationClick(int status,int time){
                        delete(tabArea);
                        tabArea = displayTab3();
                        add(tabArea);
                        return true;
                    }
                };
    
                hManager.add(tab1);
                hManager.add(separator);
                hManager.add(tab2);
                hManager.add(separator1);
                hManager.add(tab3);
    
                add(hManager);
                add(new SeparatorField());
    
                // USELESS CODE HAS BEEN REMOVED    
    
                tabArea = displayTab1();
                add(tabArea);
    
            }
    
            public VerticalFieldManager displayTab1() {
                return new News(); // RETURN THE MANAGER DIRECTLY
            }
    
            public VerticalFieldManager displayTab2() {
                return new Power(); // RETURN THE MANAGER DIRECTLY
            }
    
            public VerticalFieldManager displayTab3() {
                return new Energy(); // RETURN THE MANAGER DIRECTLY
            }
        }
     }
    

    For your News class

    public class News extends VerticalFieldManager { // CHANGING THE EXTENSION SUPER CLASS 
        public News() {
            super(VerticalFieldManager.VERTICAL_SCROLL|VerticalFieldManager.VERTICAL_SCROLLBAR);
    
            String xmlUrl = "http://182.71.5.53:9090/solr/core4/select/?q=*";
    
            String[][] urlData = XmlFunctions.getURLFromXml(xmlUrl);
            for (int i = 0; i < urlData.length; i++) {
                final String title = urlData[0][i];
                final String id = urlData[1][i];
                //add(new LinkLabel(title, i));
                add(new RichTextField(title){
                    protected boolean navigationClick(int status,int time){
    
                        String cId = id;
                        String bodyUrl = "http://192.168.1.44:9090/solr/core0/select/?q="+cId+";
                        String[][] bodyData = XmlFunctions.getBodyFromXml(bodyUrl);
                        for(int j=0;j<bodyData.length;j++){
                            String body = bodyData[0][j];
                            add(new RichTextField(body));
                        }
                        return true;
                    }
                });
                add(new SeparatorField());
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm making a simple page using Google Maps API 3. My first. One marker
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
Seemingly simple, but I cannot find anything relevant on the web. What is the
Does anyone know how can I replace this 2 symbol below from the string
this is what i have right now Drawing an RSS feed into the php,
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but

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.