Hello fellow programmers,
I'm experiencing some issues regarding my Android App, i'm currently working on. For this purpose, I only need to mention that I have two Activities (One is called MainActivity.class and the second is called FilterActivity.class).
The purpose of my MainActiviy class is to display a movie (Genres, year, rating etc) + a trailer of the specifik video.
In the OnCreate method for MainActiviy, im initializing the YouTubePlayerView (since I want a random movie to pop up as soon as you open the application).
The purpose of my FilterActivity class is to choose some specfik search criterias for a movie.
I'm opening FilterActivity from MainActivity like this:
public void openFilter(){
Intent askIntent = new Intent(this, FilterActivity.class);
startActivityForResult(askIntent, 1); }
And in my FilterActivity im sending the information from a newly created movie like this:
movieIntent.putExtra("url", a.getUrl());
movieIntent.putExtra("title", a.getTitle());
movieIntent.putExtra("rating", (String.valueOf(a.getRating())));
movieIntent.putExtra("plot", a.getDesc());
movieIntent.putExtra("year", (String.valueOf(a.getYear())));
movieIntent.putExtra("genre", a.getGenres());
setResult(RESULT_OK, movieIntent);
finish();
And this is how I fetch data from MainActivity:
protected void onActivityResult(int requestCode, int resultCode, final Intent data){
if(resultCode == RESULT_OK){
titleView.setText(data.getStringExtra("title"));
ratingView.setText(data.getStringExtra("rating"));
plotView.setText(data.getStringExtra("plot"));
yearView.setText(data.getStringExtra("year"));
genreView.setText(data.getStringExtra("genre"));
url = data.getStringExtra("url"); }
This is basically what I need to show. (This is all works by the way): I'm getting a newly created movie and the criterias match.
However, in the OnActivityResult, I can't get my YoutubePlayerView to re-load the video with the specific URL. The old video is still there, and playable. I have checked and I am indeed getting a new URL from the FilterActivity.
The only way I'm coming around this issue is by basically reloading the activity, and then (since im creating a random movie in my OnCreate method), the criteria don't match.
Any suggestions would be appreciated!
Sincerely