• Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.
    To learn more about how to use our BBCode feature, please click here.

    Thank you, Code Forum.

johnlaw1973

New Coder
I started learning to code back in april. Started with a udemy course. It became immediately apparent that the greatest difficulty in learning to code is that courses and tutorials become obsolete quickly. My first course taught me all about intents and activities which had already been replaced with fragments and the navigation component.

I have fought through building an app which has a fragment which adds a user. The users are then displayed in a recyclerview. Each view in the recyclerview has onClickListener which takes you to another fragment with a recyclerview fulll of songs that the individual user likes.

The issue is sending the userName from the first recyclerview to the repository so that it can be sent to the Data access object, so that the sqlite database can be queried to select all rows WHERE name is equal to the name provided.

In the end I want to return a list of songs which are favorites of only one user. the user who was clicked in the first recyclerview. The only piece I'm missing is sharing the data from the recyclerview press. I think I just need to figure out how to share data between fragments and the host activity, but I can't find any tutorials that are in Kotlin. I found a great one in java, but i have learned not to waste my time trying to convert as the two languages often offer completely different methods to solving problems.

Can anyone direct me to a tutorial in kotlin which teaches data sharing from a fragment to the data access object. I am pulling my hair out. I'm very close and can't get this last piece.

thanks in advance.
 

Malcolm

Administrator
Administrator
Verified
Hi there,

Welcome to Code Forum!

My advice to you in regard to learning outdated content is to keep learning (if it's more than 5 years old then try to look for newer content if possible). Get the fundamentals of the particular language then learn the new features to see perhaps why it was updated to that way etc.

I found this however I'm not sure if this is what you mean, https://developer.android.com/training/basics/fragments/communicating. I'm not familiar with Koltlin at all.
 
Top Bottom