Bonjour , je suis débutant en android mais encore plus avec firebase donc j'aurais besions de conseil pour résoudre mon problème : Je veux réaliser une barre de recherche (avec le composant searchView) qui parcours ma base de données firebase et qui me ressort le une information
voici la structure de ma bdd :
app :
produit :
clef unique :
nom:coca
prix:0.85
date:10/10/2018
mon code :
j'ai également une classe produit :
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
61
62
63
64
65
66
67 public class pp extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_pp); //récupération des différents composants //final EditText edtRecherche = (EditText) findViewById(R.id.edtRecherche); TextView txtRecherche = (TextView) findViewById(R.id.txtRecherche); // Button btnCherche = (Button) findViewById(R.id.btnCherche); ImageButton imgBtnScan = (ImageButton) findViewById(R.id.imgBtnScan); Button btnAjoutP = (Button) findViewById(R.id.btnAjoutP); Button btnDeco = (Button) findViewById(R.id.btnDeco); Button btnContact = (Button) findViewById(R.id.btnContact); ListView listViewResultat = (ListView) findViewById(R.id.listViewResultat); final Button btnLi = (Button) findViewById(R.id.btnLi); //Modification des différents composants txtRecherche.setText("Entrer le nom d'un produit :"); btnDeco.setText("Deconnexion"); btnContact.setText("Contact"); //Créer les Intents final Intent IntDeco = new Intent(this, connexion.class); final Intent IntScan = new Intent(this, scan.class); final Intent IntAjout = new Intent(this, ajoutProduit.class); final Intent IntConatct = new Intent(this,contact.class); final Intent IntLi = new Intent(this,ListeStock.class); btnLi.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { startActivity(IntLi); } }); imgBtnScan.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { startActivity(IntScan); } }); btnAjoutP.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { startActivity(IntAjout); } }); btnDeco.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { startActivity(IntDeco); } }); btnContact.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { startActivity(IntConatct); } }); } }
merci d'avance pour votre temps et votre aide !
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 public class Produit { private String id; private String nomP; private double prix; private int quantite; private String dateExpi; private String cip13; private String numLot; public Produit(){} public Produit (String id,String nomP,double prix,String dateExpi,int quantite,String cip13,String numLot){ this.nomP = nomP; this.prix = prix; this.quantite = quantite; this.dateExpi = dateExpi; this.cip13 = cip13; this.numLot = numLot; this.id = id; } public void setNomP(String nouvNomP){ this.nomP = nouvNomP; } public void setQuantite(int nouvQuantite){ this.quantite = nouvQuantite; } public void setPrix(double nouvPrix){ this.prix = nouvPrix; } public void setDateExpi(String nouvDate){ this.dateExpi = nouvDate; } public void setCip13(String nouvCip){ this.cip13 = nouvCip; } public void setNumLot(String nouvNumLot){ this.numLot = nouvNumLot; } public String getNomP (){ return this.nomP; } public double getPrix(){ return this.prix; } public int getQuantite(){ return this.quantite; } public String getDateExpi(){ return this.dateExpi; } public String getCip13(){ return this.cip13; } public String getNumLot(){ return this.numLot; } }![]()
Partager