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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T08:03:32+00:00 2026-06-02T08:03:32+00:00

Trying to get this working… it loads up fine, even tells the application that

  • 0

Trying to get this working… it loads up fine, even tells the application that it completed getting all the data. It does not populate the listview though.

The data response inside mArrayList.toString(): [A, B, C, D]

public class MainActivity extends ActionBarActivity {
private static final String DEBUG_TAG = "MainActivity";
private boolean mAlternateTitle = false;
ListView lv;
private ArrayList<Show> mArrayList;
ShowsAdapter adapter;
AlertDialog mAlertDialog;

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    mArrayList = new ArrayList<Show>();
    lv = (ListView) findViewById(R.id.list);
    adapter = new ShowsAdapter(MainActivity.this, android.R.layout.simple_list_item_1, mArrayList);

    ShowsList show_list = new ShowsList();
    show_list.execute();

    lv.setAdapter(adapter);
    lv.setOnItemClickListener(new ListClickListener());
}

private class ShowsList extends AsyncTask<Void, Void, List<Show>> {
    @Override
    protected void onPreExecute() {
        mAlertDialog = new AlertDialog.Builder(MainActivity.this).setIcon(R.drawable.ic_action_refresh).setTitle(R.string.fetching_new).show();
    }

    @Override
    protected List<Show> doInBackground(Void... voids) {
        final String DEBUG_TAG = "MainActivity$ShowList$doInBackground";
        try {
            for (Show show : Show.getShows()) {
                Log.d(DEBUG_TAG, show.toString());
                mArrayList.add(show);
            };
            return mArrayList;
        } catch (Exception e) {
            new AlertDialog.Builder(MainActivity.this.getApplicationContext()).setIcon(android.R.drawable.ic_dialog_alert).setTitle(R.string.server_down_title).setMessage(R.string.server_down_message).setPositiveButton(R.string.app_quit, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialogInterface, int i) {
                    MainActivity.this.finish();
                }
            }).show();
            return null;
        }
    }

    @Override
    protected void onPostExecute(final List<Show> show_list) {
        if (mAlertDialog.isShowing()) {
            mAlertDialog.dismiss();
        }
        adapter.notifyDataSetChanged();
    }
}

private class ListClickListener implements AdapterView.OnItemClickListener {
    public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
        Show show = mArrayList.get(i);
        Toast.makeText(MainActivity.this, "Clicked on a list item: " + show.title, Toast.LENGTH_LONG).show();
    }
}

private class ShowsAdapter extends ArrayAdapter<Show> {
    final String DEBUG_TAG = "MainActivity$ShowsAdapter";
    public ShowsAdapter(Context context, int textViewResourceId, List<Show> shows) {
        super(context, textViewResourceId, shows);
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        Show show = this.getItem(position);

        if (convertView == null) {
            convertView = getLayoutInflater().inflate(R.layout.list_row_show, parent, false);
        }
        ((TextView) convertView.findViewById(R.id.show_title)).setText(show.title);
        //Log.d(DEBUG_TAG, (String)((TextView) convertView.findViewById(R.id.show_title)).getText());
        //((TextView) convertView.findViewById(R.id.episode_number)).setText(episode.getGrayLine());
        return convertView;
    }
}

Just in case it could be an issue with the layout [main.xml]:

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

    <ListView
        android:id="@+id/list"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent">
    </ListView>

</FrameLayout>

list_show_row.xml:

<?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">

    <TextView
            android:textSize="17.0dip"
            android:textStyle="bold"
            android:textColor="#ff000000"
            android:gravity="center_vertical"
            android:id="@+id/show_title"
            android:layout_width="fill_parent"
            android:layout_height="0.0dip"
            android:text="Show Title"
            android:layout_weight="1.0"
            />

    <TextView
            android:textStyle="italic" android:textColor="#ff666666"
            android:id="@+id/episode_number"
            android:layout_width="fill_parent" android:layout_height="0.0dip" android:text="Episode Number" android:layout_weight="1.0" />

</LinearLayout>
  • 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-02T08:03:35+00:00Added an answer on June 2, 2026 at 8:03 am

    Don’t set fill_parent on the layout_height of the root element of list_row_show.xml layout.

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

Sidebar

Related Questions

I've been trying to get this working correctly all day, its nearly complete just
Getting super frustrated trying to get this working. Basically this is for a site
Im trying to get this working but for some reason it's just not right.
I'm trying to get this working and the query executes but nothing comes back.
I have a trouble trying to get this working. I have an Item model,
Trying to get this example working from http://www.munna.shatkotha.com/blog/post/2008/10/26/Light-box-effect-with-WPF.aspx However, I can't seem to get
I've been trying to get this Sudoku game working, and I am still failing
I'm trying to get this accurate timer working on VS2008, on Windows XP (and
I have tried and failed to get this working. Basically I am trying to
i am new in programming under linux and trying to get working this code:

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.