Open bxute opened 6 years ago
This is due to incorrect state of favourite button.
While setting data in DetailsActivity
you should first check whether the movie already favourited or not.
If it is favourited you should turn favourite button coloured(indicating the favourite). When the user clicks in this state, movie should be removed from favourite.
If its not Then you should keep the normal button. When the user clicks in this state, movie should be added to favourite.
You should learn to add Log.d
statements in correct places for debugging.
To debug cast and other data, put Log before and after passing data.
In DetailActivity.java
LikeButton likeButton = findViewById(R.id.fav_button);
SharedPreferences sharedPreferences = PreferenceManager
.getDefaultSharedPreferences(getApplicationContext());
//get all the favorited movie list
//check if the current movie is in the list or not.
// If it is then call method
likeButton.setLiked(true);
//else
likeButton.setLiked(false);
I can't retrieve any cast data and review data, after I added to favorite movies.
As i can see, casts and reviews are loaded. Logic
Loading cast and reviews require id
right ?
You are getting id
in DetailActivity
from Intent.
It is being received correctly, so there is not issue in it.
Again you are having the same issue with
DetailsActivity
. You are trying to use only the last segment of image url.Solution You need to prefix the root url like
So have the change in
DetailsActvity