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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T02:43:09+00:00 2026-05-25T02:43:09+00:00

The logcat error: 08-24 11:16:19.760: ERROR/AndroidRuntime(6254): FATAL EXCEPTION: main 08-24 11:16:19.760: ERROR/AndroidRuntime(6254): java.lang.RuntimeException: Unable

  • 0

The logcat error:

08-24 11:16:19.760: ERROR/AndroidRuntime(6254): FATAL EXCEPTION: main
08-24 11:16:19.760: ERROR/AndroidRuntime(6254): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.ibssistemas.ibs/com.ibssistemas.ibs.gallery}:  java.lang.NullPointerException
08-24 11:16:19.760: ERROR/AndroidRuntime(6254):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
08-24 11:16:19.760: ERROR/AndroidRuntime(6254):     at   android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
08-24 11:16:19.760: ERROR/AndroidRuntime(6254):     at android.app.ActivityThread.access$2300(ActivityThread.java:125)
08-24 11:16:19.760: ERROR/AndroidRuntime(6254):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
08-24 11:16:19.760: ERROR/AndroidRuntime(6254):     at android.os.Handler.dispatchMessage(Handler.java:99)
08-24 11:16:19.760: ERROR/AndroidRuntime(6254):     at android.os.Looper.loop(Looper.java:123)
08-24 11:16:19.760: ERROR/AndroidRuntime(6254):     at android.app.ActivityThread.main(ActivityThread.java:4627)
08-24 11:16:19.760: ERROR/AndroidRuntime(6254):     at java.lang.reflect.Method.invokeNative(Native Method)
08-24 11:16:19.760: ERROR/AndroidRuntime(6254):     at java.lang.reflect.Method.invoke(Method.java:521)
08-24 11:16:19.760: ERROR/AndroidRuntime(6254):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
08-24 11:16:19.760: ERROR/AndroidRuntime(6254):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
08-24 11:16:19.760: ERROR/AndroidRuntime(6254):     at dalvik.system.NativeStart.main(Native Method)
08-24 11:16:19.760: ERROR/AndroidRuntime(6254): Caused by: java.lang.NullPointerException
08-24 11:16:19.760: ERROR/AndroidRuntime(6254):     at com.ibssistemas.ibs.gallery$ImageAdapter.getCount(gallery.java:46)
08-24 11:16:19.760: ERROR/AndroidRuntime(6254):     at  android.widget.AbsSpinner.setAdapter(AbsSpinner.java:113)
08-24 11:16:19.760: ERROR/AndroidRuntime(6254):     at com.ibssistemas.ibs.gallery.onCreate(gallery.java:35)
08-24 11:16:19.760: ERROR/AndroidRuntime(6254):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
08-24 11:16:19.760: ERROR/AndroidRuntime(6254):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
08-24 11:16:19.760: ERROR/AndroidRuntime(6254):     ... 11 more

And the code (a bit extensive :()

public class gallery extends Activity {
public static List<Produto> produtos;
ImageView grande;
TextView tvRef;
TextView tvDsc;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.galeria);
    tvDsc = (TextView)findViewById(R.id.tvGalDescricao);
    tvRef = (TextView)findViewById(R.id.tvGalReferencia);
    grande = (ImageView)findViewById(R.id.ivGalGrande);
    Gallery mG = (Gallery)findViewById(R.id.myGallery);
    mG.setAdapter(new ImageAdapter(this));
    produtos = ImagesGlobal.getImages();
}

class ImageAdapter extends BaseAdapter {

    private Context myContext;

    public ImageAdapter(Context c) { this.myContext = c; }

    /** Returns the amount of images we have defined. */
    public int getCount() { return produtos.size(); }

    public Object getItem(int position) { return position; }
    public long getItemId(int position) { return position; }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ImageView i = new ImageView(this.myContext);

        Produto p = produtos.get(position);
        Bitmap bm = BitmapFactory.decodeFile(Environment.getExternalStorageDirectory()+"/IBS/Imagens/"+p.getCD_REF()+".jpg");
        i.setImageBitmap(bm);
        grande.setImageBitmap(bm);
        tvRef.setText(p.getCD_REF());
        tvDsc.setText(p.getDS_PROD());
        /* Image should be scaled as width/height are set. */
        i.setScaleType(ImageView.ScaleType.FIT_XY);
        /* Set the Width/Height of the ImageView. */
        i.setLayoutParams(new Gallery.LayoutParams(150, 150));
        return i;
    }

    public float getScale(boolean focused, int offset) {
        return Math.max(0, 1.0f / (float)Math.pow(2, Math.abs(offset)));
    }
}
}

What could be causing the error? Thx in advance.

P.S.: Images exist in the folder, and the objects are not null 🙁

  • 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-25T02:43:10+00:00Added an answer on May 25, 2026 at 2:43 am

    just put this line before creating the object of Gallery

    like this

    produtos = ImagesGlobal.getImages();
    Gallery mG = (Gallery)findViewById(R.id.myGallery);
    mG.setAdapter(new ImageAdapter(this));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In Android Emulator i am getting below Logcat Error: 03-11 04:44:56.663: ERROR/AndroidRuntime(403): java.lang.RuntimeException: Unable
im getting an error from logcat: 01-13 17:53:25.368: E/AndroidRuntime(3235): Caused by: java.lang.NullPointerException 01-13 17:53:25.368:
Im not gettin the following error fixed (logcat): E/AndroidRuntime( 1010): FATAL EXCEPTION: Thread-105 E/AndroidRuntime(
I have got this logcat error more then one time. This time I started
i have problems with my game. I have an Main Activity that's shows a
When my splash screen starts i get tis error in logcat: 11-06 02:36:45.450: E/global(4184):
My main activity has three check boxes in it. I want to be able
hi now i am create simple andengine application...now my logcat indicate error....what mistake i
Hi if i run my project its indicate this logcat error...how to solve this
i check my logcat file error is the location manage is null public class

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.