getting details of movies from OMDB API android-ThrowExceptions

Exception or error:
      AsyncHttpClient client = new AsyncHttpClient();
       btnSearch.setOnClickListener( new View.OnClickListener() {
           @Override
           public void onClick(View v) {
               EditText edtName = findViewById( R.id.edtName );
               AsyncHttpClient client = new AsyncHttpClient();
               String name = edtName.getText().toString();
               String url = "http://www.omdbapi.com/?i="+name+" &apikey=";
               client.get(url, new  JsonHttpResponseHandler() {
                   public void onSuccess(int statusCode, Header[] headers, JSONObject response) {
                       try {
                           title.setText( response.getString( "Title" ) );
                           year.setText( response.getString( "Year" ) );
                           genre.setText( response.getString( "Genre" ) );
                           director.setText( response.getString( "Director" ) );
                           writer.setText( response.getString( "Writer" ) );
                           actors.setText( response.getString( "Actors" ) );
                           plot.setText( response.getString( "Plot" ) );
                           lang.setText( response.getString( "Language" ) );
                           country.setText( response.getString( "Country" ) );
                           poster.setText( response.getString( "Poster" ) );
                           awards.setText( response.getString( "Awards" ) );
                           rating.setText( response.getString( "Rating" ) );
                           website.setText( response.getString( "Website" ) );
                       } catch (JSONException e) {
                           e.printStackTrace();
                       }
                   }
                   public void onFailure(int statusCode, Header[] headers, String responseString, Throwable throwable) {
                   }
               });
           }
       });
    }
}

enter image description here

This is my project. when i type movie name and click on search button, i want to show details of movies from omdb api,but it shows nothing.why?

How to solve:

Leave a Reply

Your email address will not be published. Required fields are marked *