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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T08:47:28+00:00 2026-05-26T08:47:28+00:00

In my application i have a String array that i store my strings in

  • 0

In my application i have a String array that i store my strings in it.

private static String[] tokens = new String[1024];

Format of my row which i create it in xml file is:

<TableLayout 
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:shrinkColumns="*"  
android:stretchColumns="*" >
    <TableRow 
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:gravity="center_horizontal"
    android:layout_marginTop="10dip"
    android:layout_marginBottom="10dip" >
        <TextView
            android:id="@+id/outstanding_contractdate"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textColor="#ffffff"
            android:textSize="15sp" />
        <TextView
            android:id="@+id/outstanding_contractno"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textColor="#ffffff"
            android:textSize="15sp" />
        <TextView
            android:id="@+id/outstanding_contractamount"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true"
            android:textColor="#ffffff"
            android:textSize="15sp" />
    </TableRow>

</TableLayout>

In onCreate(), i defined:

lvOutstanding = (ListView) findViewById(R.id.outstanding_list);
        myListAdapter = new MyListAdapter();
        lvOutstanding.setAdapter(myListAdapter);

and this is my adapter:

class MyListAdapter extends ArrayAdapter<String>{
        MyListAdapter(){
            super(MSOutStanding.this, R.layout.list_outstanding, tokens);
        }

        public View getView(int position, View convertView, ViewGroup parent){
            View row = convertView;

            if(row == null){
                LayoutInflater inflater = getLayoutInflater();
                row = inflater.inflate(R.layout.list_outstanding, parent, false);
            }

            TextView tvContDate = (TextView) row.findViewById(R.id.outstanding_contractdate);
            TextView tvContNo = (TextView) row.findViewById(R.id.outstanding_contractno);   
            TextView tvContAmount = (TextView) row.findViewById(R.id.outstanding_contractamount);

            if(position == 0)
                count = 0;
            else
                count = 3;

            if(arrayLoop>0){
                tvContDate.setText(tokens[position * count]);
                Log.i("Count:", tokens[position * count]);

                tvContNo.setText(tokens[position * count + 1]);
                Log.i("Count:", tokens[position * count +1]);

                tvContAmount.setText(tokens[position * count + 2]);
                Log.i("Count:", tokens[position * count+2]);

                arrayLoop -= 3;
                Log.i("Count:", String.valueOf(arrayLoop));
            }

            return(row);
        }
    }

as you saw, in each row i have three textView and i want to show each three items of array in each row. “arrayLoop” is and int variable that saved number of items in the “tokens[]” array.

Now, when i run the application, emulator shows 1024 rows without any data. where is my mistakes?
when i check the logcat (Thanks google for new beautiful design of logCat!), there is no problem and first 12 items in array has parameters and there for (12/3=4), i should see 4 rows with information. However, i have 1024 rows without information 🙁

enter image description here

  • 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-26T08:47:28+00:00Added an answer on May 26, 2026 at 8:47 am

    Your arrayLoop variable must be 0 or less. I think that your problem is where you’ve put arrayLoop in the if statement you meant to put count. But I can’t see where you’ve defined arrayLoop or what you’ve assigned to it.

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

Sidebar

Related Questions

In my application I have a string parameter called shop that is required in
I'm using the Validation Application Block from Microsoft. I have a string property which
I have an application which takes a string value of the form %programfiles%\directory\tool.exe from
I have a Java application that's very String-heavy - it takes a feed of
I have a rails application which is still showing the cachebusting numeric string at
I have a C# application that includes the following code: string file = relativePath.txt;
I have a string representing a path. Because this application is used on Windows,
I am programming in .NET I have an application setting of type string. On
I have this object: class a { public string Application; public DateTime From, To;
I have been tasked with securing the connection string in an classic ASP application

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.