title: How to embed the SoundCloud player in Android?
body: <p>I want to embed the SoundCloud player to play SoundCloud URL in my android app.</p>
  
  <p>I had tried to use SoundCloud Java API wrapper. But that thing is giving me an error when I try to get the track:</p>
  
  <p>This line causes the error</p>
  
  <pre><code> HttpResponse trackResp = wrapper.get(Request.to("/tracks/60913196"));
  </code></pre>
  
  <blockquote>
    <p>Error - 13781-13781/ com.example.DDS.soundcloud E/Trace﹕ error opening
    trace file: No such file or directory (2)</p>
  </blockquote>
  
  <p>If anyone is having the working project of Soundcloud player in an android app. I request you to please share the project.</p>
  
  <p><strong>This is my present code.</strong></p>
  
  <pre><code>String id = getResources().getString(R.string.sc_client_id);
  String secret = getResources().getString(R.string.sc_client_secret);
  ApiWrapper wrapper = new ApiWrapper(id,secret, null, null);
  
  try {
      //Only needed for user-specific actions;
      //wrapper.login("&lt;user&gt;", "&lt;pass&gt;");
      //HttpResponse resp = wrapper.get(Request.to("/me"));
      //Get a track
      HttpResponse trackResp = wrapper.get(Request.to("/tracks/60913196"));
      //Track JSON response OK?
      if(trackResp.getStatusLine().getStatusCode() == HttpStatus.SC_OK)
      {
          JSONObject trackJSON = new JSONObject(EntityUtils.toString(trackResp.getEntity()));
          //If track is streamable, fetch the stream URL (mp3-https) and start the MediaPlayer
          if(trackJSON.getBoolean("streamable"))
          {
              HttpResponse streamResp = wrapper.get(Request.to("/tracks/60913196/stream"));
              JSONObject streamJSON = new JSONObject(EntityUtils.toString(streamResp.getEntity()));
              String streamurl = streamJSON.getString("location");
              Log.i("SoundCloud", trackJSON.getString("streamable"));
              Log.i("SoundCloud", streamurl);
              m_soundcloudPlayer.stop();
              m_soundcloudPlayer = new MediaPlayer();
              m_soundcloudPlayer.setDataSource(streamurl);
              m_soundcloudPlayer.prepare();
              m_soundcloudPlayer.start();
          }
  
      }
  }
  catch (IOException e)
  {
      // TODO Auto-generated catch block
      e.printStackTrace();
  }catch (ParseException e)
  {
      // TODO Auto-generated catch block
      e.printStackTrace();
  }
  catch (JSONException e)
  {
      // TODO Auto-generated catch block
      e.printStackTrace();
  }
  </code></pre>