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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T21:35:34+00:00 2026-05-23T21:35:34+00:00

I am a new android developer . I have create a quiz application where

  • 0

I am a new android developer . I have create a quiz application where i need to display the questions in list view serially . my all question and options are images. how can i set the images in list view. i want to set only the image in list view not any text . Please help me.

  • 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-23T21:35:35+00:00Added an answer on May 23, 2026 at 9:35 pm

    Create a listview in your main xml file like this:

    <?xml version="1.0" encoding="UTF-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:id="@+id/masterLayout"
     android:orientation="vertical" 
     android:layout_width="wrap_content"
     android:layout_height="wrap_content">
        <ListView
         android:id="@+id/list"
         android:cacheColorHint="#00000000"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"/>
    </LinearLayout>
    

    Then create another xml file called child_layout:

    <?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:id="@+id/image"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"/>
    </RelativeLayout>
    

    Then in your activity class initialize your listview:

    ListView listView1 = (ListView)findViewById(R.id.list);
    

    Create a class that extends baseadapter and modify all the necessary methods the way you need to (create the constructor that takes a list of drawables as an argument and create a global variable that is set to the provided list). Then do the following in your activity class:

    ArrayList<Drawable> images = new ArrayList<Drawable>();
    // add to the list here
    CustomListAdapter adapter = new CustomListAdapter(images);
    listView1.setAdapter(adapter);
    

    Do this in your getView() function in your customlistadapter class:

    public View getView(int position, View convertView, ViewGroup parent)
    {
        Drawable image = images.get(position);
        if (convertView == null)
        {
            LayoutInflater infalInflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            convertView = infalInflater.inflate(R.layout.child_layout, null);
        }
        ImageView imageView = (ImageView)convertView.findViewById(R.id.image);
        imageView.setBackgroundDrawable(image);
    
        return convertView;
    }
    

    ListView item click listener:

    listView1.setOnItemClickListener(new ListView.OnItemClickListener()
    {
        public void onItemClick(AdapterView<?> listView, View itemView, int position, long itemId)
        {
            String message = "example text: " + position;
            Toast.makeText(MyActivity.this, message, Toast.LENGTH_SHORT).show();
        }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am an iphone application developer, all iphones have very similar Operating systems, and
I am absolutely new to the Android platform and have been building an application
hi i am a new android developer. In my app i have created a
New Android developer here; well versed in Java. I'm looking to create a playlist
I am a beginner Android developer. I am trying to create an SMS application.
Extreme Android developer newbie here...well, new to Android development, not development in general. I
The developer documentation has seemed to have failed me here. I can create a
I'm pretty new to Android development, but I have some experience with Java and
I am a bit new to Android. What I need to do is send
I am a beginner android developer and I am trying to have a button

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.