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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T12:40:49+00:00 2026-05-27T12:40:49+00:00

I have a class that extends Activity and inflates another xml layout in the

  • 0

I have a class that extends Activity and inflates another xml layout in the main layout.

Example:

public class PrivateHistory extends Activity{

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

    //Remove title bar
    this.requestWindowFeature(Window.FEATURE_NO_TITLE);
    //Remove notification bar
    this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);

    setContentView(R.layout.main_layout);  

    viewBundleMessage();

    LinearLayout item = (LinearLayout)findViewById(R.id.menu_linear_layout);
    View child = getLayoutInflater().inflate(R.layout.menu_list, null);
    item.addView(child);

    getHistoryInfo();

    }
}

Example (menu_list layout):

<?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"
android:orientation="vertical">

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

</ListView>

And there is a getHistoryInfo method that I’m using to retrieve some history information from the db so I can put every record in a ListItem.

Example:

public void getHistoryInfo(){

//removed historyItem + database information

    ListView lv = (ListView) findViewById(R.id.listViewMenu);
    lv.setAdapter(new ArrayAdapter<String>(this,R.layout.history_list_view, historyItem));

    lv.setOnItemClickListener(new OnItemClickListener() {
        public void onItemClick(AdapterView<?> parent, View view,
            int position, long id) {

            showToast(historyItem.get(position).toString());
        }
    });

}

Example (history_list_view):

<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/noteText"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textColor="#000000"
android:textSize="14dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="5dp"
android:paddingBottom="5dp"
android:background="@drawable/bg_white_grey"
android:gravity="center_vertical"
android:typeface="serif"
android:layout_marginBottom="10dp"/>

So everything here works, but only if you want to add text into every ListItem. I would like to add images to every ListItems, but how? If this class had extended a ListActivity it wouldn’t be that hard, but it extends an Activity. So can anyone help me here?

For anyone that would like to use my app, please go to:
http://www.4shared.com/android/tWfbNqZ6/Free_Wallet.html

  • 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-27T12:40:50+00:00Added an answer on May 27, 2026 at 12:40 pm

    To have customized rows for the list (i.e. anything other than a textview) you should create your own adapter-implementation. Here is another answer (by me) explaining the general principle:
    Two views in each list item (the example is about two textviews rather than an image, but just replace the layout with two textview for a layout with an imageview and change the corresponding lines in the getView() method)

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

Sidebar

Related Questions

I have a class that extends android.app.Dialog, the layout is done in an xml
i have a class that extends another. when i iterate the current object i
If I have a base class such that public abstract class XMLSubscription <T extends
I have a jar that consists of a class that extends Activity and performs
I am having a class that extends View. I have another class that extends
I have a class called FileGeneration that extends Activity In FileGeneration I have a
I have class that extends Activity. That has a Logout menu options. When I
I have a class that extends View. I override the onDraw method and allow
In my windows forms applications I have a class that extends a backgroundworker, let's
I have a MyCanvas class that extends JComponent. On this canvas I have drawn

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.