Im using Rotten Tomatoes api and for some reason if i want to get more information about a movie like the movie director or the studio I need another http page. this is the url that im getting movie-info. from this JSON i get the id ( "self": "http://api.rottentomatoes.com/api/public/v1.0/movies/771205893.json"). and i want to use that id- i want to make another http connection to that specific url and get more information about each movie. this is the movie-info JSON:
{
"total": 591,
"movies": [{
"title": "Jack and Jill",
"year": 2011,
"runtime": "",
"release_dates": {"theater": "2011-11-11"},
"ratings": {
"critics_score": -1,
"audience_score": 90
},
"synopsis": "",
"posters": {
},
"abridged_cast": [
{
"name": "Al Pacino",
"characters": []
},
{
"name": "Adam Sandler",
"characters": []
},
{
"name": "Katie Holmes",
"characters": []
}
],
"links": {
"self": "http://api.rottentomatoes.com/api/public/v1.0/movies/771205893.json",
}
}],
This is my code:
if (response != null) {
try {
// convert the String response to a JSON object,
// because JSON is the response format Rotten Tomatoes uses
JSONObject jsonResponse = new JSONObject(response);
// fetch the array of movies in the response
JSONArray movies = jsonResponse.getJSONArray("movies");
// add each movie's title to an array
movieTitles = new String[movies.length()];
for (int i = 0; i < movies.length(); i++) {
JSONObject movie = movies.getJSONObject(i);
movieTitles[i] = movie.getString("title");
}
try {
movieId = new String[movies.length()];
for (int i = 0; i < movies.length(); i++) {
JSONObject movie = movies.getJSONObject(i);
movieId[i] = movie.getString("id");
}
After i get the movieId i want to get only the movie id that the user has pressed so i use :
public void onItemClick(AdapterView<?> arg0, View arg1,
int position, long id) {
Intent i = new Intent(getApplicationContext(),
AfterClickingMovieFromInternet.class);
i.putExtra("movieName", movieTitles[position]);
getMovieInfo( movieId[position]);
and in the getMovieInfo( movieId[position]) im trying to make a second connection to the api but for some reason it wont execute..... if anyone got any idea ill be happy to know!