overridePendingTransition in Image Adapter and View Holder











up vote
-1
down vote

favorite












I am trying to call an overridePendingTransition in a view holder. I have tried several solutions and haven't been able to find one that works. I have called the intent with the overridePendingTransition but doesn't work.



@Override
public void onBindViewHolder(ViewHolder holder, @SuppressLint("RecyclerView") final int position) {
String groupName = mDataset.get(position);
int groupImage = mGroupImageArray[position];
holder.mImageView.setBackgroundResource(groupImage);
holder.mTextViewGroupName.setText(groupName);
holder.mParentLayout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent groupIntent = new Intent(mActivity, ShowGroupActivity.class);
groupIntent.putExtra("groupName", mDataset.get(position));
groupIntent.overridePendingTransition(R.anim.slide_in_right, R.anim.slide_out_left);
mActivity.startActivity(groupIntent);
}
});
}









share|improve this question


























    up vote
    -1
    down vote

    favorite












    I am trying to call an overridePendingTransition in a view holder. I have tried several solutions and haven't been able to find one that works. I have called the intent with the overridePendingTransition but doesn't work.



    @Override
    public void onBindViewHolder(ViewHolder holder, @SuppressLint("RecyclerView") final int position) {
    String groupName = mDataset.get(position);
    int groupImage = mGroupImageArray[position];
    holder.mImageView.setBackgroundResource(groupImage);
    holder.mTextViewGroupName.setText(groupName);
    holder.mParentLayout.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
    Intent groupIntent = new Intent(mActivity, ShowGroupActivity.class);
    groupIntent.putExtra("groupName", mDataset.get(position));
    groupIntent.overridePendingTransition(R.anim.slide_in_right, R.anim.slide_out_left);
    mActivity.startActivity(groupIntent);
    }
    });
    }









    share|improve this question
























      up vote
      -1
      down vote

      favorite









      up vote
      -1
      down vote

      favorite











      I am trying to call an overridePendingTransition in a view holder. I have tried several solutions and haven't been able to find one that works. I have called the intent with the overridePendingTransition but doesn't work.



      @Override
      public void onBindViewHolder(ViewHolder holder, @SuppressLint("RecyclerView") final int position) {
      String groupName = mDataset.get(position);
      int groupImage = mGroupImageArray[position];
      holder.mImageView.setBackgroundResource(groupImage);
      holder.mTextViewGroupName.setText(groupName);
      holder.mParentLayout.setOnClickListener(new View.OnClickListener() {
      @Override
      public void onClick(View v) {
      Intent groupIntent = new Intent(mActivity, ShowGroupActivity.class);
      groupIntent.putExtra("groupName", mDataset.get(position));
      groupIntent.overridePendingTransition(R.anim.slide_in_right, R.anim.slide_out_left);
      mActivity.startActivity(groupIntent);
      }
      });
      }









      share|improve this question













      I am trying to call an overridePendingTransition in a view holder. I have tried several solutions and haven't been able to find one that works. I have called the intent with the overridePendingTransition but doesn't work.



      @Override
      public void onBindViewHolder(ViewHolder holder, @SuppressLint("RecyclerView") final int position) {
      String groupName = mDataset.get(position);
      int groupImage = mGroupImageArray[position];
      holder.mImageView.setBackgroundResource(groupImage);
      holder.mTextViewGroupName.setText(groupName);
      holder.mParentLayout.setOnClickListener(new View.OnClickListener() {
      @Override
      public void onClick(View v) {
      Intent groupIntent = new Intent(mActivity, ShowGroupActivity.class);
      groupIntent.putExtra("groupName", mDataset.get(position));
      groupIntent.overridePendingTransition(R.anim.slide_in_right, R.anim.slide_out_left);
      mActivity.startActivity(groupIntent);
      }
      });
      }






      java android






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 8 at 2:45









      User123

      274




      274
























          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote













          Intent class does not have the method overridePendingTransition, however you can it on an activity, say if your mActivity is an Activity:



          mActivity.overridePendingTransition(R.anim.slide_in_right, R.anim.slide_out_left);
          mActivity.startActivity(groupIntent);


          Otherwise, call the method somewhere in your activity that contains the RecyclerView:



          @Override
          protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          overridePendingTransition(R.anim.slide_in_right, R.anim.slide_out_left);
          // continue ...
          }





          share|improve this answer























          • I get the error error: cannot find symbol method overridePendingTransition(int,int) @Aaron
            – User123
            Nov 8 at 2:54










          • @User123 Is your mActivity an Activity or Context?
            – Aaron
            Nov 8 at 2:59












          • I am using context @Aaron
            – User123
            Nov 8 at 3:01










          • Either you change mActivity type to Activity, or you call in on your activity. I've updated the answer, hope it works for you!
            – Aaron
            Nov 8 at 3:11











          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',
          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%2f53200827%2foverridependingtransition-in-image-adapter-and-view-holder%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          0
          down vote













          Intent class does not have the method overridePendingTransition, however you can it on an activity, say if your mActivity is an Activity:



          mActivity.overridePendingTransition(R.anim.slide_in_right, R.anim.slide_out_left);
          mActivity.startActivity(groupIntent);


          Otherwise, call the method somewhere in your activity that contains the RecyclerView:



          @Override
          protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          overridePendingTransition(R.anim.slide_in_right, R.anim.slide_out_left);
          // continue ...
          }





          share|improve this answer























          • I get the error error: cannot find symbol method overridePendingTransition(int,int) @Aaron
            – User123
            Nov 8 at 2:54










          • @User123 Is your mActivity an Activity or Context?
            – Aaron
            Nov 8 at 2:59












          • I am using context @Aaron
            – User123
            Nov 8 at 3:01










          • Either you change mActivity type to Activity, or you call in on your activity. I've updated the answer, hope it works for you!
            – Aaron
            Nov 8 at 3:11















          up vote
          0
          down vote













          Intent class does not have the method overridePendingTransition, however you can it on an activity, say if your mActivity is an Activity:



          mActivity.overridePendingTransition(R.anim.slide_in_right, R.anim.slide_out_left);
          mActivity.startActivity(groupIntent);


          Otherwise, call the method somewhere in your activity that contains the RecyclerView:



          @Override
          protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          overridePendingTransition(R.anim.slide_in_right, R.anim.slide_out_left);
          // continue ...
          }





          share|improve this answer























          • I get the error error: cannot find symbol method overridePendingTransition(int,int) @Aaron
            – User123
            Nov 8 at 2:54










          • @User123 Is your mActivity an Activity or Context?
            – Aaron
            Nov 8 at 2:59












          • I am using context @Aaron
            – User123
            Nov 8 at 3:01










          • Either you change mActivity type to Activity, or you call in on your activity. I've updated the answer, hope it works for you!
            – Aaron
            Nov 8 at 3:11













          up vote
          0
          down vote










          up vote
          0
          down vote









          Intent class does not have the method overridePendingTransition, however you can it on an activity, say if your mActivity is an Activity:



          mActivity.overridePendingTransition(R.anim.slide_in_right, R.anim.slide_out_left);
          mActivity.startActivity(groupIntent);


          Otherwise, call the method somewhere in your activity that contains the RecyclerView:



          @Override
          protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          overridePendingTransition(R.anim.slide_in_right, R.anim.slide_out_left);
          // continue ...
          }





          share|improve this answer














          Intent class does not have the method overridePendingTransition, however you can it on an activity, say if your mActivity is an Activity:



          mActivity.overridePendingTransition(R.anim.slide_in_right, R.anim.slide_out_left);
          mActivity.startActivity(groupIntent);


          Otherwise, call the method somewhere in your activity that contains the RecyclerView:



          @Override
          protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          overridePendingTransition(R.anim.slide_in_right, R.anim.slide_out_left);
          // continue ...
          }






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Nov 8 at 3:11

























          answered Nov 8 at 2:51









          Aaron

          1,5541212




          1,5541212












          • I get the error error: cannot find symbol method overridePendingTransition(int,int) @Aaron
            – User123
            Nov 8 at 2:54










          • @User123 Is your mActivity an Activity or Context?
            – Aaron
            Nov 8 at 2:59












          • I am using context @Aaron
            – User123
            Nov 8 at 3:01










          • Either you change mActivity type to Activity, or you call in on your activity. I've updated the answer, hope it works for you!
            – Aaron
            Nov 8 at 3:11


















          • I get the error error: cannot find symbol method overridePendingTransition(int,int) @Aaron
            – User123
            Nov 8 at 2:54










          • @User123 Is your mActivity an Activity or Context?
            – Aaron
            Nov 8 at 2:59












          • I am using context @Aaron
            – User123
            Nov 8 at 3:01










          • Either you change mActivity type to Activity, or you call in on your activity. I've updated the answer, hope it works for you!
            – Aaron
            Nov 8 at 3:11
















          I get the error error: cannot find symbol method overridePendingTransition(int,int) @Aaron
          – User123
          Nov 8 at 2:54




          I get the error error: cannot find symbol method overridePendingTransition(int,int) @Aaron
          – User123
          Nov 8 at 2:54












          @User123 Is your mActivity an Activity or Context?
          – Aaron
          Nov 8 at 2:59






          @User123 Is your mActivity an Activity or Context?
          – Aaron
          Nov 8 at 2:59














          I am using context @Aaron
          – User123
          Nov 8 at 3:01




          I am using context @Aaron
          – User123
          Nov 8 at 3:01












          Either you change mActivity type to Activity, or you call in on your activity. I've updated the answer, hope it works for you!
          – Aaron
          Nov 8 at 3:11




          Either you change mActivity type to Activity, or you call in on your activity. I've updated the answer, hope it works for you!
          – Aaron
          Nov 8 at 3:11


















          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.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • 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%2f53200827%2foverridependingtransition-in-image-adapter-and-view-holder%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







          這個網誌中的熱門文章

          Xamarin.form Move up view when keyboard appear

          Post-Redirect-Get with Spring WebFlux and Thymeleaf

          Anylogic : not able to use stopDelay()