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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T15:00:03+00:00 2026-05-29T15:00:03+00:00

I am developing an app where I have a list of bitmaps and I

  • 0

I am developing an app where I have a list of bitmaps and I want to place those bitmaps in a gridView. I have the folleowing code.

My Activity for gridView

public class TestBitmap extends Activity {

private Bitmap bitmap;
private ImageView image;
public static List<Bitmap> splittedBitmaps;

@Override
public void onCreate(Bundle bundle){
    super.onCreate(bundle);
    setContentView(R.layout.splitted_grid);
    splittedBitmaps = getIntent().getParcelableArrayListExtra("split");
    GridView gv = (GridView)findViewById(R.layout.splitted_grid);
    gv.setAdapter(new SplittedImageAdapter(this));
}
}

and this is my Adapter class

public class SplittedImageAdapter extends BaseAdapter{

private Context mContext;

public SplittedImageAdapter(Context c){
    mContext = c;
}

@Override
public int getCount() {
    return TestBitmap.splittedBitmaps.size();
}

@Override
public Object getItem(int arg0) {
    return null;
}

@Override
public long getItemId(int arg0) {
    return 0;
}

@Override
public View getView(int arg0, View arg1, ViewGroup arg2) {
    ImageView imageView = new ImageView(mContext);
    imageView.setLayoutParams(new GridView.LayoutParams(30,30));
    imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
    imageView.setPadding(1, 1, 1, 1);
    //imageView.setImageResource(TestBitmap.splittedImages.get(arg0));
    imageView.setImageBitmap(TestBitmap.splittedBitmaps.get(arg0));
    return imageView;
}

}

I am getting a NullPointerException in the last line of the onCreate method of my Activity class.
Please help me to trace the bug.

  • 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-29T15:00:05+00:00Added an answer on May 29, 2026 at 3:00 pm

    In last line of onCreate gb is null. That means (GridView)findViewById(R.layout.splitted_grid); is returning null, which means it is not finding the GridView.

    I believe the argument of findViewById is incorrect. R.layout.splitted_grid is a name of layout file. Instead you should use the ID of a view, eg. R.id.your_view_id_here if you have ID specified in your layout XML like that:

    <GridView
        android:id="@+id/your_view_id_here"
        (...)
    />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have finished developing my app and now I want to deploy it.. what
This is the scenario i have: im developing a web app that will list
I'm developing a app that have a Listview , and the items from list
Developing a Django web app, I have a list of packages I need to
I'm developing an alarm clock app for android and I want to have displayed
I'm developing an web app using asp.net mvc. I have a List in Cache
In the iPhone app I am developing, I need to have a list of
While developing my app I have come to realize that the majority of my
I'm developing an iPhone app and have a question about memory management. Let's say
I started developing an android app that have to interact with MMS attachements, in

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.