Android Cómo ver doc de sdcard en gallary?
Tengo la aplicación en la que el usuario puede buscar la imagen, audio, vídeo, archivo doc de sdcard y elegir 1 archivo para cargarlo en el servidor. Usando debajo del código puedo abrir la galería y seleccionar la imagen, el audio, el vídeo Pero no tengo idea que cómo buscar el doc de la galería.
Aquí está mi código.
- No se puede guardar ni cargar entero con las preferencias
- Cómo guardar el archivo desde el sitio web a sdcard
- Cómo abrir un archivo PDF local en PhoneGap (android)
- creando un drawable de la tarjeta del SD para fijar como fondo en android
- Necesita ayuda para emular el Samsung Galaxy Nexus con AVD
Intent intent = new Intent(); intent.setAction(Intent.ACTION_GET_CONTENT); //intent.setType("video/*"); //intent.setType("audio/*"); //intent.setType("image/*"); //**What I have to do for view document[.pdf/text/doc] file** startActivityForResult(Intent.createChooser(intent, "Complete action using"), REQUEST_CODE);
¿Alguien tiene alguna idea de cómo se puede lograr esto? Cualquier ayuda es muy apreciada.
- Android: carga la fuente personalizada en la tarjeta SD
- ACTION_GET_CONTENT: ¿Cómo obtener el fin del archivo al buscar varios tipos de archivo?
- Carga dibujable desde la tarjeta sd
- ¿Cómo se hace un apk crear un archivo en el sdcard cuando el apk está instalado?
- Android: ubicación absoluta de la tarjeta SD externa
- Android abrir o crear base de datos
- Mostrar toda la música en la tarjeta SD
- Abrir un archivo de texto de 12kb toma WAY demasiado tiempo ...?
Prueba esta biblioteca aFileChooser su trabajo bien
Pls ver este enlace
Espero que esto le ayude a abrir un documento
public void openDOC(String name) { File file = new File(Environment.getExternalStorageDirectory() + "/" + bmodel.getUserMasterBO().getUserid() + "/" + name); if (file.exists()) { Uri path = Uri.fromFile(file); Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(path, "application/msword"); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); try { startActivity(intent); } catch (ActivityNotFoundException e) { Toast.makeText(this, "No Application Available to View DOC", Toast.LENGTH_SHORT).show(); } } }
Intente lo siguiente,
File docfolder = new File(Environment.getExternalStorageDirectory() + "/" + "Documents/"); File docList[] = docfolder.listFiles(); for(int i=0;i<docList.length;i++) { if (docList[i].exists()) { Uri path = Uri.fromFile(docList[i]); Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(path, "application/msword"); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); try { startActivity(intent); } catch (ActivityNotFoundException e) { } } }
- Mejor implementación de Rotate3dAnimation en Android ViewFlipper
- Datos de basura transmitidos en conexión WiFi TCP desde el escritorio a Android