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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T03:14:08+00:00 2026-06-09T03:14:08+00:00

i am not able to display the detailed form information specific to the title

  • 0

i am not able to display the detailed form information specific to the title user clicked on form1 Screen,when i click on any itemlist on form1 screen,i am able to display the detail of first item only(in my code int index=myNewsList.getSelectedIndex() returns always 0 as value)

Here my Detailed Code for Rss App:

                     //method called by the parsing thread
                      public void addNews(News newsItem) { 
                       newsVector.addElement(newsItem);//initialsed list with vector
                       myNewsList = new List(newsVector);                                    
                       myNewsList.setListCellRenderer(new NewsListCellRenderer());        
                       form1.addComponent(myNewsList);                  
                       form1.show();
                       myNewsList.addActionListener(new ActionListener() {
                         public void actionPerformed(ActionEvent ae) {
                        int selectedIndex = myNewsList.getSelectedIndex();
                        if(selectedIndex != -1){
                             newsItem1 = (News)news.elementAt(selectedIndex);
                             Label l=new Label();
                             l.setText(newsItem1.getPubDate());
                             Form detailedForm=new Form();
                             detailedForm.addCommand(m_backCommand);
                             detailedForm.addCommandListener(this);
                             detailedForm.addComponent(l);
                             detailedForm.show();                   
                       }                   

                       }
                    });                  
                    }

     Can you 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-06-09T03:14:09+00:00Added an answer on June 9, 2026 at 3:14 am

    Add action listener to the list. It is called only if you click any item of the list. In that action listener, get the selected item and cast it to the News class object because you added News class objects in the list. From that object, get the unique property like news id. Pass it to another screen with the current form object (form1).

    myNewsList = new List(news);
    myNewsList.setListCellRenderer(new NewsListRenderer());
    
    myNewsList.addActionListener(new ActionListener() {
    
         public void actionPerformed(ActionEvent ae) {
               News allNewsClassObjs = (News) myNewsList.getSelectedItem();
               int newsid = allNewsClassObjs.getNewsId(); 
               displayCompleteNewsScreen(form1,newsid);
         }
    });
    form1.addComponent(myNewsList); 
    form1.addCommand(cmdDetails);
    form1.setScrollable(true);
    form1.setTransitionInAnimator(Transition3D.createRotation(250, true));
    form1.show();
    

    With the news id, you can display the related data in another screen. Add back command to it. In the back command, just show the form1 object.

    public void displayCompleteNewsScreen(Form form1,int newsid){
    
    // Get the related data and add it to another form object(form2).
    
    form2.addCommand("Back");
    form2.addCommandListener(new ActionListener() {
    
             public void actionPerformed(ActionEvent ae) {
                   form1.show();
             }
        });
    form2.show();
    }
    

    Instead of using

    int selectedIndex = myNewsList.getSelectedIndex();
    if(selectedIndex != -1){
    newsItem1 = (News)news.elementAt(selectedIndex);
    }
    

    Use the below code

    newsItem1 = (News)myNewsList.getSelectedItem();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am not able to display image using this code. Could any one help
I am not able to display the zbarsdk reader in full screen on iPad.
I have no code to really display here, since I have not been able
Hi I am not able to capture the screen shot using selenium webdriver .
I am not able to display the rectangles after a certain delay in code.
I am not able to display html page kept in sdcard on webview. I
I am not able to display the Value in a lable in footer. Below
im not able to display the validation error, even though it is validating the
Actually i want to display these 2 tables horizontally on my GUI.But not able
I have a list of names in viewdata, but am not able to display

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.