Reputation: 55
i have a listview of json data and when i click on the specific , i have tried to display the rest of the json data in a new activity by using the intent method. however, this is not working. can someone tell me what i'm doing wrong please?
my code:
Upvotes: 2
Views: 69
Reputation: 7929
Your searchResults
variable, is an ArrayList of Strings not a String.
So you need to use putStringArrayListExtra()
and getStringArrayListExtra()
instead.
eg:
In your first activity:
newActivity.putStringArrayListExtra("title", searchResults);
And in your receiving activity:
ArrayList<String> searchResults = getIntent().getStringArrayListExtra("title");
Upvotes: 2
Reputation: 17142
Change
Intent newActivity = new Intent(ResultsActivity.this, MoviePage.class);
to
Intent newActivity = new Intent(ResultsActivity.this, MovieDetails.class);
You are targeting the wrong Activity
.
the searchResults
variable contains an int, so you have to use getInt()
instead of getString()
.
Upvotes: 1