title: How to show video url from external database(mysql) in android?
body: <p>I have a project android app stream video from video url is saved in database. But I dont know how to show video from video url in database? Please, help me.... :)</p>
  
  <pre><code>public class PlayerActivity extends Activity {
  
  private stream stream;
  private ServerRequest server;
  private Object newString;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_player);
      stream = new stream();
      server = new ServerRequest();
      if (savedInstanceState == null) {
          Bundle extras = getIntent().getExtras();
          if(extras == null) {
              newString= null;
          } else {
              newString= extras.getString("alamat");
          }
      } else {
          newString= (String) savedInstanceState.getSerializable("alamat");
      }
      final VideoView vid = (VideoView) findViewById(R.id.videoView);
      Uri video = Uri.parse(server.sendGetRequest(ServerRequest.urlSelectAll+"?id="+stream.getId().toString()));
      vid.setVideoURI(video);
      MediaController hhh = new MediaController(this);
      vid.setMediaController(hhh);
      vid.requestFocus();
      vid.start();
  
  }
  
  
  
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
      getMenuInflater().inflate(R.menu.menu_main, menu);
      return true;
  }
  </code></pre>
  
  <p>I want to play video when I click from list view, this list view from my database where in my database table have 2 coloumn : video name and video url. This my main activity for list view</p>
  
  <pre><code>public class MainActivity extends Activity {
  private static final String TAG = "MainActivity";
  private ListView listView;
  private ActionMode actionMode;
  private ActionMode.Callback amCallback;
  private ProgressDialog progressDialog;
  private ServerRequest serverRequest;
  private List&lt;stream&gt; list;
  private ListAdapterStream adapter;
  private stream selectedList;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
      serverRequest = new ServerRequest();
      listView = (ListView) findViewById(R.id.listview_main);
      list = new ArrayList&lt;stream&gt;();
      /** melakukan load data melalui AsyncTask */
      new MainActivityAsync().execute("load");
  }
  
  
  
  
  
  private List&lt;stream&gt; processResponse(String response){
      List&lt;stream&gt; list = new ArrayList&lt;stream&gt;();
      try {
          JSONObject jsonObj = new JSONObject(response);
          JSONArray jsonArray = jsonObj.getJSONArray("stream");
          Log.d(TAG, "data lengt: "+jsonArray.length());
          stream str = null;
          for(int i = 0; i &lt; jsonArray.length(); i++){
              JSONObject obj = jsonArray.getJSONObject(i);
              str = new stream();
              str.setId(obj.getInt("id"));
              str.setVideo(obj.getString("video"));
              str.setAlamat(obj.getString("alamat"));
              list.add(str);
          }
      } catch (JSONException e) {
          Log.d(TAG, e.getMessage());
      }
      return list;
  }
  
  private void populateListView(){
      adapter = new ListAdapterStream(getApplicationContext(), list);
      listView.setAdapter(adapter);
      listView.setOnItemLongClickListener(new OnItemLongClickListener() {
  
          @Override
          public boolean onItemLongClick(AdapterView&lt;?&gt; adapterView, View v, int pos, long id) {
              if(actionMode != null){
                  return false;
              }
              actionMode = startActionMode(amCallback);
              v.setSelected(true);
              selectedList = (stream) adapter.getItem(pos);
              return true;
          }
  
      });
  
      listView.setOnItemClickListener(new OnItemClickListener() {
  
          @Override
          public void onItemClick(AdapterView&lt;?&gt; adapterView, View v, int pos,
                                  long id) {
              selectedList = (stream) adapter.getItem(pos);
              Intent in = new Intent(getApplicationContext(), PlayerActivity.class);
              in.putExtra("id", selectedList.getId().toString());
              in.putExtra("alamat", selectedList.getAlamat());
              startActivity(in);
          }
      });
  
  
  
  }
  
  private class MainActivityAsync extends AsyncTask&lt;String, Void, String&gt;{
  
      @Override
      protected void onPreExecute() {
          progressDialog = new ProgressDialog(MainActivity.this);
          progressDialog.setMessage("retrieving...");
          progressDialog.setIndeterminate(false);
          progressDialog.setCancelable(false);
          progressDialog.show();
      }
  
      @Override
      protected String doInBackground(String... params) {
  
              /** Mengirimkan request ke server dan memproses JSON response */
              String response = serverRequest.sendGetRequest(ServerRequest.urlSelectAll);
              list = processResponse(response);
  
          return null;
      }
  
      @Override
      protected void onPostExecute(String result) {
          progressDialog.dismiss();
          runOnUiThread(new Runnable() {
              @Override
              public void run() {
                  populateListView();
              }
          });
      }
    }
  }
  </code></pre>