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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T19:54:50+00:00 2026-06-16T19:54:50+00:00

I try to implement a project where I will load many pictures in a

  • 0

I try to implement a project where I will load many pictures in a listview. I implement this with a lazy instatiation. I also inflate the list with an adapter and with the following way:

 static class ViewHolder {
    ImageView imageView;
    TextView brand;
    TextView text;
    TextView cost;
    TextView saleCost;
}

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


    ViewHolder holder;
    // Set the product.
    Product currentProduct = getItem(position);

    if(convertView ==null){
        Activity activity = (Activity)getContext();
        inflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        convertView = inflater.inflate(R.layout.list_item, null);
        holder = new ViewHolder();

        // Extract the ImageView from the row.
        holder.imageView = (ImageView) convertView.findViewById(R.id.image);

        holder.text = (TextView) convertView.findViewById(R.id.text);
        holder.brand = (TextView) convertView.findViewById(R.id.brand);

        holder.cost = (TextView) convertView.findViewById(R.id.cost);
        holder.saleCost = (TextView) convertView.findViewById(R.id.saleCost);

        convertView.setTag(holder);

    }else {
        holder = (ViewHolder) convertView.getTag();
    } 

    //here I set the values

The list_item:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="10dp" >

<!-- Image Thumbnail -->

<ImageView
    android:id="@+id/image"
    android:layout_width="100dp"
    android:layout_height="100dp" />

<!-- Name, Brand, and Cost -->

<LinearLayout
    android:id="@+id/nameAlign"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:gravity="center_vertical"
    android:orientation="vertical"
    android:paddingLeft="10dip" >

    <TextView
        android:id="@+id/brand"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />

    <TextView
        android:id="@+id/text"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />

    <TextView
        android:id="@+id/cost"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />

    <TextView
        android:id="@+id/saleCost"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />
  </LinearLayout>

</LinearLayout>

And the I take the following errors:

 01-03 17:31:13.055: E/AndroidRuntime(22860): FATAL EXCEPTION: main
 01-03 17:31:13.055: E/AndroidRuntime(22860): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.nn/com.nn.HomeScreen}: android.view.InflateException:    Binary XML file line #22: Error inflating class <unknown>
 01-03 17:31:13.055: E/AndroidRuntime(22860):   at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
 01-03 17:31:13.055: E/AndroidRuntime(22860):   at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
 01-03 17:31:13.055: E/AndroidRuntime(22860):   at android.app.ActivityThread.access$1500(ActivityThread.java:117)
 01-03 17:31:13.055: E/AndroidRuntime(22860):   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
 01-03 17:31:13.055: E/AndroidRuntime(22860):   at android.os.Handler.dispatchMessage(Handler.java:99)
 01-03 17:31:13.055: E/AndroidRuntime(22860):   at android.os.Looper.loop(Looper.java:130)
 01-03 17:31:13.055: E/AndroidRuntime(22860):   at android.app.ActivityThread.main(ActivityThread.java:3683)
 01-03 17:31:13.055: E/AndroidRuntime(22860):   at java.lang.reflect.Method.invokeNative(Native Method)
 01-03 17:31:13.055: E/AndroidRuntime(22860):   at java.lang.reflect.Method.invoke(Method.java:507)
 01-03 17:31:13.055: E/AndroidRuntime(22860):   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
 01-03 17:31:13.055: E/AndroidRuntime(22860):   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
 01-03 17:31:13.055: E/AndroidRuntime(22860):   at dalvik.system.NativeStart.main(Native Method)
 01-03 17:31:13.055: E/AndroidRuntime(22860): Caused by: android.view.InflateException: Binary XML file line #22: Error inflating class <unknown>
 01-03 17:31:13.055: E/AndroidRuntime(22860):   at android.view.LayoutInflater.createView(LayoutInflater.java:518)
 01-03 17:31:13.055: E/AndroidRuntime(22860):   at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
 01-03 17:31:13.055: E/AndroidRuntime(22860):   at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:568)
 01-03 17:31:13.055: E/AndroidRuntime(22860):   at android.view.LayoutInflater.rInflate(LayoutInflater.java:623)
 01-03 17:31:13.055: E/AndroidRuntime(22860):   at android.view.LayoutInflater.rInflate(LayoutInflater.java:626)
 01-03 17:31:13.055: E/AndroidRuntime(22860):   at android.view.LayoutInflater.rInflate(LayoutInflater.java:626)
 01-03 17:31:13.055: E/AndroidRuntime(22860):   at android.view.LayoutInflater.inflate(LayoutInflater.java:408)
 01-03 17:31:13.055: E/AndroidRuntime(22860):   at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
 01-03 17:31:13.055: E/AndroidRuntime(22860):   at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
 01-03 17:31:13.055: E/AndroidRuntime(22860):   at com.actionbarsherlock.internal.ActionBarSherlockCompat.setContentView(ActionBarSherlockCompat.java:857)
 01-03 17:31:13.055: E/AndroidRuntime(22860):   at com.actionbarsherlock.app.SherlockActivity.setContentView(SherlockActivity.java:218)
 01-03 17:31:13.055: E/AndroidRuntime(22860):   at com.nn.HomeScreen.onCreate(HomeScreen.java:205)
 01-03 17:31:13.055: E/AndroidRuntime(22860):   at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
 01-03 17:31:13.055: E/AndroidRuntime(22860):   at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
 01-03 17:31:13.055: E/AndroidRuntime(22860):   ... 11 more
 01-03 17:31:13.055: E/AndroidRuntime(22860): Caused by: java.lang.reflect.InvocationTargetException
 01-03 17:31:13.055: E/AndroidRuntime(22860):   at java.lang.reflect.Constructor.constructNative(Native Method)
 01-03 17:31:13.055: E/AndroidRuntime(22860):   at java.lang.reflect.Constructor.newInstance(Constructor.java:415)
 01-03 17:31:13.055: E/AndroidRuntime(22860):   at android.view.LayoutInflater.createView(LayoutInflater.java:505)
 01-03 17:31:13.055: E/AndroidRuntime(22860):   ... 24 more
 01-03 17:31:13.055: E/AndroidRuntime(22860): Caused by: java.lang.OutOfMemoryError: bitmap size exceeds VM budget
 01-03 17:31:13.055: E/AndroidRuntime(22860):   at android.graphics.Bitmap.nativeCreate(Native Method)
 01-03 17:31:13.055: E/AndroidRuntime(22860):   at android.graphics.Bitmap.createBitmap(Bitmap.java:477)
 01-03 17:31:13.055: E/AndroidRuntime(22860):   at android.graphics.Bitmap.createBitmap(Bitmap.java:444)
 01-03 17:31:13.055: E/AndroidRuntime(22860):   at android.graphics.Bitmap.createScaledBitmap(Bitmap.java:349)
 01-03 17:31:13.055: E/AndroidRuntime(22860):   at android.graphics.BitmapFactory.finishDecode(BitmapFactory.java:498)
 01-03 17:31:13.055: E/AndroidRuntime(22860):   at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:473)
 01-03 17:31:13.055: E/AndroidRuntime(22860):   at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:336)
 01-03 17:31:13.055: E/AndroidRuntime(22860):   at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:697)
 01-03 17:31:13.055: E/AndroidRuntime(22860):   at android.content.res.Resources.loadDrawable(Resources.java:1709)
 01-03 17:31:13.055: E/AndroidRuntime(22860):   at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
 01-03 17:31:13.055: E/AndroidRuntime(22860):   at android.widget.ImageView.<init>(ImageView.java:118)
 01-03 17:31:13.055: E/AndroidRuntime(22860):   at android.widget.ImageView.<init>(ImageView.java:108)
 01-03 17:31:13.055: E/AndroidRuntime(22860):   ... 27 more

Can anyone explain me the log file?because I can’t understand what is the MAIN problem..

  • 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-16T19:54:52+00:00Added an answer on June 16, 2026 at 7:54 pm

    Please try like as follows method. and also provide the details about listitem.xml

    public View getView(final int position, View convertView, ViewGroup parent) {
                System.out.println("***********IngetView************");
                LayoutInflater inflater = (LayoutInflater) context
                        .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    
                //View Listview;
                final ViewHolder viewHolder ;
    
                if (convertView == null) {
                    //viewHolder = new ViewHolder();
                    //Listview = new View(context);
                    viewHolder = new ViewHolder();
                    // get layout from gridlayout.xml
                    convertView = inflater.inflate(R.layout.list_item, null);
    
                } else {
                    //Listview = (View) convertView;
                    viewHolder = (ViewHolder) convertView.getTag();
    
                }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If I try to implement my class on this file I get an error
If I try to implement this simple-as-possible example: Update Content with AJAXRefreshRequest it does
OK, this is impossible, but I will try to explain the situation here. Let's
I am looking to try and implement a project management system for myself that
I'm working on a Surface WPF project where we try to implement the MVVM
I try to implement the animation: when you enter iPhone Gallery, press the image,
I try to implement footer datagrid with allowMultipleSelection properties. But in my case, it
I try to implement a browser-like app. I want to let it can open
I try to implement HierarchicalDataTemplate for the self referencing table in Silverlight 4. It
I try to implement a i2c slave receiver interrupt service routine on a stm32f4.

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.