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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T16:58:38+00:00 2026-06-15T16:58:38+00:00

I have gridView in fragment @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, // Bundle

  • 0

I have gridView in fragment

     @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
        //
        Bundle savedInstanceState) {




    if (container == null) {
        Log.e("Null container", "Null");

        return null;
    }
    Log.e("fragment1", "fragment1 reached!");
    View view =  inflater.inflate(R.layout.menu1_fragment, container, false);
    GridView gridView = (GridView)view.findViewById(R.id.gridview1);
    gridView.setAdapter(new ImageAdapter(this.getActivity()));


    Log.e("fragment1", "fragment1 reached!");

    return (GridView)inflater.inflate(R.layout.menu1_fragment, container, false);
}

But the adapter doesn’t work, it doesn’t reach overridden getView method.

Constructor:

public ImageAdapter(Context c) {
    mContext = c;
    Log.e("ImageAdapter", "constructor");
}

GetView method:

 @Override
public View getView(int position, View convertView, ViewGroup parent) {
    Log.e("ImageAdapter", "dsfdsf");
    ImageView imageView;
    if (convertView == null) {  // if it's not recycled, initialize some attributes
        imageView = new ImageView(mContext);
        if (DefinedValues.width/3 < DefinedValues.height/4)
        imageView.setLayoutParams(new GridView.LayoutParams
                (DefinedValues.height/4, DefinedValues.height/4));
        else
            imageView.setLayoutParams(new GridView.LayoutParams
                    (DefinedValues.width/3-5, DefinedValues.width/3-5));
        imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
        imageView.setPadding(8, 8, 8, 8);
    } else {
        imageView = (ImageView) convertView;
    }

    imageView.setImageResource(mThumbIds[position]);
    return imageView;
}
  • 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-15T16:58:39+00:00Added an answer on June 15, 2026 at 4:58 pm

    In the onCreateView, you are inflating the xml twice, one you are editing and then you are returning a non edited one..

    public View onCreateView(LayoutInflater inflater, ViewGroup container,
        //
        Bundle savedInstanceState) {
    
    
    
    
    if (container == null) {
        Log.e("Null container", "Null");
    
        return null;
    }
    Log.e("fragment1", "fragment1 reached!");
    View view =  inflater.inflate(R.layout.menu1_fragment, container, false);
    GridView gridView = (GridView)view.findViewById(R.id.gridview1);
    gridView.setAdapter(new ImageAdapter(this.getActivity()));
    
    
    Log.e("fragment1", "fragment1 reached!");
    
    return view;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have fragment which shows data in GridView. Data are downloaded from internet in
I have a (Sherlock)FragmentActivity with 2 tabbed fragments. The left fragment is a GridView
I have GridView on my page: <%@ Page Language=C# AutoEventWireup=true CodeFile=Default.aspx.cs Inherits=_Default %> <!DOCTYPE
Have a gridview control which will show X amount of rows. I want to
I have a gridview and I have a button on it.I want, if the
I have a GridView and SqlDataSource , I have a column type: DateTime .
I have a gridview that needs to be exported to Excel. I have managed
I have a gridview and and I am creating it dynamically, I get parent
I have a GridView like this( main.xml ): <?xml version=1.0 encoding=utf-8?> <GridView xmlns:android=http://schemas.android.com/apk/res/android android:id=@+id/gridView1
I have a gridview and sqldatasource. In tabledefinition the default format for date is

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.