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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T04:18:20+00:00 2026-06-15T04:18:20+00:00

All I want is a list of records each with three string fields in

  • 0

All I want is a list of records each with three string fields in a list view. More records get generated with use of the app and this activity displays the records as a log. Data gets logged to and read from a CSV file on local storage. If you know of a better way to store the data let me know as well.

Here is my custom adapter. While debugging I get the constructor to execute but the override of getView() is never called which explains why i’m not seeing anything but why? More code below:

public class TransRecordAdapter extends ArrayAdapter<String[]> {
    private List<String[]> history;

    public TransRecordAdapter(Context context, int textViewResourceId, List<String[]> history2) {
        super(context, textViewResourceId);
        this.history = history2;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        View v = convertView;
        if (v == null) {
            LayoutInflater vi = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            v = vi.inflate(R.layout.listitem, null);
        }

        String[] rec = history.get(position);
        if (rec != null) {
            TextView input = (TextView) v.findViewById(R.id.history_input);
            TextView trans = (TextView) v.findViewById(R.id.history_trans);
            TextView num = (TextView) v.findViewById(R.id.history_num);

            if (rec[0] != null) {
                input.setText(rec[0]);
            }
            if (rec[1] != null) {
                trans.setText(rec[1]);
            }               
            if (rec[2] != null) {
                num.setText(rec[2]);
            }
        } 
        return v;
    }
}

And the onCreate() for this activity

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_gematria_droid_history);
    ListView history_list = (ListView) findViewById(R.id.history_list);

    try {
        File historyFile = this.getFileStreamPath("gematriadroid-history");
        if(!historyFile.exists()) {
            historyFile.createNewFile(); 
        }
        FileReader mFileReader = new FileReader(historyFile);
        CSVReader csvReader = new CSVReader(mFileReader);
        List<String[]> history = csvReader.readAll();
        csvReader.close();

        if(history.size() != 0) {
            TransRecordAdapter adapter = new TransRecordAdapter(this, R.layout.listitem, history);
            history_list.setAdapter(adapter);
        }
    } catch (IOException e1) {
        e1.printStackTrace();
    } catch (RuntimeException e2) {
        e2.printStackTrace();
    } catch (Exception e3) {
        e3.printStackTrace();
    }

}

and the layout

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@drawable/background"
tools:context=".GematriaDroidHistory" >
<TextView
    android:id="@+id/history_filter"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_margin="10dp"
    android:padding="5dp"
    android:hint="@string/history_filter"/>
<ListView
    android:id="@+id/history_list"
    android:layout_height="match_parent"
    android:layout_width="match_parent"
    android:layout_marginLeft="10dp"
    android:layout_marginRight="10dp"
    android:layout_marginBottom="10dp"
    android:background="#FFFFFF">
</ListView>
</LinearLayout>

and the list item

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_marginTop="5dp"
android:layout_marginLeft="10dp"
android:layout_marginBottom="5dp"
android:layout_marginRight="10dp"
android:background="@drawable/papyrus"
android:padding="5dp">

<TextView
    android:id="@+id/history_input"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentLeft="true"
    android:layout_alignParentTop="true"
    android:text="@string/history_input"
    android:textSize="20sp" />

<TextView
    android:id="@+id/history_trans"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_alignParentLeft="true"
    android:text="@string/history_trans"
    android:textSize="20sp" />

<TextView
    android:id="@+id/history_num"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentRight="true"
    android:layout_centerVertical="true"
    android:textSize="20sp"
    android:text="@string/history_num"/>
</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-15T04:18:21+00:00Added an answer on June 15, 2026 at 4:18 am

    I think the problem is that you don’t tell the base class how many elements your array has.

    It might propose two solutions for you.

    Solution 1) Modify your constructor as below. This way, I think you don’t have to define the “history”, in getView, you can just call “getItem()” to get item at the position.

    public TransRecordAdapter(Context context, int textViewResourceId, List<String[]> history2) {
        super(context, textViewResourceId, history2);
        this.history = history2;
    }
    

    Solution 2) Also overwrite getCount() and getItem().

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

Sidebar

Related Questions

This is a entity and i want to list all the children node for
I want to maintain a list of records, for each one I maintain the
i am trying to build a statics system i want list all pages in
I want list to all the indesign file in my external HD, I tried
I want to list all .xml files in a dir and its subdir. I
I want to list all files in a directory Using PyroCMS. Using the Files
I want to list all files on an FTP server using PHP. According to
I want to list all users with their corropsonding user class. Here are simplified
I want to list all of the applications and versions installed on my mac.
In a Git code repository I want to list all commits that contain a

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.