Page fixed at a specific post in recyclerview





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







1















I have an activity A. From that activity I go to activity B. Now there are some image descriptions in A and the corresponding images are in B. I want to make a system where based on the descriptions from activity A, the screen gets fixed to the post with the specific image among all the posts when I move from A to B. In other words I want to fix recyclerview to a specific child when the activity B opens.
P.S.- I have the postkeys of all the posts in recyclerview in B in my database.
Thanks in advance.










share|improve this question























  • What problem are you facing? and what did you do so far?

    – shb
    Nov 25 '18 at 10:58











  • I actually don't have a clue how to do it. If I only use intent, it will go the first post in the recyclerview in B. I have passed the postkey of the specific post from A to B. Now I want to set the recyclerview to the exact post with the postkey

    – Zubayr
    Nov 25 '18 at 11:01













  • I'm not if I understood you correctly, when you pass postKey from A to B, get the items from your database related to that passed postKey and set it to your recyclerview. Or do you want any specific row to be focused/Selected?

    – shb
    Nov 25 '18 at 11:21













  • I want a specific row to be focused.

    – Zubayr
    Nov 25 '18 at 11:24


















1















I have an activity A. From that activity I go to activity B. Now there are some image descriptions in A and the corresponding images are in B. I want to make a system where based on the descriptions from activity A, the screen gets fixed to the post with the specific image among all the posts when I move from A to B. In other words I want to fix recyclerview to a specific child when the activity B opens.
P.S.- I have the postkeys of all the posts in recyclerview in B in my database.
Thanks in advance.










share|improve this question























  • What problem are you facing? and what did you do so far?

    – shb
    Nov 25 '18 at 10:58











  • I actually don't have a clue how to do it. If I only use intent, it will go the first post in the recyclerview in B. I have passed the postkey of the specific post from A to B. Now I want to set the recyclerview to the exact post with the postkey

    – Zubayr
    Nov 25 '18 at 11:01













  • I'm not if I understood you correctly, when you pass postKey from A to B, get the items from your database related to that passed postKey and set it to your recyclerview. Or do you want any specific row to be focused/Selected?

    – shb
    Nov 25 '18 at 11:21













  • I want a specific row to be focused.

    – Zubayr
    Nov 25 '18 at 11:24














1












1








1








I have an activity A. From that activity I go to activity B. Now there are some image descriptions in A and the corresponding images are in B. I want to make a system where based on the descriptions from activity A, the screen gets fixed to the post with the specific image among all the posts when I move from A to B. In other words I want to fix recyclerview to a specific child when the activity B opens.
P.S.- I have the postkeys of all the posts in recyclerview in B in my database.
Thanks in advance.










share|improve this question














I have an activity A. From that activity I go to activity B. Now there are some image descriptions in A and the corresponding images are in B. I want to make a system where based on the descriptions from activity A, the screen gets fixed to the post with the specific image among all the posts when I move from A to B. In other words I want to fix recyclerview to a specific child when the activity B opens.
P.S.- I have the postkeys of all the posts in recyclerview in B in my database.
Thanks in advance.







android android-recyclerview






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 25 '18 at 10:55









ZubayrZubayr

868




868













  • What problem are you facing? and what did you do so far?

    – shb
    Nov 25 '18 at 10:58











  • I actually don't have a clue how to do it. If I only use intent, it will go the first post in the recyclerview in B. I have passed the postkey of the specific post from A to B. Now I want to set the recyclerview to the exact post with the postkey

    – Zubayr
    Nov 25 '18 at 11:01













  • I'm not if I understood you correctly, when you pass postKey from A to B, get the items from your database related to that passed postKey and set it to your recyclerview. Or do you want any specific row to be focused/Selected?

    – shb
    Nov 25 '18 at 11:21













  • I want a specific row to be focused.

    – Zubayr
    Nov 25 '18 at 11:24



















  • What problem are you facing? and what did you do so far?

    – shb
    Nov 25 '18 at 10:58











  • I actually don't have a clue how to do it. If I only use intent, it will go the first post in the recyclerview in B. I have passed the postkey of the specific post from A to B. Now I want to set the recyclerview to the exact post with the postkey

    – Zubayr
    Nov 25 '18 at 11:01













  • I'm not if I understood you correctly, when you pass postKey from A to B, get the items from your database related to that passed postKey and set it to your recyclerview. Or do you want any specific row to be focused/Selected?

    – shb
    Nov 25 '18 at 11:21













  • I want a specific row to be focused.

    – Zubayr
    Nov 25 '18 at 11:24

















What problem are you facing? and what did you do so far?

– shb
Nov 25 '18 at 10:58





What problem are you facing? and what did you do so far?

– shb
Nov 25 '18 at 10:58













I actually don't have a clue how to do it. If I only use intent, it will go the first post in the recyclerview in B. I have passed the postkey of the specific post from A to B. Now I want to set the recyclerview to the exact post with the postkey

– Zubayr
Nov 25 '18 at 11:01







I actually don't have a clue how to do it. If I only use intent, it will go the first post in the recyclerview in B. I have passed the postkey of the specific post from A to B. Now I want to set the recyclerview to the exact post with the postkey

– Zubayr
Nov 25 '18 at 11:01















I'm not if I understood you correctly, when you pass postKey from A to B, get the items from your database related to that passed postKey and set it to your recyclerview. Or do you want any specific row to be focused/Selected?

– shb
Nov 25 '18 at 11:21







I'm not if I understood you correctly, when you pass postKey from A to B, get the items from your database related to that passed postKey and set it to your recyclerview. Or do you want any specific row to be focused/Selected?

– shb
Nov 25 '18 at 11:21















I want a specific row to be focused.

– Zubayr
Nov 25 '18 at 11:24





I want a specific row to be focused.

– Zubayr
Nov 25 '18 at 11:24












1 Answer
1






active

oldest

votes


















1














find the row position associated to your postKey from your activity B recyclerViewAdapter then auto scroll to that postion



recyclerView.smoothScrollToPosition(rowPosition); //if you want a smooth scroll


or



recyclerview.scrollToPosition(rowPosition);





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%2f53466758%2fpage-fixed-at-a-specific-post-in-recyclerview%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









    1














    find the row position associated to your postKey from your activity B recyclerViewAdapter then auto scroll to that postion



    recyclerView.smoothScrollToPosition(rowPosition); //if you want a smooth scroll


    or



    recyclerview.scrollToPosition(rowPosition);





    share|improve this answer




























      1














      find the row position associated to your postKey from your activity B recyclerViewAdapter then auto scroll to that postion



      recyclerView.smoothScrollToPosition(rowPosition); //if you want a smooth scroll


      or



      recyclerview.scrollToPosition(rowPosition);





      share|improve this answer


























        1












        1








        1







        find the row position associated to your postKey from your activity B recyclerViewAdapter then auto scroll to that postion



        recyclerView.smoothScrollToPosition(rowPosition); //if you want a smooth scroll


        or



        recyclerview.scrollToPosition(rowPosition);





        share|improve this answer













        find the row position associated to your postKey from your activity B recyclerViewAdapter then auto scroll to that postion



        recyclerView.smoothScrollToPosition(rowPosition); //if you want a smooth scroll


        or



        recyclerview.scrollToPosition(rowPosition);






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 25 '18 at 11:51









        shbshb

        515612




        515612
































            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%2f53466758%2fpage-fixed-at-a-specific-post-in-recyclerview%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()