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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T09:36:47+00:00 2026-05-31T09:36:47+00:00

i am using fragment in my application.there are 5 tabs.in 1 tab i need

  • 0

i am using fragment in my application.there are 5 tabs.in 1 tab i need to inflate a list view on a button click.given below is my code for that tab.

public class TabStoreLocatorFragment extends Fragment implements OnClickListener {

private Button mapSwitcher;
private LinearLayout lastSelectedStoreButton;
private LinearLayout noSelectedStoreSection;
private TextView storeInfoName;
private TextView storeInfoAddress;
private TextView storeInfoCity;
private RelativeLayout phoneLocationButton;
private EditText searchStoreLocation;
private ListView storeList;
private ViewFlipper storeFlipper;
LinearLayout theLayout;
Store store;

@SuppressWarnings("static-access")
public View onCreateView(LayoutInflater inflater, ViewGroup container,
        Bundle savedInstanceState) {
    if (container == null) {
        }

     theLayout = (LinearLayout) inflater.inflate(
            R.layout.tab_store_locator_layout, container, false);

    phoneLocationButton = (RelativeLayout) theLayout.findViewById(R.id.phone_location_button);
    mapSwitcher=(Button)theLayout.findViewById(R.id.switch_state_button);
    lastSelectedStoreButton=(LinearLayout)theLayout.findViewById(R.id.last_selected_store_button);
    noSelectedStoreSection=(LinearLayout)theLayout.findViewById(R.id.no_selected_store);
    storeInfoName=(TextView)theLayout.findViewById(R.id.store_name);
    storeInfoAddress=(TextView)theLayout.findViewById(R.id.store_address);
    storeInfoCity=(TextView)theLayout.findViewById(R.id.store_city);
    searchStoreLocation=(EditText)theLayout.findViewById(R.id.search_store);
    storeFlipper = (ViewFlipper)theLayout.findViewById(R.id.store_flipper);


    store=new Store(); 
    store.setName("store1");
    store.setAddress("california");
    store.setCity("newyork");
    store.setZipCode("23");
    store.setState("california");

    phoneLocationButton.setOnClickListener(this);
    mapSwitcher.setOnClickListener(this);
    lastSelectedStoreButton.setOnClickListener(this);
    return theLayout;

}


@Override
public void onClick(View view) {
    int id = view.getId();
    if (id == R.id.phone_location_button) {

        storeList = (ListView)storeFlipper.inflate(getActivity(),   R.layout.store_list, storeFlipper);
        storeFlipper.addView(storeList);
        StoreAdapter adapter = new StoreAdapter(getActivity(), R.layout.store_list_item);
        storeList.setAdapter(adapter);


    }
    else if(id == R.id.switch_state_button){

    }
    else{


    }


}

     }

i want to inflate storelist to storeFlipper.i tried to do that.but it is not working.given below is the corresponding layout for that tab.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical"
    android:background="@android:color/white" >

    <RelativeLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" >

        <TextView
            android:id="@+id/find_a_store_label"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="10dp"
            android:layout_marginTop="15dp"
            android:layout_alignParentLeft="true"
            android:text="@string/tab_find_a_store_title"
            android:textColor="@android:color/black"
            android:textSize="18sp"
            android:textStyle="bold" />

        <Button android:id="@+id/switch_state_button"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true"
            android:layout_centerVertical="true"
            android:layout_marginRight="10dp"
            android:background="@drawable/switch_selector" />       

    </RelativeLayout>

    <View
        android:layout_width="fill_parent"
        android:layout_height="1dp"
        android:background="#E8E2D3" />

    <View
        android:layout_width="fill_parent"
        android:layout_height="1dp"
        android:background="#C5BFAD" />

    <FrameLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content">

        <LinearLayout android:id="@+id/last_selected_store_button"  android:baselineAligned="false" 
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            style="@android:style/Widget.Button"
            android:orientation="horizontal"
            android:paddingTop="10dp"
            android:paddingBottom="10dp"
            android:paddingRight="5dp"
            android:background="@drawable/last_selected_store_background" >

            <RelativeLayout
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:layout_weight="1" >        

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignParentRight="true"              
                    android:textColor="#8E8672"
                    android:text="@string/last_selected_store_label"
                    android:textSize="12sp" />

            </RelativeLayout>        

            <LinearLayout
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:layout_marginLeft="5dp"            
                android:orientation="vertical" >

                <TextView android:id="@+id/store_name"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:textColor="@android:color/black"
                    android:textSize="12sp" />

                <TextView android:id="@+id/store_address"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:textColor="@android:color/black"
                    android:textSize="12sp" />         

                <TextView android:id="@+id/store_city"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:textColor="@android:color/black"
                    android:textSize="12sp" />          

            </LinearLayout>      

            <RelativeLayout
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_weight="1" >

                <ImageView 
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginBottom="10dp"
                    android:layout_alignParentRight="true"
                    android:layout_centerVertical="true"
                    android:background="@drawable/arrow" />

            </RelativeLayout>

        </LinearLayout>         

        <LinearLayout android:id="@+id/no_selected_store"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:paddingTop="10dp"
            android:paddingBottom="10dp"
            android:paddingRight="5dp"
            android:background="@drawable/last_selected_store_background"  >

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="10dp"                
                android:textColor="#8E8672"
                android:text="@string/no_selected_store_label"
                android:textSize="12sp" />

        </LinearLayout>             

    </FrameLayout>

    <RelativeLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:padding="10dp" >

        <EditText android:id="@+id/search_store"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_marginRight="10dp"
            android:singleLine="true"
            android:textSize="14sp"
            android:hint="@string/search_store_placeholder"
            android:layout_toLeftOf="@+id/phone_location_button"
            android:background="@drawable/search_store_background" />

        <RelativeLayout android:id="@id/phone_location_button"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true"
            android:layout_centerVertical="true"
            android:paddingLeft="15dp"
            android:paddingRight="15dp"
            android:background="@drawable/get_location_background" >

            <ImageView              
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="@drawable/get_location" />

        </RelativeLayout>

    </RelativeLayout>        

    <ViewFlipper android:id="@+id/store_flipper"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"/>       

</LinearLayout>    

can anybody help me to inflate the list to flipper.

  • 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-31T09:36:48+00:00Added an answer on May 31, 2026 at 9:36 am

    it is simple.just put this code.

     storeList = (ListView) inflater.inflate(R.layout.store_list, null);
    

    it is working

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

Sidebar

Related Questions

In my application i am using Sherlock Fragment Pager and i want to create
I push a fragment on the fragment stack using the following code: FragmentManager fragmentManager
I am using the following code fragment in z3 4.0 to convert a formula
I'm using Android-support-v4 I have a PagerAdapter that displays a list fragment in each
I'm building an application using a service and the fragment compatibility pack and am
I'm using the ActionBarSherlock for my application and this is the code I use
i am using fragments in my application.it is for tab feature.in a tab i
When creating an Android application using Loaders, should every activity and fragment have its
I'm creating a tablet optimised application using fragments. I have a thin navigation fragment
I have two textures generated using a fragment shader. I want to be able

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.