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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T20:32:52+00:00 2026-06-15T20:32:52+00:00

I have a listview which I want to display custom data like zodiac Sign

  • 0

I have a listview which I want to display custom data like zodiac Sign Image. Zodiac title. Zodiac Content and few buttons. The problem is that data are not getting displayed I debug every line and items are being added properly into arraylist and then into the Adapter but listview is being displayed empty on the screen.

I am using android google api17 jelly beans version

My Main Xml

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/tools"
    android:id="@+id/scrollView1"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    app:context=".AdminPage.Hilariouscope" >

    <TableLayout
        android:id="@+id/tableRow_Main"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" >

        <TableRow
            android:id="@+id/tableRow_tittle"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" >

            <RelativeLayout
                android:id="@+id/Relativelayout_watch"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:layout_weight="1" >

                <Button
                    android:id="@+id/btn_topic_horro_Back"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:onClick="GoToHome"
                    android:text="@string/RegisterBack" />

                <TextView
                    android:id="@+id/txt_title_screen"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignBaseline="@+id/btn_topic_horro_Back"
                    android:layout_alignBottom="@+id/btn_topic_horro_Back"
                    android:layout_centerHorizontal="true"
                    android:text="@string/title_activity_hilariouscope"
                    android:textAppearance="?android:attr/textAppearanceMedium" />

            </RelativeLayout>

        </TableRow>

        <ListView
            android:id="@+id/horror_listview"
            android:layout_width="wrap_content"
            android:layout_height="371dp" >
        </ListView>

    </TableLayout>

</ScrollView>

My ListRow XML

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

<TextView
    android:id="@+id/txt_zodic_Tittle"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentLeft="true"
    android:layout_alignParentTop="true"
    android:text="Large Text"
    android:textAppearance="?android:attr/textAppearanceLarge"
    android:textColor="#ab2130"
    android:textSize="32sp" />

<TextView
    android:id="@+id/txt_zodic_date"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentLeft="true"
    android:layout_below="@+id/txt_zodic_Tittle"
    android:text="Medium Text"
    android:textAppearance="?android:attr/textAppearanceMedium" />

<TableRow
    android:id="@+id/tableRow_content"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentLeft="true"
    android:layout_below="@+id/txt_zodic_date" >

    <TextView
        android:id="@+id/txt_main_content"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_weight=".2"
        android:text="@string/Main_laugh"
        android:textAppearance="?android:attr/textAppearanceMedium"
        android:textSize="22sp"
        android:textStyle="normal" />

    <ImageView
        android:id="@+id/zodic_image"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_weight=".5"
        android:adjustViewBounds="true"
        android:cropToPadding="true"
        android:scaleType="fitCenter"
        android:src="@drawable/lighthouse" />

</TableRow>

<TableRow
    android:id="@+id/tableRow_footer"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_alignParentLeft="true" >

    <RelativeLayout
        android:id="@+id/RelativeLayout03"
        android:layout_width="wrap_content"
        android:layout_height="fill_parent"
        android:background="#bababa" >

        <Button
            android:id="@+id/Btn_share_fun"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Share"
            app:ignore="HardcodedText" />

        <ImageButton
            android:id="@+id/btn_facebook_fun"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerVertical="true"
            android:layout_toLeftOf="@+id/btn_twitter_fun"
            android:src="@drawable/pic2"
            app:ignore="ContentDescription" />

        <ImageButton
            android:id="@+id/btn_twitter_fun"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true"
            android:layout_alignTop="@+id/btn_facebook_fun"
            android:src="@drawable/pic3"
            app:ignore="ContentDescription" />
    </RelativeLayout>
</TableRow>

My custom Class For Zodic

public class Hilariouscope_Items {
private boolean checked;
private int zodicImage;
private String ZodicDate, ZodicTitle, ZodicContent;

public Hilariouscope_Items(String Title, String Date, String Content) {
    this.ZodicTitle = Title;
    // this.zodicImage = ZodicImage;
    this.ZodicDate = Date;
    this.ZodicContent = Content;
}

public void setChecked(boolean checked) {
    this.checked = checked;
}

public boolean isChecked() {
    return checked;
}

public void setTitleName(String name) {
    this.ZodicTitle = name;
}

public void setZodicDate(String date) {
    this.ZodicDate = date;
}

public void setZodicContent(String Content_Text) {
    this.ZodicContent = Content_Text;
}

public String getTitle() {
    return ZodicTitle;
}

public String getZodicDate() {
    return ZodicDate;
}

public String getZodicContent() {
    return ZodicContent;
}

public void toggle() {
    this.checked = !this.checked;
}

public int getZodicImage() {
    return zodicImage;
}

My ZodicAdapter Class

import java.util.List;
import com.example.laysapp.R;
import android.content.Context;
import android.graphics.Color;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;


 public class horrorItemAdapter extends BaseAdapter {

private final List<Hilariouscope_Items> items;

public horrorItemAdapter(final Context context, final int itemResId,
        final List<Hilariouscope_Items> items) {
    this.items = items;
}

@Override
public int getCount() {
    // TODO Auto-generated method stub
    return 0;
}

@Override
public Object getItem(int arg0) {
    // TODO Auto-generated method stub
    return null;
}

@Override
public long getItemId(int position) {
    // TODO Auto-generated method stub
    return 0;
}

@Override
public View getView(int position, View convertView, ViewGroup parent) {
    final Hilariouscope_Items item = this.items.get(position);
    View itemView = null;

    if (convertView == null) {
        LayoutInflater inflater = (LayoutInflater) parent.getContext()
                .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        itemView = inflater.inflate(R.layout.horror_list_row, null);
    } else {
        itemView = convertView;
    }

    // Set the text of the item
    TextView txtName = (TextView) itemView
            .findViewById(R.id.txt_zodic_Tittle);
    txtName.setText(item.getTitle());

    // Set the text of the item
    TextView txtDate = (TextView) itemView
            .findViewById(R.id.txt_zodic_date);
    txtDate.setText(item.getZodicDate());

    // Set the text of the item
    TextView txtContent = (TextView) itemView
            .findViewById(R.id.txt_main_content);
    txtContent.setText(item.getZodicContent());

    // Set the check-icon
    ImageView imgView = (ImageView) itemView.findViewById(R.id.zodic_image);

    imgView.setImageResource(item.getZodicImage());
    /*
     * imgViewChecked.setImageResource(item.isChecked() ? R.drawable.checked
     * : R.drawable.unchecked);
     */
    return itemView;
}

 }

My Main Class

    public class Hilariouscope extends Activity {

private ListView mainListView;
private horrorItemAdapter itemAdapter;
private ArrayAdapter<Hilariouscope_Items> listAdapter;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_hilariouscope);

    ArrayList<Hilariouscope_Items> items = new ArrayList<Hilariouscope_Items>();
    /*
     * items.add(new Hilariouscope_Items("AQUARIUS", R.drawable.hydrangeas,
     * "MAR 21 - APR 19", "sample text Aquarius")); items.add(new
     * Hilariouscope_Items("Aries", R.drawable.jellyfish, "MAR 21 – APR 20",
     * "sample text Aries")); items.add(new Hilariouscope_Items("Taurus",
     * R.drawable.penguins, "APR 21 – MAY 21", "sample text Taurus"));
     * items.add(new Hilariouscope_Items("Gemini", R.drawable.lighthouse,
     * "MAY 22 – JUN 21", "sample text Gemini"));
     */

    items.add(new Hilariouscope_Items("AQUARIUS", "MAR 21 - APR 19",
            "sample text Aquarius"));
    items.add(new Hilariouscope_Items("Aries", "MAR 21 – APR 20",
            "sample text Aries"));
    items.add(new Hilariouscope_Items("Taurus", "APR 21 – MAY 21",
            "sample text Taurus"));
    items.add(new Hilariouscope_Items("Gemini", "MAY 22 – JUN 21",
            "sample text Gemini"));

    itemAdapter = new horrorItemAdapter(getApplicationContext(),
            R.layout.horror_list_row, items);

    mainListView = (ListView) findViewById(R.id.horror_listview);
    // listAdapter = new ArrayAdapter<Hilariouscope_Items>(this,
    // R.layout.horror_list_row, items);
    mainListView.setAdapter(itemAdapter);
    /*
     * View header = (View) getLayoutInflater().inflate(
     * R.layout.horror_list_row, null);
     * 
     * lv.addHeaderView(header);
     */

    mainListView.setTextFilterEnabled(true);
    mainListView.setOnItemClickListener(new OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> adapter, View v, int pos,
                long id) {

            // Toggle the state of the item and refresh the view
            /*
             * Hilariouscope_Items item = (Hilariouscope_Items) mainListView
             * .getItemAtPosition(pos);
             * Toast.makeText(getApplicationContext(),
             * item.getTitle().toString(), Toast.LENGTH_SHORT).show(); //
             * itemAdapter.notifyDataSetChanged();
             */
        }

    });

}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.activity_hilariouscope, menu);
    return true;
}

Waiting for your response

Thanks in advance

  • 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-15T20:32:53+00:00Added an answer on June 15, 2026 at 8:32 pm

    In your ZodicAdapter Class
    getCount() you are returning as 0.

    make that as

    @Override
    public int getCount() {
        // TODO Auto-generated method stub
        return items.size();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a ListView which uses a custom adapter to display rows of data.
I have a custom adapter for my ListView which has multiple TextViews. I want
I have an array of strings which I want to display using a ListView.
I have a ListView which displays a list of string values. I want to
I have ListView which is saving all data to database. For adding i have
I have a ListView which is using a GridView to display a DataTable and
I have a ListView which contains custom rows. This custom row has following UI
I have a Custom ListView which has an ImageView and a TextView. and i
I have a listview which one of the is binding my user's photo image.
I have a listView which loads data from SQLite database and right now I

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.