public void onClick(View v) { CompoundButton btn = (ToggleButton) v; if (btn.getId() == R.id.MSWMfullscreen) { new runCmd().execute(Consts.VIDEO_FULLSCREEN_TOGGLE, ""); } else if (btn.getId() == R.id.MSWMplaypause) { if (btn.isChecked()) { if (firstPlay) { String rootPath = json.getRootPath(); if (rootPath == null) { json.set_context(getApplicationContext(), DEVICE_ID); rootPath = json.getRootPath(); } try { loc = loc.replace("/mnt/raid/", rootPath); new runCmd().execute(Consts.VIDEO_OPEN, loc); Thread.sleep(500); firstPlay = false; } catch (Exception e) { Log.e(Consts.LOG_TAG, "Problem with playing " + loc, e); } } try { json.UpdateSongInfo(); if (json.getIsPlaying()) { Log.v(Consts.LOG_TAG, "Stopping Music to play Video"); new runCmd().execute(Consts.MUSIC_STOP, ""); Thread.sleep(500); } } catch (Exception e) { } new runCmd().execute(Consts.VIDEO_PLAY, ""); } else { new runCmd().execute(Consts.VIDEO_PAUSE, ""); } } };