read data firebase and display on ListView [on hold]

Multi tool use
Multi tool use


read data firebase and display on ListView [on hold]



MY Database (Firebase) Can You Help Me Fix This ?
I tried it but it does not appear in List view, is there Something wrong ? Help Me. im Stack in here
...............................................................................................................................................................................................................................................................................................................................................................................................


package com.tracking.rahadiansyah.tracking;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.Toast;

import com.google.firebase.database.ChildEventListener;
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 java.util.ArrayList;

public class history1 extends AppCompatActivity {

ListView listView;
FirebaseDatabase firebaseDatabase;
DatabaseReference databaseReference;
ArrayList<String> arrayList = new ArrayList<>();
ArrayAdapter<String> arrayAdapter;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_history1);

firebaseDatabase = FirebaseDatabase.getInstance();
databaseReference = firebaseDatabase.getReference().child("proyek-akhir-c93d7").child("1").child("xlog");

listView = (ListView) findViewById(R.id.listview);

Toast.makeText(this, "Tunggu Sebentar", Toast.LENGTH_SHORT).show();
databaseReference.addChildEventListener(new ChildEventListener() {
@Override
public void onChildAdded(DataSnapshot dataSnapshot, String s) {
String value=dataSnapshot.getValue(String.class);
arrayList.add(value);
arrayAdapter = new ArrayAdapter<String>(history1.this, android.R.layout.simple_list_item_1, arrayList);
listView.setAdapter(arrayAdapter);

}

@Override
public void onChildChanged(DataSnapshot dataSnapshot, String s) {

}

@Override
public void onChildRemoved(DataSnapshot dataSnapshot) {

}

@Override
public void onChildMoved(DataSnapshot dataSnapshot, String s) {

}

@Override
public void onCancelled(DatabaseError databaseError) {

}
});

}}



Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.





Have u tried anything?
– Prashant Pimpale
Jul 1 at 4:54





I've tried all the ways but no one can, do you have reference about that
– rahadiansyah al fauzan
Jul 1 at 4:58






Firebase: Retrieve Data
– Arman Charan
Jul 1 at 4:58


Firebase: Retrieve Data





firebase.google.com/docs/reference/android/com/google/firebase/…
– Prashant Pimpale
Jul 1 at 4:59





for Java or Javascript?
– Prashant Pimpale
Jul 1 at 5:01




GueNyWRgog95H6CagQT1XGP kcJ 7QHO 19CHkSSuAGQ3q2fQ
ltdsfsabU2uVGy 0xQAFyB9J9O TAKYJpEefPwS4oFtE

Popular posts from this blog

PySpark - SparkContext: Error initializing SparkContext File does not exist

django NoReverseMatch Exception

List of Kim Possible characters