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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T17:43:10+00:00 2026-06-07T17:43:10+00:00

What i’m trying to do is add create an application that locates some local

  • 0

What i’m trying to do is add create an application that locates some local business. So the activity I’m doing displays the business information. Some business have severals stores located on the city, and some others only have one. So here is my problem: In the View I have Scroll View with all the elements, and a linear layout inside the scrollview. If the business has more then one store, i will add each store information in a new text view and add the text view to the layout (this is done all by code). But at the moment to display the layout, it only displays me one store, instead of showing me 3 or 4. What I’m I doing wrong? Here is the method setupViews(), which is the one in chanrge of the displaying:

private void setupViews() throws SQLException {
        ImageView iv = (ImageView) findViewById(R.id.negocio_logo);
        try {
            iv.setImageBitmap(BitmapFactory.decodeByteArray(toShow.getImgSrc(),
                    0, toShow.getImgSrc().length));
        } catch (NullPointerException npe) {
            iv.setBackgroundColor(Color.WHITE);
        }
        TextView nombreEmpresa = (TextView) findViewById(R.id.nombre_empresa);
        nombreEmpresa.setText(toShow.getNombre());
        TextView descripcionEmpresa = (TextView) findViewById(R.id.descripcion_empresa);
        descripcionEmpresa.setText(toShow.getDescripcion());
        TextView direccionEmpresa = (TextView) findViewById(R.id.direccion_empresa);
        direccionEmpresa.setText(toShow.getDireccion());

        LinearLayout rl = (LinearLayout) findViewById(R.id.linear_layout_si);
        TextView suc = (TextView) findViewById(R.id.sucursales_empresa);
        sucursalDAO sDAO = new sucursalDAO();
        boolean tieneSucursales = sDAO.hasSucursales(toShow.getId());
        if (tieneSucursales == false) {
            suc.setVisibility(View.GONE);
            // sucs.setVisibility(View.GONE);

        } else {
            suc.setVisibility(View.VISIBLE);

            ArrayList<String> sucursales = sDAO.getStringSucursales(toShow
                    .getId());
            ArrayList<TextView> tvs = new ArrayList<TextView>();
            for (int i = 0; i < sucursales.size(); i++) {
                TextView tv = new TextView(this);
                tv.setText(sucursales.get(i));
                tv.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,
                        LayoutParams.WRAP_CONTENT));
                tvs.add(tv);
            }
            for (int i = 0; i < tvs.size(); i++) {
                rl.addView(tvs.get(i), i);


            }

        }

    }

And here is the XML of my view:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/RL"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/White"
    android:orientation="vertical" >

    <ScrollView
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/widgetscroll"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" >

        <RelativeLayout
            xmlns:android="http://schemas.android.com/apk/res/android"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@color/White"
            android:orientation="vertical" >

            <ImageView
                android:id="@+id/negocio_logo"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerHorizontal="true"
                android:contentDescription="@string/logo_negocio" />

            <TextView
                android:id="@+id/datos_empresa"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_below="@id/negocio_logo"
                android:background="@drawable/barra"
                android:text="@string/datos_empresa"
                android:textColor="@color/White" />

            <TextView
                android:id="@+id/nombre_empresa"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_below="@id/datos_empresa"
                android:text="@string/testing" />

            <TextView
                android:id="@+id/descripcion_empresa"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_below="@id/nombre_empresa"
                android:text="@string/testing" />

            <TextView
                android:id="@+id/direccion_empresa"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_below="@id/descripcion_empresa"
                android:text="@string/testing" />

            <TextView
                android:id="@+id/sucursales_empresa"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_below="@id/direccion_empresa"
                android:background="@drawable/barra"
                android:text="@string/sucursales"
                android:visibility="gone" />

            <LinearLayout
                android:id="@+id/linear_layout_si"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_below="@id/sucursales_empresa" >
            </LinearLayout>

            <TextView
                android:id="@+id/contacto_empresa"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_below="@id/linear_layout_si"
                android:text="@string/testing" />

        </RelativeLayout>
    </ScrollView>

</RelativeLayout>
  • 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-07T17:43:12+00:00Added an answer on June 7, 2026 at 5:43 pm

    I think you forgot to set orientation on LinearLayout and it’s showing horitzontal

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

Sidebar

Related Questions

I'm trying to create an if statement in PHP that prevents a single post
Basically, what I'm trying to create is a page of div tags, each has
I have just tried to save a simple *.rtf file with some websites and
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am doing a simple coin flipping experiment for class that involves flipping a
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I am trying to loop through a bunch of documents I have to put
I have some data like this: 1 2 3 4 5 9 2 6
I have a view passing on information from a database: def serve_article(request, id): served_article

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.