0
I need my Listview items with more Ikes to appear first in my feed, how do I do that? follows image of firebase structure
My Adapter
@NonNull
@Override
public View getView(final int position, @Nullable View
convertView, @NonNull ViewGroup parent) {
LayoutInflater inflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
autenticacao = FirebaseAuth.getInstance();
@SuppressLint("ViewHolder") View v =
inflater.inflate(R.layout.image_item, parent, false);
imgList = new ArrayList<>();
mDatabaseRef =
FirebaseDatabase.getInstance().getReference("videos/");
Query myTopPostsQuery = mDatabaseRef.orderByChild("videos");
myTopPostsQuery.addValueEventListener(new ValueEventListener()
{
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
//Fetch image data from firebase database
for (DataSnapshot snapshot :
dataSnapshot.getChildren()) {
VideoUpload video =
snapshot.getValue(VideoUpload.class);
string = video.getUrl();
}
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
});
I don’t quite understand, but thanks for your help
– Paiva