Android Viewgroup IssuesIs there a way to run Python on Android?How to save an Android Activity state using save instance state?Close/hide the Android Soft KeyboardWhy is the Android emulator so slow? How can we speed up the Android emulator?“Debug certificate expired” error in Eclipse Android pluginsIs there a unique Android device ID?What is 'Context' on Android?Proper use cases for Android UserManager.isUserAGoat()?Scrolling lagged after applying the typeface in the Recycler view itemsWhy onBindViewHolder index isn't incrementing in Recycler View?

What are the limitations of the Hendersson-Hasselbalch equation?

Is it possible to use reference type alias with pointer operator to declare a reference to pointer?

Is a text with orthographic or grammatic mistakes in a language X still a text in that language X?

would a winged human/angel build like this be able to fly? (see image below)

Pronouns when writing from the point of view of a robot

Can a Hogwarts student refuse the Sorting Hat's decision?

How to prevent Deadlock on SELECT queries?

Broken bottom bracket?

Why do my fried eggs start browning very fast?

What could prevent players from leaving an island?

Is there any difference between "result in" and "end up with"?

Write The Shortest Program to Calculate Height of a Binary Tree

conditional probability of dependent random variables

Is space radiation a risk for space film photography, and how is this prevented?

Why is Heisenberg shown dead in Negro y Azul?

How does Rust's 128-bit integer `i128` work on a 64-bit system?

Does a humanoid possessed by a ghost register as undead to a paladin's Divine Sense?

Probably terminated or laid off soon; confront or not?

If someone else uploads my GPL'd code to Github without my permission, is that a copyright violation?

what can you do with Format View

Piece de Resistance - Introduction & Ace and A's

Programmatically drawing sinusoids with tikz

What is the difference between "un plan" and "une carte" (in the context of map)?

Which one is more important between endgame studies and tactics?



Android Viewgroup Issues


Is there a way to run Python on Android?How to save an Android Activity state using save instance state?Close/hide the Android Soft KeyboardWhy is the Android emulator so slow? How can we speed up the Android emulator?“Debug certificate expired” error in Eclipse Android pluginsIs there a unique Android device ID?What is 'Context' on Android?Proper use cases for Android UserManager.isUserAGoat()?Scrolling lagged after applying the typeface in the Recycler view itemsWhy onBindViewHolder index isn't incrementing in Recycler View?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








2















I have an issue using a viewGroup, for some reason the id doesn't process the statement, and really I tried everything, can you help please?



I don't know if it is something about the version3.3.2 or what's wrong with the code



public class popularAdapter extends RecyclerView.Adapter<popularAdapter.ImageViewHolder> 

private Context mContext;
private List<popular> mPopulars;

public popularAdapter (Context context,List<popular>populars)

mContext=context;
mPopulars=populars;








@Override
public ImageViewHolder onCreateViewHolder(ViewGroup parent, int viewType)
//HERE IS THE ISSUE
View v= LayoutInflater.from(mContext).inflate(R.layout.popular_item2,viewGroup,false);

return new ImageViewHolder(v);


@Override
public void onBindViewHolder(ImageViewHolder holder, int position)

popular popularCur=mPopulars.get(position);
ImageViewHolder.prodName.setText(popularCur.getProduc_name());




@Override
public int getItemCount()
return 0;


public class ImageViewHolder extends RecyclerView.ViewHolder

public TextView prd_name;
public TextView prd_price;
public TextView prd_img;

public ImageViewHolder(View itemView)
super(itemView);

prd_name =itemView.findViewById(R.id.prodName);
prd_price=itemView.findViewById(R.id.prodPrice);
prd_img =itemView.findViewById(R.id.prodImageHolder);

















share|improve this question


























  • I think the problem is with the context you are sending.See my answer down there.Try that solution.

    – Brahma Datta
    Mar 27 at 5:46







  • 1





    @g.brahmaDatta sir not in here context check he returning 0 in item count

    – Ashvin solanki
    Mar 27 at 5:50






  • 1





    yeah nice point @Ashvinsolanki

    – Brahma Datta
    Mar 27 at 5:55











  • did you solve your problem ?

    – Ashvin solanki
    Mar 27 at 10:02

















2















I have an issue using a viewGroup, for some reason the id doesn't process the statement, and really I tried everything, can you help please?



I don't know if it is something about the version3.3.2 or what's wrong with the code



public class popularAdapter extends RecyclerView.Adapter<popularAdapter.ImageViewHolder> 

private Context mContext;
private List<popular> mPopulars;

public popularAdapter (Context context,List<popular>populars)

mContext=context;
mPopulars=populars;








@Override
public ImageViewHolder onCreateViewHolder(ViewGroup parent, int viewType)
//HERE IS THE ISSUE
View v= LayoutInflater.from(mContext).inflate(R.layout.popular_item2,viewGroup,false);

return new ImageViewHolder(v);


@Override
public void onBindViewHolder(ImageViewHolder holder, int position)

popular popularCur=mPopulars.get(position);
ImageViewHolder.prodName.setText(popularCur.getProduc_name());




@Override
public int getItemCount()
return 0;


public class ImageViewHolder extends RecyclerView.ViewHolder

public TextView prd_name;
public TextView prd_price;
public TextView prd_img;

public ImageViewHolder(View itemView)
super(itemView);

prd_name =itemView.findViewById(R.id.prodName);
prd_price=itemView.findViewById(R.id.prodPrice);
prd_img =itemView.findViewById(R.id.prodImageHolder);

















share|improve this question


























  • I think the problem is with the context you are sending.See my answer down there.Try that solution.

    – Brahma Datta
    Mar 27 at 5:46







  • 1





    @g.brahmaDatta sir not in here context check he returning 0 in item count

    – Ashvin solanki
    Mar 27 at 5:50






  • 1





    yeah nice point @Ashvinsolanki

    – Brahma Datta
    Mar 27 at 5:55











  • did you solve your problem ?

    – Ashvin solanki
    Mar 27 at 10:02













2












2








2








I have an issue using a viewGroup, for some reason the id doesn't process the statement, and really I tried everything, can you help please?



I don't know if it is something about the version3.3.2 or what's wrong with the code



public class popularAdapter extends RecyclerView.Adapter<popularAdapter.ImageViewHolder> 

private Context mContext;
private List<popular> mPopulars;

public popularAdapter (Context context,List<popular>populars)

mContext=context;
mPopulars=populars;








@Override
public ImageViewHolder onCreateViewHolder(ViewGroup parent, int viewType)
//HERE IS THE ISSUE
View v= LayoutInflater.from(mContext).inflate(R.layout.popular_item2,viewGroup,false);

return new ImageViewHolder(v);


@Override
public void onBindViewHolder(ImageViewHolder holder, int position)

popular popularCur=mPopulars.get(position);
ImageViewHolder.prodName.setText(popularCur.getProduc_name());




@Override
public int getItemCount()
return 0;


public class ImageViewHolder extends RecyclerView.ViewHolder

public TextView prd_name;
public TextView prd_price;
public TextView prd_img;

public ImageViewHolder(View itemView)
super(itemView);

prd_name =itemView.findViewById(R.id.prodName);
prd_price=itemView.findViewById(R.id.prodPrice);
prd_img =itemView.findViewById(R.id.prodImageHolder);

















share|improve this question
















I have an issue using a viewGroup, for some reason the id doesn't process the statement, and really I tried everything, can you help please?



I don't know if it is something about the version3.3.2 or what's wrong with the code



public class popularAdapter extends RecyclerView.Adapter<popularAdapter.ImageViewHolder> 

private Context mContext;
private List<popular> mPopulars;

public popularAdapter (Context context,List<popular>populars)

mContext=context;
mPopulars=populars;








@Override
public ImageViewHolder onCreateViewHolder(ViewGroup parent, int viewType)
//HERE IS THE ISSUE
View v= LayoutInflater.from(mContext).inflate(R.layout.popular_item2,viewGroup,false);

return new ImageViewHolder(v);


@Override
public void onBindViewHolder(ImageViewHolder holder, int position)

popular popularCur=mPopulars.get(position);
ImageViewHolder.prodName.setText(popularCur.getProduc_name());




@Override
public int getItemCount()
return 0;


public class ImageViewHolder extends RecyclerView.ViewHolder

public TextView prd_name;
public TextView prd_price;
public TextView prd_img;

public ImageViewHolder(View itemView)
super(itemView);

prd_name =itemView.findViewById(R.id.prodName);
prd_price=itemView.findViewById(R.id.prodPrice);
prd_img =itemView.findViewById(R.id.prodImageHolder);














android android-viewgroup






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 27 at 5:41









Zoe

15.4k9 gold badges65 silver badges97 bronze badges




15.4k9 gold badges65 silver badges97 bronze badges










asked Mar 27 at 2:34









The MechanicThe Mechanic

111 bronze badge




111 bronze badge















  • I think the problem is with the context you are sending.See my answer down there.Try that solution.

    – Brahma Datta
    Mar 27 at 5:46







  • 1





    @g.brahmaDatta sir not in here context check he returning 0 in item count

    – Ashvin solanki
    Mar 27 at 5:50






  • 1





    yeah nice point @Ashvinsolanki

    – Brahma Datta
    Mar 27 at 5:55











  • did you solve your problem ?

    – Ashvin solanki
    Mar 27 at 10:02

















  • I think the problem is with the context you are sending.See my answer down there.Try that solution.

    – Brahma Datta
    Mar 27 at 5:46







  • 1





    @g.brahmaDatta sir not in here context check he returning 0 in item count

    – Ashvin solanki
    Mar 27 at 5:50






  • 1





    yeah nice point @Ashvinsolanki

    – Brahma Datta
    Mar 27 at 5:55











  • did you solve your problem ?

    – Ashvin solanki
    Mar 27 at 10:02
















I think the problem is with the context you are sending.See my answer down there.Try that solution.

– Brahma Datta
Mar 27 at 5:46






I think the problem is with the context you are sending.See my answer down there.Try that solution.

– Brahma Datta
Mar 27 at 5:46





1




1





@g.brahmaDatta sir not in here context check he returning 0 in item count

– Ashvin solanki
Mar 27 at 5:50





@g.brahmaDatta sir not in here context check he returning 0 in item count

– Ashvin solanki
Mar 27 at 5:50




1




1





yeah nice point @Ashvinsolanki

– Brahma Datta
Mar 27 at 5:55





yeah nice point @Ashvinsolanki

– Brahma Datta
Mar 27 at 5:55













did you solve your problem ?

– Ashvin solanki
Mar 27 at 10:02





did you solve your problem ?

– Ashvin solanki
Mar 27 at 10:02












3 Answers
3






active

oldest

votes


















1














problem is here



you will never get any items in RecyclerView because you are returning 0 in getItemCount



 @Override
public int getItemCount()

//return 0 ?
return 0;



change with



 @Override
public int getItemCount()

return mPopulars.size();



getItemCount



int getItemCount ()


Returns the total number of items in the data set held by the adapter.






share|improve this answer


































    0














    Try this solution



    public ImageViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) 
    View v= LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.popular_item2,viewGroup,false);
    return new ImageViewHolder(v);






    share|improve this answer
































      0














      Optimizing @Ashwin solanki answer



      Change following code



      @Override
      public int getItemCount()

      //return 0 ?
      return 0;



      to



      @Override
      public int getItemCount()

      //return 0 ?
      if(mPopulars != null)
      return mPopulars.size();

      return 0;



      Description: onCreateViewHolder and onBindViewHolder methods get called for the count which is returned by getItemCount method. As your code is always returning 0, these methods will not get called and list will not get populated on UI.



      Also, check following line from you code from onBindViewHolder method:



      ImageViewHolder.prodName.setText(popularCur.getProduc_name());


      You are considering 'prodName' variable of 'ImageViewHolder' class as static but it is not. Instead it should be



      holder.prodName.setText(popularCur.getProduc_name());





      share|improve this answer



























        Your Answer






        StackExchange.ifUsing("editor", function ()
        StackExchange.using("externalEditor", function ()
        StackExchange.using("snippets", function ()
        StackExchange.snippets.init();
        );
        );
        , "code-snippets");

        StackExchange.ready(function()
        var channelOptions =
        tags: "".split(" "),
        id: "1"
        ;
        initTagRenderer("".split(" "), "".split(" "), channelOptions);

        StackExchange.using("externalEditor", function()
        // Have to fire editor after snippets, if snippets enabled
        if (StackExchange.settings.snippets.snippetsEnabled)
        StackExchange.using("snippets", function()
        createEditor();
        );

        else
        createEditor();

        );

        function createEditor()
        StackExchange.prepareEditor(
        heartbeatType: 'answer',
        autoActivateHeartbeat: false,
        convertImagesToLinks: true,
        noModals: true,
        showLowRepImageUploadWarning: true,
        reputationToPostImages: 10,
        bindNavPrevention: true,
        postfix: "",
        imageUploader:
        brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
        contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
        allowUrls: true
        ,
        onDemand: true,
        discardSelector: ".discard-answer"
        ,immediatelyShowMarkdownHelp:true
        );



        );













        draft saved

        draft discarded


















        StackExchange.ready(
        function ()
        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55368939%2fandroid-viewgroup-issues%23new-answer', 'question_page');

        );

        Post as a guest















        Required, but never shown

























        3 Answers
        3






        active

        oldest

        votes








        3 Answers
        3






        active

        oldest

        votes









        active

        oldest

        votes






        active

        oldest

        votes









        1














        problem is here



        you will never get any items in RecyclerView because you are returning 0 in getItemCount



         @Override
        public int getItemCount()

        //return 0 ?
        return 0;



        change with



         @Override
        public int getItemCount()

        return mPopulars.size();



        getItemCount



        int getItemCount ()


        Returns the total number of items in the data set held by the adapter.






        share|improve this answer































          1














          problem is here



          you will never get any items in RecyclerView because you are returning 0 in getItemCount



           @Override
          public int getItemCount()

          //return 0 ?
          return 0;



          change with



           @Override
          public int getItemCount()

          return mPopulars.size();



          getItemCount



          int getItemCount ()


          Returns the total number of items in the data set held by the adapter.






          share|improve this answer





























            1












            1








            1







            problem is here



            you will never get any items in RecyclerView because you are returning 0 in getItemCount



             @Override
            public int getItemCount()

            //return 0 ?
            return 0;



            change with



             @Override
            public int getItemCount()

            return mPopulars.size();



            getItemCount



            int getItemCount ()


            Returns the total number of items in the data set held by the adapter.






            share|improve this answer















            problem is here



            you will never get any items in RecyclerView because you are returning 0 in getItemCount



             @Override
            public int getItemCount()

            //return 0 ?
            return 0;



            change with



             @Override
            public int getItemCount()

            return mPopulars.size();



            getItemCount



            int getItemCount ()


            Returns the total number of items in the data set held by the adapter.







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Mar 27 at 6:24

























            answered Mar 27 at 5:49









            Ashvin solankiAshvin solanki

            2,0048 silver badges34 bronze badges




            2,0048 silver badges34 bronze badges


























                0














                Try this solution



                public ImageViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) 
                View v= LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.popular_item2,viewGroup,false);
                return new ImageViewHolder(v);






                share|improve this answer





























                  0














                  Try this solution



                  public ImageViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) 
                  View v= LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.popular_item2,viewGroup,false);
                  return new ImageViewHolder(v);






                  share|improve this answer



























                    0












                    0








                    0







                    Try this solution



                    public ImageViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) 
                    View v= LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.popular_item2,viewGroup,false);
                    return new ImageViewHolder(v);






                    share|improve this answer













                    Try this solution



                    public ImageViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) 
                    View v= LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.popular_item2,viewGroup,false);
                    return new ImageViewHolder(v);







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Mar 27 at 5:45









                    Brahma DattaBrahma Datta

                    7284 silver badges14 bronze badges




                    7284 silver badges14 bronze badges
























                        0














                        Optimizing @Ashwin solanki answer



                        Change following code



                        @Override
                        public int getItemCount()

                        //return 0 ?
                        return 0;



                        to



                        @Override
                        public int getItemCount()

                        //return 0 ?
                        if(mPopulars != null)
                        return mPopulars.size();

                        return 0;



                        Description: onCreateViewHolder and onBindViewHolder methods get called for the count which is returned by getItemCount method. As your code is always returning 0, these methods will not get called and list will not get populated on UI.



                        Also, check following line from you code from onBindViewHolder method:



                        ImageViewHolder.prodName.setText(popularCur.getProduc_name());


                        You are considering 'prodName' variable of 'ImageViewHolder' class as static but it is not. Instead it should be



                        holder.prodName.setText(popularCur.getProduc_name());





                        share|improve this answer





























                          0














                          Optimizing @Ashwin solanki answer



                          Change following code



                          @Override
                          public int getItemCount()

                          //return 0 ?
                          return 0;



                          to



                          @Override
                          public int getItemCount()

                          //return 0 ?
                          if(mPopulars != null)
                          return mPopulars.size();

                          return 0;



                          Description: onCreateViewHolder and onBindViewHolder methods get called for the count which is returned by getItemCount method. As your code is always returning 0, these methods will not get called and list will not get populated on UI.



                          Also, check following line from you code from onBindViewHolder method:



                          ImageViewHolder.prodName.setText(popularCur.getProduc_name());


                          You are considering 'prodName' variable of 'ImageViewHolder' class as static but it is not. Instead it should be



                          holder.prodName.setText(popularCur.getProduc_name());





                          share|improve this answer



























                            0












                            0








                            0







                            Optimizing @Ashwin solanki answer



                            Change following code



                            @Override
                            public int getItemCount()

                            //return 0 ?
                            return 0;



                            to



                            @Override
                            public int getItemCount()

                            //return 0 ?
                            if(mPopulars != null)
                            return mPopulars.size();

                            return 0;



                            Description: onCreateViewHolder and onBindViewHolder methods get called for the count which is returned by getItemCount method. As your code is always returning 0, these methods will not get called and list will not get populated on UI.



                            Also, check following line from you code from onBindViewHolder method:



                            ImageViewHolder.prodName.setText(popularCur.getProduc_name());


                            You are considering 'prodName' variable of 'ImageViewHolder' class as static but it is not. Instead it should be



                            holder.prodName.setText(popularCur.getProduc_name());





                            share|improve this answer













                            Optimizing @Ashwin solanki answer



                            Change following code



                            @Override
                            public int getItemCount()

                            //return 0 ?
                            return 0;



                            to



                            @Override
                            public int getItemCount()

                            //return 0 ?
                            if(mPopulars != null)
                            return mPopulars.size();

                            return 0;



                            Description: onCreateViewHolder and onBindViewHolder methods get called for the count which is returned by getItemCount method. As your code is always returning 0, these methods will not get called and list will not get populated on UI.



                            Also, check following line from you code from onBindViewHolder method:



                            ImageViewHolder.prodName.setText(popularCur.getProduc_name());


                            You are considering 'prodName' variable of 'ImageViewHolder' class as static but it is not. Instead it should be



                            holder.prodName.setText(popularCur.getProduc_name());






                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered Mar 27 at 6:23









                            Virat18Virat18

                            1,1741 gold badge12 silver badges25 bronze badges




                            1,1741 gold badge12 silver badges25 bronze badges






























                                draft saved

                                draft discarded
















































                                Thanks for contributing an answer to Stack Overflow!


                                • Please be sure to answer the question. Provide details and share your research!

                                But avoid


                                • Asking for help, clarification, or responding to other answers.

                                • Making statements based on opinion; back them up with references or personal experience.

                                To learn more, see our tips on writing great answers.




                                draft saved


                                draft discarded














                                StackExchange.ready(
                                function ()
                                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55368939%2fandroid-viewgroup-issues%23new-answer', 'question_page');

                                );

                                Post as a guest















                                Required, but never shown





















































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown

































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown







                                Popular posts from this blog

                                SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

                                용인 삼성생명 블루밍스 목차 통계 역대 감독 선수단 응원단 경기장 같이 보기 외부 링크 둘러보기 메뉴samsungblueminx.comeh선수 명단용인 삼성생명 블루밍스용인 삼성생명 블루밍스ehsamsungblueminx.comeheheheh

                                155 수학 과학 기타 둘러보기 메뉴eh추가해eh문서를 완성해