-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathkullanici_islem.java
More file actions
78 lines (66 loc) · 2.88 KB
/
Copy pathkullanici_islem.java
File metadata and controls
78 lines (66 loc) · 2.88 KB
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
68
69
70
71
72
73
74
75
76
77
78
package com.example.hp.myapplication;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.ListView;
import android.widget.TextView;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;
import java.util.ArrayList;
import java.util.List;
public class kullanici_islem extends AppCompatActivity {
private ListView liste;
Adaptor ad;
final List<kullanici> uyeler=new ArrayList<kullanici>();
FirebaseDatabase database = FirebaseDatabase.getInstance();
DatabaseReference oku;
Button ekle;
TextView dene;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_kullanici_islem);
liste = (ListView) findViewById(R.id.liste);
final ListView listemiz = (ListView) findViewById(R.id.liste);
ekle = (Button) findViewById(R.id.ekle);
dene = (TextView) findViewById(R.id.dene);
oku=FirebaseDatabase.getInstance().getReference().child("kullanicilar");
ValueEventListener yaz = new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
for(DataSnapshot dataSnapshot1 : dataSnapshot.getChildren()) {
kullanici k = new kullanici();
k = dataSnapshot1.getValue(kullanici.class);
uyeler.add(new kullanici(k.isim,k.soyisim+" ",k.mac+" ",k.aktiflik_durumu+" ",k.bolum+" ",k.oda_id +" ", k.bluetooth));
ad=new Adaptor(kullanici_islem.this, uyeler);
listemiz.setAdapter(ad);
}
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
};
oku.addValueEventListener(yaz);
listemiz.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, final int i, long l) {
Intent in = new Intent(kullanici_islem.this, guncelle.class);
in.putExtra("anahtar",ad.getItem(i).getIsim().toString());
startActivity(in);
}
});
ekle.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent inte = new Intent(kullanici_islem.this, kullanici_ekle.class);
startActivity(inte);
}
});
}
}