IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Android Discussion :

Firebase - Storage : Comment afficher une image


Sujet :

Android

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre confirmé
    Femme Profil pro
    Étudiant
    Inscrit en
    Mars 2012
    Messages
    157
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : France, Loire Atlantique (Pays de la Loire)

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Mars 2012
    Messages : 157
    Par défaut Firebase - Storage : Comment afficher une image
    Bonjour,
    j'ai table catégorie créer sur firebase , j'utilise gridview pour premier affichage de mon activity avec différents list des catégories pour après choisir la liste des produits.
    Mon problème j'arrive pas a afficher les images sur mon activity je ne sais pas comment faire; voila une partie de mon code et caputre écra de firebase et l'interface.

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
     
     private static final String TAG = MainActivity.class.getSimpleName();
        private GridView gridView;
        private List<CategoryEntity> categoryEntityList;
        private DatabaseReference databaseReference;
     
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);
            categoryEntityList = new ArrayList<>();
     
            databaseReference = FirebaseDatabase.getInstance().getReference("category");
            gridView = findViewById(R.id.grid_view);
     
            gridView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
                @Override
                public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
     
                    //send the selected category id to next activity
                    Bundle b = new Bundle();
                    b.putParcelable("category", categoryEntityList.get(i));
                    Intent intent = new Intent(getApplicationContext(), ListSelonCategorie.class);
                    intent.putExtras(b);
                    startActivity(intent);
     
                }
            });
     
        }
     
        @Override
        protected void onStart() {
            super.onStart();
            databaseReference.addValueEventListener(new ValueEventListener() {
                @Override
                public void onDataChange(DataSnapshot dataSnapshot) {
                    categoryEntityList.clear();
                    for (DataSnapshot categorySnapShot : dataSnapshot.getChildren()) {
                        Log.d(TAG, "Outside  : " + categorySnapShot.child("cat_id").getValue());
                        CategoryEntity categoryEntity = new CategoryEntity();
                        categoryEntity.setCat_id(categorySnapShot.child("cat_id").getValue(Long.class));
                        categoryEntity.setCat_name(categorySnapShot.child("cat_name").getValue(String.class));
                        categoryEntity.setCat_image(categorySnapShot.child("cat_image").getValue(String.class));
                        List<ProduitEntity> produitEntityList = new ArrayList<>();
                        for (DataSnapshot productSnapShot : categorySnapShot.child("products").getChildren()) {
                            ProduitEntity produitEntity = new ProduitEntity();
                            produitEntity.setPd_id(productSnapShot.child("pd_id").getValue(Long.class));
                            produitEntity.setPd_desc(productSnapShot.child("pd_desc").getValue(String.class));
                            produitEntity.setPd_image(productSnapShot.child("pd_image").getValue(String.class));
                            produitEntity.setPd_name(productSnapShot.child("pd_name").getValue(String.class));
                            produitEntity.setPd_prix(productSnapShot.child("pd_prix").getValue(Double.class));
                            produitEntityList.add(produitEntity);
                        }
                        categoryEntity.setProducts(produitEntityList);
                        Log.d(TAG, "Categroy Data  : " + categoryEntity.toString());
                        categoryEntityList.add(categoryEntity);
                    }
                    populateGridView();
                }

    fireBase:

    Nom : fire1.PNG
Affichages : 1330
Taille : 22,0 Ko

    interface que j'obtient pour le moment :

    Nom : inter.png
Affichages : 1237
Taille : 32,0 Ko

  2. #2
    Candidat au Club
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Février 2018
    Messages
    2
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 36
    Localisation : France, Alpes Maritimes (Provence Alpes Côte d'Azur)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Février 2018
    Messages : 2
    Par défaut
    Salut,

    Un petit tour sur la doc de FireBase Storage:

    https://firebase.google.com/docs/sto...les?authuser=1

    Cordialement.

Discussions similaires

  1. Comment afficher une image à la volée via http ?
    Par reg11 dans le forum Web & réseau
    Réponses: 4
    Dernier message: 30/06/2005, 09h44
  2. [.NET][CR] Comment afficher une image blob dans un état ?
    Par moucrack dans le forum SAP Crystal Reports
    Réponses: 1
    Dernier message: 25/06/2005, 13h49
  3. Comment afficher une image en assembleur ?
    Par byte dans le forum Assembleur
    Réponses: 26
    Dernier message: 03/03/2005, 13h25
  4. Réponses: 6
    Dernier message: 22/12/2004, 11h00
  5. PL/SQL - Comment afficher une image avec HTP ?
    Par patmaba dans le forum PL/SQL
    Réponses: 2
    Dernier message: 08/07/2004, 09h28

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo