get Video File Intent - Android Intent

Android examples for Intent:Open File

Description

get Video File Intent

Demo Code


//package com.java2s;

import android.content.Intent;

import android.net.Uri;
import java.io.File;

public class Main {

    public static Intent getVideoFileIntent(String param) {

        Intent intent = new Intent("android.intent.action.VIEW");
        intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
        intent.putExtra("oneshot", 0);
        intent.putExtra("configchange", 0);
        Uri uri = Uri.fromFile(new File(param));
        intent.setDataAndType(uri, "video/*");
        return intent;
    }/*from   w  w w.j a  v  a2 s  .co m*/
}

Related Tutorials