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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T04:49:27+00:00 2026-06-09T04:49:27+00:00

I have an app with 2 tabs. Each tab has it’s respective fragment. On

  • 0

I have an app with 2 tabs. Each tab has it’s respective fragment. On one of the tabs I would need to place a listview in order to receive data from stored arrays and place them as a list.

This is my code till now:

public class Frag3 extends Fragment{


    ListView lv1;
    ProgressDialog ShowProgress;
    public ArrayList<Post> PostList = new ArrayList<Post>();
    TextView tv1;
    Button button1;

   @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState) {

        if (container == null) {
          return null;
       }
                View view = inflater.inflate(R.layout.tab3, container, false);
                //View tv = view.findViewById(R.id.textView1);

                View listView = view.findViewById(R.id.listView1);

               String[] values = new String[] { "Android", "iPhone", "WindowsMobile",
                    "Blackberry", "WebOS", "Ubuntu", "Windows7", "Max OS X",
               "Linux", "OS/2" };

               ArrayAdapter<String> files = new ArrayAdapter<String>(getActivity(), 
                        android.R.layout.simple_list_item_1, 
                        values);

                lv1.setAdapter(files);

        return view;
    }

}

I’ve tried various options from different web references however none of them seemed to work. Can someone kindly guide me towards a way forward as I’m lost right now and can’t seem to understand the next steps.

  • 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-09T04:49:28+00:00Added an answer on June 9, 2026 at 4:49 am

    The biggest issue is mis-matched variable names. You call out lv1 as a class member and set a list adatper against that, but you use listView to find the view. One of those needs to change.

    The following change ought to help out:

    lv1 = (ListView) view.findViewById(R.id.listView1);    
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an app that has 2 tabs. Each tab loads an xml file
My iPhone app is a Tab Bar Application, which has 5 tabs. In each
I have an app with a tab bar. Each tab has its own view
I have a UITabBarController that has 3 tabs. Each tab contains a UITableViewController. When
I have an app that uses a tab bar controller. It has five tabs.
I have an iPhone app with a UITabBar, and each tab has a unique
I have two tabs on my app that handle different flows. For each tab
My Android app has 4 Tabs. On each Tab i am showing 3 -
I have created an applications that has (X) number of tabs each tab is
My iPhone app has a tab bar controller and on each tab (4 tabs)

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.