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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T04:34:10+00:00 2026-05-30T04:34:10+00:00

I’m trying to do an app with listView, which is need to be filled

  • 0

I’m trying to do an app with listView, which is need to be filled from another class… I’m basicly follow this site: http://www.softwarepassion.com/android-series-custom-listview-items-and-adapters/ but somehow my adapter doesn’t work right… And do not fill my listView…

I create a new object from my main class like: fillLeftMenu lmenu = new fillLeftMenu(menu);

I used this line for having started the activity, if it’s not wrong:

startActivity(new Intent("com.yahya.training.FILLLEFTMENU"));

On my AndroidManifest.xml, i added this following lines:

   <activity
        android:name=".fillLeftMenu"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="com.yahya.training.FILLLEFTMENU" />

            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>

And the fillLeftMenu class is:

public class fillLeftMenu extends ListActivity {

private ProgressDialog myProgressDialog = null; 
private View menu;
ImageView findLocation;
Spinner cityList;
ListView leftList;
String [] textIndex;
Drawable [] imageIndex;
ArrayList<LeftListItems> Left;
listAdapter lAdapter;

public fillLeftMenu(View Lmenu) {
    this.menu = Lmenu;
}

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    findLocation = (ImageView) menu.findViewById(R.id.image_findLocation);
    leftList = (ListView) menu.findViewById(R.id.list);

    // add items to listView
    Left = new ArrayList<LeftListItems>();
    textIndex = new String[] {"Bugünün Fırsatları", "Son Dakika Bonusları", "Kadın", "Aile", "Çocuk", "Alışveriş", "Şehirden Kaçış", "Kışa Özel"};
    imageIndex = new Drawable[] {leftList.getResources().getDrawable(R.drawable.kucukicon_01),leftList.getResources().getDrawable(R.drawable.kucukicon_02),leftList.getResources().getDrawable(R.drawable.kucukicon_03),leftList.getResources().getDrawable(R.drawable.kucukicon_04),leftList.getResources().getDrawable(R.drawable.kucukicon_05),leftList.getResources().getDrawable(R.drawable.kucukicon_06),leftList.getResources().getDrawable(R.drawable.kucukicon_07),leftList.getResources().getDrawable(R.drawable.kucukicon_08)};

    lAdapter = new listAdapter(menu.getContext(), R.layout.list_item, Left);
    leftList.setAdapter(lAdapter);

    Runnable viewOrders = new Runnable(){
        public void run() {
            getIndex();
        }
    };

    Thread thread =  new Thread(null, viewOrders, "MagentoBackground");
    thread.start();
    myProgressDialog = ProgressDialog.show(fillLeftMenu.this,"Please wait...", "Retrieving data ...", true);

    leftList.setOnItemClickListener(new OnItemClickListener() {

        public void onItemClick(AdapterView<?> parent, View view,
                int position, long id) {
        }

    });

}

private Runnable returnRes = new Runnable() {
    public void run() {
        if(Left != null && Left.size() > 0){
            lAdapter.notifyDataSetChanged();
            for(int i=0;i<Left.size();i++)
            lAdapter.add(Left.get(i));
        }
        myProgressDialog.dismiss();
        lAdapter.notifyDataSetChanged();
    }
};

private void getIndex() {
    try{
        LeftListItems item = new LeftListItems();
        for(int i=0; i<textIndex.length; i++) {
            item.setText(textIndex[i]);
            item.setImage(imageIndex[i]);
            Left.add(item);
        }
    }
    catch (Exception e) {
        Log.e("BACKGROUND_PROC", e.getMessage());
    }
    runOnUiThread(returnRes);       
}

private class listAdapter extends ArrayAdapter<LeftListItems> {

    private ArrayList<LeftListItems> items;
    private Context ctx;

    public listAdapter(Context ctx, int textViewResourceId, ArrayList<LeftListItems> items) {
        super(ctx, textViewResourceId, items);
        this.ctx = ctx;
        this.items = items;
    }


    @Override
    public View getView(int position, View convertView, ViewGroup parent) {

        View v = convertView;
        if (v == null) {
            // LayoutInflater inflater = LayoutInflater.from(ctx);
            // v = inflater.inflate(R.layout.list_item, null);
            LayoutInflater vi = (LayoutInflater) ctx.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            v = vi.inflate(R.layout.list_item, null);
        }

        LeftListItems index = items.get(position);
        if(index != null) {
            TextView text = (TextView) v.findViewById(R.id.text);
            ImageView img = (ImageView) v.findViewById(R.id.icon);
            if(text != null)
                text.setText(index.getText());
            if(img != null)
                img.setBackgroundDrawable(index.getImage());
        }

        return v;
    }

}   

}
  • 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-30T04:34:11+00:00Added an answer on May 30, 2026 at 4:34 am

    I think you are getting stuck in the loop in returnRes.

    for(int i=0;i<Left.size();i++)
        lAdapter.add(Left.get(i));
    

    The Left variable is the data set in lAdapter and it has already been updated in the getIndex method. You don’t need the loop here at all.

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

Sidebar

Related Questions

I am trying to understand how to use SyndicationItem to display feed which is
For some reason, after submitting a string like this Jack’s Spindle from a text
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a text area in my form which accepts all possible characters from
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
Does anyone know how can I replace this 2 symbol below from the string
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I used javascript for loading a picture on my website depending on which small

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.