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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T01:51:27+00:00 2026-05-26T01:51:27+00:00

I written a simple application that loads a number of wallpapers(20) total from scrollview

  • 0

I written a simple application that loads a number of wallpapers(20) total from scrollview and allows the user to set them as his/her background. It installs and works fine on my device, but users have been reporting “Force Close” errors right after installing, which doesnt allow them to open the app at all! The only reported error I’ve gotten is this OutOfMemory error but it’s quite cryptic and I’m not sure what is wrong! Any guidance would be appreciated, thanks!

    java.lang.RuntimeException: Unable to start activity    
          ComponentInfo{com.jbsoft.BobMarleyExperience/com.jbsoft.BobMarleyExperience.BobMarleyExperi          enceActivity}: android.view.InflateException: Binary XML file line #27: Error inflating class <unknown>
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1659)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1675)
at android.app.ActivityThread.access$1500(ActivityThread.java:121)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:943)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:3701)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:862)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:620)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.view.InflateException: Binary XML file line #27: Error inflating class <unknown>
at android.view.LayoutInflater.createView(LayoutInflater.java:518)
at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:568)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:623)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:626)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:626)
at android.view.LayoutInflater.inflate(LayoutInflater.java:408)
at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:207)
at android.app.Activity.setContentView(Activity.java:1657)
at com.jbsoft.BobMarleyExperience.BobMarleyExperienceActivity.onCreate(BobMarleyExperienceActivity.java:33)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1623)
... 11 more
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:415)
at android.view.LayoutInflater.createView(LayoutInflater.java:505)
... 24 more
Caused by: java.lang.OutOfMemoryError: bitmap size exceeds VM budget
at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:460)
at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:336)
at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:715)
at android.content.res.Resources.loadDrawable(Resources.java:1713)
at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
at android.widget.ImageView.<init>(ImageView.java:122)
at android.widget.ImageView.<init>(ImageView.java:112)
... 27 more

My onCreate() method

//Instance vars 
    int toPhone;
    ImageView Display;
    Button SetWallPaper;
    AdView adview;
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        //Inflate the adview
        adview = (AdView)this.findViewById(R.id.adView);

        //Create new AdRequest object
        AdRequest adRequest = new AdRequest();

        //Request Ad to be displayed
        adview.loadAd(adRequest);

        //Display instructions once the activity starts
        Toast toast = Toast
                .makeText(
                        getApplicationContext(),
                        "Scroll through the images below to load the wallpaper, then touch the button to set it!",
                        Toast.LENGTH_LONG);
        toast.show();
        //Defining our objects
        Display = (ImageView) findViewById(R.id.IVmain);
        ImageView image1 = (ImageView) findViewById(R.id.IVone);
        ImageView image3 = (ImageView) findViewById(R.id.IVthree);
        ImageView image4 = (ImageView) findViewById(R.id.IVfour);
        ImageView image5 = (ImageView) findViewById(R.id.IVfive);
        ImageView image6 = (ImageView) findViewById(R.id.IVsix);
        ImageView image7 = (ImageView) findViewById(R.id.IVseven);
        ImageView image8 = (ImageView) findViewById(R.id.IVeight);
        ImageView image9 = (ImageView) findViewById(R.id.IVnine);
        ImageView image10 = (ImageView) findViewById(R.id.IVten);
        ImageView image11 = (ImageView) findViewById(R.id.IVeleven);
        ImageView image12 = (ImageView) findViewById(R.id.IVtwelve);
        ImageView image13 = (ImageView) findViewById(R.id.IVthirteen);
        ImageView image14 = (ImageView) findViewById(R.id.IVfourteen);
        ImageView image15 = (ImageView) findViewById(R.id.IVfifteen);
        ImageView image16 = (ImageView) findViewById(R.id.IVsixteen);
        ImageView image17 = (ImageView) findViewById(R.id.IVseventeen);
        ImageView image18 = (ImageView) findViewById(R.id.IVeighteen);
        ImageView image19 = (ImageView) findViewById(R.id.IVnineteen);
        ImageView image20 = (ImageView) findViewById(R.id.IVtwenty);

        //Define Button object and set a listener for it
        SetWallPaper = (Button) findViewById(R.id.buttonsetwallpaper);
        SetWallPaper.setOnClickListener(this);

        //Set listeners for all the images
        image1.setOnClickListener(this);
        image3.setOnClickListener(this);
        Display.setOnClickListener(this);
        image4.setOnClickListener(this);
        image5.setOnClickListener(this);
        image6.setOnClickListener(this);
        image7.setOnClickListener(this);
        image8.setOnClickListener(this);
        image9.setOnClickListener(this);
        image10.setOnClickListener(this);
        image11.setOnClickListener(this);
        image12.setOnClickListener(this);
        image13.setOnClickListener(this);
        image14.setOnClickListener(this);
        image15.setOnClickListener(this);
        image16.setOnClickListener(this);
        image17.setOnClickListener(this);
        image18.setOnClickListener(this);
        image19.setOnClickListener(this);
        image20.setOnClickListener(this);

    }    

My main layout .xml

    <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:id="@+id/mainlayout"
    android:background="#808000"


    >



 <ImageView android:src="@drawable/bob2"  android:layout_weight="12" android:id="@+id/IVmain" android:layout_gravity="center" android:layout_width="fill_parent" android:layout_height="200dp"></ImageView>

 <HorizontalScrollView  android:layout_width="350dp"  android:layout_height="100dp" android:layout_gravity="center_horizontal">
<LinearLayout android:orientation="horizontal" android:padding="8dp" android:layout_weight="8" android:layout_height="wrap_content" android:layout_width="wrap_content">


<ImageView android:background="#FBB117" android:layout_gravity="center" android:src="@drawable/bob1" android:id="@+id/IVone" android:padding="3dp" android:layout_height="100dp" android:layout_width="100dp"/>
<ImageView android:background="#FBB117" android:layout_gravity="center" android:src="@drawable/bob3" android:id="@+id/IVthree" android:padding="3dp" android:layout_height="100dp" android:layout_width="100dp"/>
<ImageView android:background="#FBB117" android:layout_gravity="center" android:src="@drawable/bob4" android:id="@+id/IVfour" android:padding="3dp" android:layout_height="100dp" android:layout_width="100dp"/>
<ImageView android:background="#FBB117" android:layout_gravity="center" android:src="@drawable/bob5" android:id="@+id/IVfive" android:padding="3dp" android:layout_height="100dp" android:layout_width="100dp"/>
<ImageView android:background="#FBB117" android:layout_gravity="center" android:src="@drawable/bob6" android:id="@+id/IVsix" android:padding="3dp" android:layout_height="100dp" android:layout_width="100dp"/>
<ImageView android:background="#FBB117" android:layout_gravity="center" android:src="@drawable/bob7" android:id="@+id/IVseven" android:padding="3dp" android:layout_height="100dp" android:layout_width="100dp"/>
<ImageView android:background="#FBB117" android:layout_gravity="center" android:src="@drawable/bob8" android:id="@+id/IVeight" android:padding="3dp" android:layout_height="100dp" android:layout_width="100dp"/>
<ImageView android:background="#FBB117" android:layout_gravity="center" android:src="@drawable/bob9" android:id="@+id/IVnine" android:padding="3dp" android:layout_height="100dp" android:layout_width="100dp"/>
<ImageView android:background="#FBB117" android:layout_gravity="center" android:src="@drawable/bob10" android:id="@+id/IVten" android:padding="3dp" android:layout_height="100dp" android:layout_width="100dp"/>
<ImageView android:background="#FBB117" android:layout_gravity="center" android:src="@drawable/bob11" android:id="@+id/IVeleven" android:padding="3dp" android:layout_height="100dp" android:layout_width="100dp"/>

</LinearLayout>


 </HorizontalScrollView>

 <HorizontalScrollView android:layout_width="350dp" android:layout_gravity="center_horizontal" android:layout_height="100dp">
 <LinearLayout android:orientation="horizontal" android:padding="8dp" android:layout_height="wrap_content" android:layout_width="wrap_content">

 <ImageView android:background="#7E2217" android:layout_gravity="center" android:src="@drawable/bob12" android:id="@+id/IVtwelve" android:padding="3dp" android:layout_height="100dp" android:layout_width="100dp"/>
<ImageView android:background="#7E2217" android:layout_gravity="center" android:src="@drawable/bob13" android:id="@+id/IVthirteen" android:padding="3dp" android:layout_height="100dp" android:layout_width="100dp"/>
<ImageView android:background="#7E2217" android:layout_gravity="center" android:src="@drawable/bob14" android:id="@+id/IVfourteen" android:padding="3dp" android:layout_height="100dp" android:layout_width="100dp"/>
<ImageView android:background="#7E2217" android:layout_gravity="center" android:src="@drawable/bob15" android:id="@+id/IVfifteen" android:padding="3dp" android:layout_height="100dp" android:layout_width="100dp"/>
<ImageView android:background="#7E2217" android:layout_gravity="center" android:src="@drawable/bob16" android:id="@+id/IVsixteen" android:padding="3dp" android:layout_height="100dp" android:layout_width="100dp"/>
<ImageView android:background="#7E2217" android:layout_gravity="center" android:src="@drawable/bob17" android:id="@+id/IVseventeen" android:padding="3dp" android:layout_height="100dp" android:layout_width="100dp"/>
<ImageView android:background="#7E2217" android:layout_gravity="center" android:src="@drawable/bob18" android:id="@+id/IVeighteen" android:padding="3dp" android:layout_height="100dp" android:layout_width="100dp"/>
<ImageView android:background="#7E2217" android:layout_gravity="center" android:src="@drawable/bob19" android:id="@+id/IVnineteen" android:padding="3dp" android:layout_height="100dp" android:layout_width="100dp"/>
<ImageView android:background="#7E2217" android:layout_gravity="center" android:src="@drawable/bob20" android:id="@+id/IVtwenty" android:padding="3dp" android:layout_height="100dp" android:layout_width="100dp"/>

 </LinearLayout>
 </HorizontalScrollView>

 <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/buttonsetwallpaper"
         android:text="SET AS WALLPAPER" android:drawablePadding="2dp" android:layout_gravity="center_horizontal"></Button>

 <com.google.ads.AdView

 android:id="@+id/adView"
 android:layout_width="fill_parent" 
 android:layout_height="wrap_content" 
 android:layout_alignParentBottom="true"
 android:background="#ff0000"
 ads:adSize="BANNER"
 ads:loadAdOnCreate="true"
 ads:adUnitId="a14e8e1bbcb80eb"/>

</LinearLayout>
  • 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-26T01:51:27+00:00Added an answer on May 26, 2026 at 1:51 am

    This is really really bad snippet of code. You should know that your application really has only a limited portion of memory on device, so you cannot load all Bitmap stuffs on memory at one time.

    1. Use a GridView, ListView instead of having a lot of ImageView.
    2. Reduce bitmap quality to a reasonable one, or you can scale them.
    3. As I can see that you are trying to write something that users can pick from image list to set as WALLPAPER; I recommend Gallery.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've written a fairly simple java application that allows you to drag your mouse
I have a simple application written in C# and .Net 2.0 that displays several
I've got an ASPX page set up that loads and displays dynamic data from
I have written an application which loads information from a plist which lies on
I've written a simple order application that consists of a 1 page order-form containing
I've written a simple application that works with database. My program have a table
A simple application is written in CF 2.0. It's single-threaded as far as I'm
I want to use a timer in my simple .NET application written in C#.
I've written a simple multi-threaded game server in python that creates a new thread
A client wants to have a simple intranet application to manage his process. He

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.