Aller au contenu
View in the app

A better way to browse. Learn more.

Forum de Frandroid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Accès a des fichiers contenus dans /res/raw/

Featured Replies

Posté(e)

Bonjour @tous,

Je travaille actuellement 2 projets sur lesquels, je télécharge des données en http, sur l'un des 2 projets, le téléchargement n'est pas une super solution (appli pour désimlocker).

Du coup je pense mettre les fichiers dont j'ai besoin dans /res/raw/ mais je ne comprends absolument pas comment les récupérer.

Si quelqu'un saurait m'éclairer sur ce point?

En vous remerciant par avance

Helroz

Posté(e)
  • Auteur

oki, merci pour l'info, j'y regarde des que j'ai un peu de temps libre ;)

Posté(e)
  • Auteur

c'est parfait, merci pour les infos, tout fonctionne parfaitement, j'ai plus qu'a re-coder mon appli pour utiliser les fichiers au lieu de l'internet ;)

Encore merci :D

Pour info si quelqu'un a besoin:

InputStream myInput = this.getResources().openRawResource(R.raw.mon_fichier_raw);

//mon fichier de sortie ici extrait sur la SD dans le répertoire download

String outFileName = Environment.getExternalStorageDirectory() + "/download/mon_fichier_de_sortie";

OutputStream myOutput;

try {

myOutput = new FileOutputStream(outFileName);

byte[] buffer = new byte[1024];

int length;

while ((length = myInput.read(buffer))>0){

myOutput.write(buffer, 0, length);

}

myOutput.flush();

myOutput.close();

myInput.close();

} catch (FileNotFoundException e) {

e.printStackTrace();

} catch (IOException e) {

e.printStackTrace();

}

Modifié par helroz

Archivé

Ce sujet est désormais archivé et ne peut plus recevoir de nouvelles réponses.

Account

Navigation

Rechercher

Rechercher

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.