Here is my code.
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_list);
mRef = FirebaseDatabase.getInstance().getReference();
list = (ListView)findViewById(R.id.listview);
final ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_1,
android.R.id.text1);
list.setAdapter(adapter);
DatabaseReference reference_contacts = FirebaseDatabase.getInstance().getReference("商品");
reference_contacts.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
adapter.clear();
for (DataSnapshot ds : dataSnapshot.getChildren() ){
adapter.add(ds.child("titles").getValue().toString());
}
}
@Override
public void onCancelled(DatabaseError error) {
Log.w(TAG, "Failed to read value.", error.toException());
}
});
This is my code, I want the text to be clickable and change from one page to another page. What should I do?