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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T20:28:06+00:00 2026-05-30T20:28:06+00:00

I’m still very new to application development, so this is probably a very stupid

  • 0

I’m still very new to application development, so this is probably a very stupid question but I can’t seem to find the right answer (or at least one that I can understand with my very limited knowledge of java).

I’m using a custom ArrayAdapter called ListRow. It works fine with a regular Activity, but not with the ListActivity that I need it to be in for my app to work.

Below is a sample of the code that I’m using. Any help would be greatly appreciated and you’d be helping a ton!

 ListView mListview;

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
        setListAdapter(new ListRow(this, THEME_NAMES, THEME_ICONS));
    getListView().setTextFilterEnabled(true);
}

public class ListRow extends BaseAdapter {
    private Context mContext;
    private String[] mThemeNames = THEME_NAMES;
    private int[] mThemeIcons = THEME_ICONS;


    public ListRow(Context c, String[] t, int[] i) {
        mContext = c;
        mThemeNames = t;
        mThemeIcons = i;
        mListview=(ListView)findViewById(R.id.list);
    }

    @Override
    public int getCount() {
        return mThemeNames.length;
    }

    @Override
    public Object getItem(int arg0) {
        return null;
    }

    @Override
    public long getItemId(int arg0) {
        return 0;
    }

    @Override
    public View getView(int position, View converView, ViewGroup parent) {
        View List;
        if(converView==null){
            List=new View(mContext);
            LayoutInflater mLayoutinflater=getLayoutInflater();
            List=mLayoutinflater.inflate(R.layout.list_view, parent, false);
        } else {
            List = (View)converView;
        }
        ImageView imageView = (ImageView)List.findViewById(R.id.image);
        TextView textView = (TextView)List.findViewById(R.id.text);
        imageView.setImageResource(mThemeIcons[position]);
        textView.setText(mThemeNames[position]);       
        return List;
    }
}

And here’s the layout I’ve defined for each list item

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" >
    <ImageView 
    android:layout_width="wrap_content"
        android:layout_height="wrap_content" 
    android:scaleType="center"
    android:id="@+id/image" 
    android:layout_alignParentLeft="true"
    android:contentDescription="@string/preview" />
    <TextView 
        android:id="@+id/text" 
        android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_toRightOf="@id/image" />
</RelativeLayout>

If you can, please use small words with me lol, java has turned out to be hard to understand for me, and also try to explain as much as you can. Thanks in advance!

FIGURED IT OUT!
So I just put you all through a bit of hell. The layout that contains my list items is called list_item, not list_view. However I have learned a lot here so THANK YOU ALL VERY MUCH! I wish there were a way I could help you guys out…

Moral of this question? CHECK YOUR LAYOUT NAMES!!

  • 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-30T20:28:07+00:00Added an answer on May 30, 2026 at 8:28 pm

    You need to set The Adapter in this way

    setListAdapter(new ListRow(this, your_theme_names_array, your_theme_icon_array));
    

    You dont need to use ArrayAdapter for this, that is just for Creating a Adapter for an array of String

    EDITED

    The Layout XML does not have the problem i think.

    Check the List given below one by one

    Check List

    • Check Whether R.layout.list_view point to the layout you given in the Question.
    • Try this for setting adapter setListAdapter(new ListRow(this, String[] { }, int[] { })); it will show you blank screen (If you get the Blank Screen that means either THEME_NAMES or THEME_ICONS is null or their values is null)
    • Remove the Line imageView.setImageResource(mThemeIcons[position]); and
      textView.setText(mThemeNames[position]); this will also give u blank screen (If you get blank screen then R.layout.list_view does not contain R.id.image or R.id.text.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to using the Perl treebuilder module for HTML parsing and can't figure
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
Seemingly simple, but I cannot find anything relevant on the web. What is the
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
Does anyone know how can I replace this 2 symbol below from the string
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a jquery bug and I've been looking for hours now, I can't

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.