Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You just need to implement MediaScannerConnectionClient in your activity and after that you have to give the exact path of one of the file inside that folder name here as SCAN_PATH and it will scan all the files containing in that folder and open it inside built in gallery. So just give the name of you folder and you will get all the files inside including video. If you want to open only images change <code>FILE_TYPE="image/*"</code></p> <pre><code>public class SlideShow extends Activity implements MediaScannerConnectionClient { public String[] allFiles; private String SCAN_PATH ; private static final String FILE_TYPE = "*/*"; private MediaScannerConnection conn; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); File folder = new File("/sdcard/yourfoldername/"); allFiles = folder.list(); SCAN_PATH=Environment.getExternalStorageDirectory().toString()+"/yourfoldername/"+allFiles[0]; Button scanBtn = (Button) findViewById(R.id.scanBtn); scanBtn.setOnClickListener(new OnClickListener() { public void onClick(View v) { startScan(); } }); } private void startScan() { if(conn!=null) { conn.disconnect(); } conn = new MediaScannerConnection(this, this); conn.connect(); } public void onMediaScannerConnected() { conn.scanFile(SCAN_PATH, FILE_TYPE); } public void onScanCompleted(String path, Uri uri) { try { if (uri != null) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(uri); startActivity(intent); } } finally { conn.disconnect(); conn = null; } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload