@SuppressLint("NewApi") @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.avideo); if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH) { if (!BuildVars.debug) { getWindow().setFlags(LayoutParams.FLAG_SECURE, LayoutParams.FLAG_SECURE); } } NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); mNotificationManager.cancelAll(); prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); title = (TextView) findViewById(R.id.tvVtitle); reports = new Reports(getApplicationContext(), "Training"); mtitle = (TextView) findViewById(R.id.mtitle); icon = (ImageView) findViewById(R.id.miconimage); detail = (TextView) findViewById(R.id.tvVDetail); from = (TextView) findViewById(R.id.tvVFrom); summary = (TextView) findViewById(R.id.tvVsummary); vfullscreenplay = (ImageView) findViewById(R.id.vfullscreenplay); vid = (com.sanofi.in.mobcast.CustomVideoView) findViewById(R.id.vvType); mtitle.setText("Training"); icon.setImageResource(R.drawable.training); // share = (Button) findViewById(R.id.bVshare); vid.setOnPreparedListener(this); btn = (ImageView) findViewById(R.id.vbackground); play = (ImageView) findViewById(R.id.vbackgroundplay); play.setOnClickListener(BackgroundclkListener); if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH) { play.setAlpha(0.7f); } btn.setOnClickListener(BackgroundclkListener); share = (Button) findViewById(R.id.iv6); onNewIntent(getIntent()); share.setOnTouchListener( new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { // TODO Auto-generated method stub if (event.getAction() == android.view.MotionEvent.ACTION_DOWN) { if (android.os.Build.VERSION.SDK_INT >= 11) { v.setAlpha(0.5f); } // v.getBackground().setAlpha(45); } else if (event.getAction() == android.view.MotionEvent.ACTION_UP) { if (android.os.Build.VERSION.SDK_INT >= 11) { v.setAlpha(1); } // v.getBackground().setAlpha(255); } return false; } }); vfullscreenplay.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub // isToRate = true; vid.pause(); time = vid.getCurrentPosition(); Log.d("Paused at ", "" + time); Intent i = new Intent(TrainingVideo.this, VideoFullscreen.class); i.putExtra("name", name); Log.d("name", name); i.putExtra("StartAt", (int) time); onDestroy(); startActivity(i); } }); detail.setText(DateUtils.formatDate(Ddetail)); share.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub reports.updateShare(aid); final Intent shareIntent = new Intent(android.content.Intent.ACTION_SEND); shareIntent.setType("video/mp4"); String shareBody = title.getText() + "\n" + from.getText() + "\n ON: " + detail.getText() + "\n" + summary.getText(); shareIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, title.getText()); prefs.edit().putInt("StartAt", vid.getCurrentPosition()).commit(); shareIntent.putExtra(android.content.Intent.EXTRA_TEXT, shareBody); shareIntent.putExtra(android.content.Intent.EXTRA_STREAM, Uri.fromFile(file)); startActivity(Intent.createChooser(shareIntent, "Share video")); } }); String roo1t = Environment.getExternalStorageDirectory().toString() + Constants.APP_FOLDER_VIDEO + name; Bitmap thumbnail = ThumbnailUtils.createVideoThumbnail(roo1t, MediaStore.Images.Thumbnails.MINI_KIND); BitmapDrawable bitmapDrawable = new BitmapDrawable(thumbnail); vid.setBackgroundDrawable(bitmapDrawable); // btn.setBackgroundDrawable(bitmapDrawable); btn.setImageDrawable(bitmapDrawable); vid.setVideoPath(roo1t); mc = new MediaController(this); mc.show(500000); mc.setAnchorView(vid); vid.setMediaController(mc); vid.requestFocus(); // vid.setPlayPauseListener(ppl); }