Im working with firebaseListAdapter, here I query data and it shows the new results at the bottom of my listview. what I did to bring this values to the top is as below:
@Override
public Usuarios getItem(int position) {
return super.getItem(getCount()-1-position);
}
and this is my onClick on the items
//((TextView)v.findViewById(android.R.id.text1)).setText(model.getEmail());
mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int position, long l) {
mDatabase = mAdapter.getRef(position);
Toast.makeText(MainActivity.this, ""+mDatabase.getKey(), Toast.LENGTH_SHORT).show();
Intent intent = new Intent(MainActivity.this, UserEdit.class);
intent.putExtra("uid",mDatabase.getKey());
intent.putExtra("Nombre", mAdapter.getItem(position).getNombre());
intent.putExtra("Email", mAdapter.getItem(position).getEmail());
intent.putExtra("Cars", mAdapter.getItem(position).getCars());
intent.putExtra("Planes", mAdapter.getItem(position).getPlanes());
intent.putExtra("Bus", mAdapter.getItem(position).getBus());
startActivity(intent);
}
});
this works and now I can see the values placed at the bottom in the top but the thing is the position of the items are not same. How do I fix this ?