vendredi 23 octobre 2015

Android One to many

I am trying to learn my ways around using Android way of doing things. So as a project I am building an app. I managed to do initial bits of layouts, forms fine. I am struck at the following.

Brief Overview I have an Author class and Book class. A book can have multiple authors and like wise an author can write multiple books.

I have working layouts and activities for Authors and Books. Data is getting saved in sqlite db. (All good here)

I also have a layout screen for adding multiple authors for a book. There is a join table that holds multiple authors ids for a book. This table (BookAuthor) has following columns(_id, bookid, authorid). Example data is(1, 2223, 43)

Problem When use enters the BookAuthor activity, they search and add multiple authors to the book. This is also working. My trouble is 1. how to display the list of authors with names that are already assigned to the book in the list view with a delete button 2. How to delete that entry from the join table when user clicks delete button for that row in the list

Can someone please point me in the right direction with good ref points or even short examples

thanks R

Aucun commentaire:

Enregistrer un commentaire