You cannot start a load on a not yet attached View or a Fragment where getActivity() returns null

前端 未结 5 1189
别跟我提以往
别跟我提以往 2021-01-13 21:26

I am using FragmentStatePagerAdapter to show around 5 fragments in an activity.On each activity I am showing the images which I am fetching from FirebaseListAdapter/Firebase

5条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-13 21:55

    1. Add Below Code on Activity on which RecyclerView is present

      public static Context context;
      
    2. Then in onCreate of the same Activity on which RecyclerView is present add below Code

      context = getApplicationContext();
      
    3. then take reference to glide as shown below

      Glide.with(YourActivity.context).load("Image Link").into(holder.YourImageView);
      

提交回复
热议问题