Arrange by price from Firebase (Android) - android

My goal is to arrange my products by price, wherein the lowest price would be on top. Currently, the products are being arranged according to its create date. How do I achieve my goal? Thanks in advance.
SampleActivity.java
public class SampleActivity extends AppCompatActivity {
private RecyclerView rec;
private DatabaseReference dref;
private Query dref2;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sample);
rec = (RecyclerView) findViewById(R.id.rec);
rec.setHasFixedSize(true);
rec.setLayoutManager(new LinearLayoutManager(this));
String vegmeat_type = getIntent().getExtras().get("vegmeat_type").toString();
dref = FirebaseDatabase.getInstance().getReference().child("Products");
dref2 = dref.orderByChild("name").startAt(vegmeat_type).endAt(vegmeat_type);
}
public static class FeedViewHolder extends RecyclerView.ViewHolder{
View mView;
public FeedViewHolder(View itemView){
super(itemView);
mView = itemView;
}
public void setPrice(String Price){
TextView price = (TextView) mView.findViewById(R.id.TVPrice);
price.setText(Price);
}
public void setStallname(String StallName){
TextView stallname = (TextView) mView.findViewById(R.id.TVStallName);
stallname.setText(StallName);
}
}
protected void onStart() {
super.onStart();
FirebaseRecyclerAdapter<prive, FeedViewHolder> firebaseRecyclerAdapter = new FirebaseRecyclerAdapter<prive, FeedViewHolder>(
prive.class,
R.layout.row,
FeedViewHolder.class,
dref2
) {
#Override
protected void populateViewHolder(FeedViewHolder viewHolder, prive model, int position) {
viewHolder.setPrice(model.getPrice());
viewHolder.setStallname(model.getStallname());
}
};
rec.setAdapter(firebaseRecyclerAdapter);
}
}
Here's a screenshot from my database

You can use something like this:
angularFireDB: AngularFireDatabase;
yourProducts: AngularFireList<any>;
orderedProducts: Observable<any[]>;
this.yourProducts = this.angularFireDB.list('/products');
this.orderedProducts = this.yourProducts.valueChanges().map(res => res.sort((a, b) => a.price < b.price ? -1 : 1));
You need to use AngularFireDatabase class to get your database data.

You need to do the following:
DatabaseReference ref=FirebaseDatabase.getInstance().getReference();
ref.child("Products").orderByChild("price");
more info here:
https://firebase.google.com/docs/database/android/lists-of-data#data-order

Related

How to retrieve just specific data in Recycler View using Firebase Database?

I have a problem with retrieving specific data from Firebase Realtime Database. My problem is that I want to display in RecyclerView just the materials that has the Course_ID (as you can see in the image below) equals to the Course_ID (see Course -> Teacher-Courses in Firebase). How can I accomplish that thing? I will attach the code used in the RecyclerView and the class that contains the model.
As a mention: 1.I have tried to add all the course id's from Firebase and store them to a List, but the app doesn't show anything and 2. In another class I have an Intent that sends me here and also send a extra String with Course_ID that I have accesed.
I am waiting for your responses. Thank you!
FileMaterial.class
public class FileMaterial {
private String Course_ID;
private String Denumire_material;
private String Locatie_material;
private String Teacher_ID;
public FileMaterial() {
}
public FileMaterial(String course_ID, String denumire_material, String locatie_material, String teacher_ID) {
Course_ID = course_ID;
Denumire_material = denumire_material;
Locatie_material = locatie_material;
Teacher_ID = teacher_ID;
}
public String getCourse_ID() {
return Course_ID;
}
public void setCourse_ID(String course_ID) {
Course_ID = course_ID;
}
public String getDenumire_material() {
return Denumire_material;
}
public void setDenumire_material(String denumire_material) {
Denumire_material = denumire_material;
}
public String getLocatie_material() {
return Locatie_material;
}
public void setLocatie_material(String locatie_material) {
Locatie_material = locatie_material;
}
public String getTeacher_ID() {
return Teacher_ID;
}
public void setTeacher_ID(String teacher_ID) {
Teacher_ID = teacher_ID;
}
CourseMaterial.class
public class CourseMaterial extends AppCompatActivity {
private RecyclerView recyclerView;
private DatabaseReference reference, userReference;
private FirebaseAuth mAuth;
FirebaseRecyclerOptions<FileMaterial> options;
FirebaseRecyclerAdapter<FileMaterial, CourseMaterial.FileViewHolder> adapter;
ImageView btnAddMaterial;
ImageView deleteMaterial;
StorageReference storageReference;
FirebaseStorage firebaseStorage;
String urlReference;
String value;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_course_material);
value = getIntent().getStringExtra("course id").toString();
mAuth = FirebaseAuth.getInstance();
reference = FirebaseDatabase.getInstance().getReference().child("Materials").child(mAuth.getCurrentUser().getUid());
recyclerView = findViewById(R.id.recyclerView_fileMaterials);
recyclerView.setLayoutManager(new LinearLayoutManager(getApplicationContext()));
btnAddMaterial = findViewById(R.id.addMaterials);
btnAddMaterial.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
startActivity(new Intent(CourseMaterial.this, UploadFile.class));
}
});
}
#Override
public void onStart() {
super.onStart();
options = new FirebaseRecyclerOptions.Builder<FileMaterial>().setQuery(reference, FileMaterial.class).build();
adapter = new FirebaseRecyclerAdapter<FileMaterial, FileViewHolder>(options) {
#Override
protected void onBindViewHolder(#NonNull final FileViewHolder fileViewHolder, int i, #NonNull final FileMaterial fileMaterial) {
fileViewHolder.denumire_material.setText(fileMaterial.getDenumire_material());
}
#NonNull
#Override
public FileViewHolder onCreateViewHolder(#NonNull ViewGroup parent, int viewType) {
View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.youtube_view,parent, false);
FileViewHolder fileViewHolder = new FileViewHolder(v);
return fileViewHolder;
}
};
adapter.startListening();
recyclerView.setAdapter(adapter);
}
public static class FileViewHolder extends RecyclerView.ViewHolder{
TextView denumire_material, dataMaterial;
ImageView deleteMaterial;
public FileViewHolder(#NonNull View itemView) {
super(itemView);
denumire_material = itemView.findViewById(R.id.txtDenMaterial);
deleteMaterial = itemView.findViewById(R.id.imgDeleteMaterial);
}
}
Maybe make a query and pass it to the options of the adapter:
#Override
public void onStart() {
super.onStart();
Query query = reference.orderByChild("Course_ID").equalTo(value);
options = new FirebaseRecyclerOptions.Builder<FileMaterial>().setQuery(query, FileMaterial.class).build();
.......
.......
.......

Retrieve Image and name from firebase database in recycler view [duplicate]

everyone, I was trying to make a music app, and for this, I Created a Horizontal RecyclerView in my HomeFragment and my horizontal RecyclerView is getting an image with artist name.
But after clicking I load another Activity. In my other activity, I was trying to load SongsData from firebase in a listView with RecyclerView.
But the problem is I am not getting data from Firebase and it is returning null data. I provided my code below and here is the screenshot of my Firebase database:- ScreenShot
My List Class:-
public class TestUploads
{
private String songName;
private String songImageUri;
private String songUrl;
private String artistName;
public TestUploads() {
}
public String getSongName() {
return songName;
}
public void setSongName(String SongName) {
this.songName = SongName;
}
public String getSongImageUri() {
return songImageUri;
}
public void setSongImageUri(String SongImageUri) {
this.songImageUri = SongImageUri;
}
public String getSongUrl() {
return songUrl;
}
public void setSongUrl(String SongUrl) {
this.songUrl = songUrl;
}
public TestUploads(String SongImageUri, String SongName, String SongUrl ) {
this.songName = SongName;
this.artistName = SongImageUri;
this.songUrl = SongUrl;
}
}
My Adapter Class:-
public class TestAdapter extends RecyclerView.Adapter<TestAdapter.TestViewHolder>{
private Context mContext;
private List<TestUploads> mUploads;
public TestAdapter(Context context , List<TestUploads> uploads) {
mContext = context;
mUploads = uploads;
}
#NonNull
#Override
public TestViewHolder onCreateViewHolder(#NonNull ViewGroup parent, int viewType) {
View v = LayoutInflater.from(mContext).inflate(R.layout.test_package_layout , parent ,false);
return new TestViewHolder(v);
}
#Override
public void onBindViewHolder(#NonNull TestViewHolder holder, int position) {
TestUploads uploadcurrent = mUploads.get(position);
holder.name.setText(uploadcurrent.getSongName());
Glide.with(mContext)
.load(uploadcurrent.getSongImageUri())
.into(holder.image_view);
}
#Override
public int getItemCount() {
return mUploads
.size();
}
public class TestViewHolder extends RecyclerView.ViewHolder {
public TextView name;
public TextView artist_name;
public CircleImageView image_view;
public TestViewHolder(#NonNull View itemView) {
super(itemView);
name = itemView.findViewById(R.id.test_package_song_name);
artist_name = itemView.findViewById(R.id.test_package_artist_name);
image_view = itemView.findViewById(R.id.test_package_image_name);
}
}
}
My Activity:-
public class TestActivity extends AppCompatActivity {
private ValueEventListener listener;
private DatabaseReference reference;
private List<TestUploads> mUploads;
private RecyclerView mRecyclerView;
private TestAdapter adapter;
#Override
protected void onCreate(#Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.test_package_activity);
reference = FirebaseDatabase.getInstance().getReference("ArtistView").child(getIntent().getStringExtra("Artist"))
.child("Songs");
Toast.makeText(this, "" + getIntent().getStringExtra("Artist"), Toast.LENGTH_SHORT).show();
mUploads = new ArrayList<>();
mRecyclerView = findViewById(R.id.test_pacakge_recyclerView);
mRecyclerView.setHasFixedSize(true);
mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
mRecyclerView.smoothScrollToPosition(0);
adapter = new TestAdapter(this , mUploads);
mRecyclerView.setAdapter(adapter);
listener = reference.addValueEventListener(new ValueEventListener() {
#Override
public void onDataChange(#NonNull DataSnapshot dataSnapshot) {
mUploads.clear();
for (DataSnapshot postSnapshot : dataSnapshot.getChildren()) {
TestUploads uploads =postSnapshot.getValue(TestUploads.class);
mUploads.add(uploads);
}
adapter.notifyDataSetChanged();
}
#Override
public void onCancelled(#NonNull DatabaseError databaseError) {
}
});
}
}
Sorry for so much code but this is not hard to solve. If you find the solution please reply to me. Thanks for reading this.
The problem in your code lies in the fact that the names of the fields in your TestUploads class are different than the name of the properties in your database. You have in your TestUploads class a field named songName but in your database, I see it as SongName and this is not correct. The names must match. When you are using a getter named getSongName(), Firebase is looking in the database for a field named songName and not SongName. See the lowercase s letter vs. capital letter S?
There are two ways in which you can solve this problem. The first one would be to remove the data in your database and add it again using field names that start with lowercase, as exist in your TestUploads class.
If you are not allowed to use the first solution, then the second approach will be to use annotations. So you should use the PropertyName annotation in front of the getters. So in your TestUploads class, a getter should look like this:
#PropertyName("SongName")
public String getSongName() {
return songName;
}

Recycleview for Firebase nested child unable to show

I am trying to populate view of nested child from a user's rewards, but I am unable to show anything out on my android App. Any advice on how do I proceed with it? Please see below regarding the codes iIhave coded so far.
My model
public class myrewards{
String barImg;
public myrewards()
{
}
public myrewards(String barImg) {
this.barImg = barImg;
}
public String getBarImg() {
return barImg;
}
public void setBarImg(String barImg) {
this.barImg = barImg;
}
}
My Viewholder
public class RewardViewHolder extends RecyclerView.ViewHolder{
View mView;
public RewardViewHolder(#NonNull View itemView) {
super(itemView);
mView = itemView;
}
public void setRewardDetail(Context ctx, String barImg)
{
ImageView rImg = mView.findViewById(R.id.rImage);
Picasso.with(ctx).load(barImg).into(rImg);
}
}
My Main Activity
public class MyRewardsActivity extends AppCompatActivity {
private static final String TAG = MyRewardsActivity.class.getSimpleName();
private RecyclerView rRecycleView;
private DatabaseReference myReward, userRef, voucherRef;
private FirebaseAuth mAuth;
private String userID;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_my_rewards);
ActionBar actionBar = getSupportActionBar();
actionBar.setTitle("My Rewards");
rRecycleView = findViewById(R.id.my_reward);
rRecycleView.setHasFixedSize(true);
rRecycleView.setLayoutManager(new LinearLayoutManager(this));
mAuth = FirebaseAuth.getInstance();
userID = mAuth.getCurrentUser().getUid();
myReward = FirebaseDatabase.getInstance().getReference().child("User").child(userID);
userRef = FirebaseDatabase.getInstance().getReference().child("User").child(userID);
System.out.println("YOUR REWARD= " + myReward);
}
#Override
protected void onStart() {
super.onStart();
final FirebaseRecyclerAdapter<myrewards, RewardViewHolder> firebaseRecyclerAdapter =
new FirebaseRecyclerAdapter<myrewards, RewardViewHolder>
(
myrewards.class,
R.layout.barrewards,
RewardViewHolder.class,
myReward
)
{
#Override
protected void populateViewHolder(RewardViewHolder viewHolder, myrewards model, int position) {
viewHolder.setRewardDetail(getApplicationContext() ,model.getBarImg());
}
};
rRecycleView.setAdapter(firebaseRecyclerAdapter);
}
}
Image shown below:
I am not sure whether I used the correct way to code as I been using this way to retrieve my other data( which are not nested child) from my database, really appericate any helps and thank you in advance.

Sort data Decreasing - Firebase Query [duplicate]

This question already has an answer here:
Sort firebase data in descending order using negative timestamp
(1 answer)
Closed 5 years ago.
I have a database structure like this (sample):
ID_EMPRESA
-name:
-adress:
-status: Aberto
-timestamp: 0154254521
-status_timestamp: Aberto_0154254521
I need to populate my RecyclerView with data from a Firebase reference
Since it is not possible to work with multiple queries when querying Firebase data, according to the structure of the database I tried the following filter:
mDatabase.child(ID_EMPRESA).orderByChild("status_timeStamp").startAt("Open").endAt("Open\uf8ff")
So I retrieve the data that has status: Open
Code RecyclerDapter:
FirebaseRecyclerAdapter<CardPedidos_row, CardPedidosViewHolder> firebaseRecyclerAdapter = new FirebaseRecyclerAdapter<CardPedidos_row, CardPedidosViewHolder>(
CardPedidos_row.class,
R.layout.card_agendamentos_row,
CardPedidosViewHolder.class,
mDatabase.child(ID_EMPRESA).orderByChild("status_timeStamp").startAt("Open").endAt("Open\uf8ff")
)
How could I recover the data in descending order, since it already has the timestamp stored.
As it is, it is bringing Ascending
FullCode - Fragment:
public class PedidosTab1 extends Fragment {
private RecyclerView mCardPedidos;
private DatabaseReference mDatabaseEmpresa;
private DatabaseReference mDatabaseAgendamentos;
private FirebaseAuth mAuth;
private FirebaseUser mCurrentUser;
private TextView mTextPadrao;
private Query query;
public PedidosTab1() {
// Required empty public constructor
}
#Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_pedidos_tab1, container, false);
/*Recuperando instancia do Firebase*/
mAuth = FirebaseAuth.getInstance();
mCurrentUser = mAuth.getCurrentUser();
mDatabaseEmpresa = FirebaseDatabase.getInstance().getReference().child("Empresas").child(mCurrentUser.getUid());
mDatabaseAgendamentos = FirebaseDatabase.getInstance().getReference().child("Vendas_Empresas");
/*Atributos tela*/
mTextPadrao = (TextView) view.findViewById(R.id.tvPedTab1_textPadrao);
/*RecyclerView*/
mCardPedidos = (RecyclerView) view.findViewById(R.id.cardListaPedidos);
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getActivity());
linearLayoutManager.setReverseLayout(true);
linearLayoutManager.setStackFromEnd(true);
mCardPedidos.setLayoutManager(new LinearLayoutManager(getActivity(), LinearLayoutManager.VERTICAL, false));
carregarPedidos();
return view;
}
private void carregarPedidos() {
mDatabaseAgendamentos.addValueEventListener(new ValueEventListener() {
#Override
public void onDataChange(DataSnapshot dataSnapshot) {
if (dataSnapshot.child(mCurrentUser.getUid()).exists()){
carregarDadosRecycler();
} else {
mTextPadrao.setVisibility(View.VISIBLE);
mCardPedidos.setVisibility(View.GONE);
}
}
#Override
public void onCancelled(DatabaseError databaseError) {
}
});
}
private void carregarDadosRecycler() {
FirebaseRecyclerAdapter<CardPedidos_row, CardPedidosViewHolder> firebaseRecyclerAdapter = new FirebaseRecyclerAdapter<CardPedidos_row, CardPedidosViewHolder>(
CardPedidos_row.class,
R.layout.card_agendamentos_row,
CardPedidosViewHolder.class,
mDatabaseAgendamentos.child(mCurrentUser.getUid()).orderByChild("status_timeStamp").startAt("Aberto").endAt("Aberto\uf8ff")
) {
#Override
protected void populateViewHolder(final CardPedidosViewHolder viewHolder, final CardPedidos_row model, int position) {
final String pedido_key = getRef(position).getKey();
String nome_servico = model.getEmpresa_nome();
String nome_empresa = model.getEmpresa_nome();
final String id_empresa = model.getEmpresa_id();
String valor_servico = model.getServico_valor();
String hora = model.getAgenda_hora();
String data = model.getAgenda_data();
String status = model.getStatus_situacao();
String timeStamp = model.getTimestamp_criacaoDt();
viewHolder.setServico_nome(model.getServico_nome());
viewHolder.setAgenda_data(model.getAgenda_data());
viewHolder.setAgenda_hora(model.getAgenda_hora());
viewHolder.setServico_valor(model.getServico_valor());
viewHolder.setEmpresa_nome(model.getEmpresa_nome());
viewHolder.setStatus_situacao(model.getStatus_situacao());
viewHolder.setTimestamp_criacaoDt(model.getTimestamp_criacaoDt());
/*Clique na View*/
viewHolder.mView.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
/*Intent detalhePedido = new Intent(getActivity().getApplication(), DetalhePedido.class);
detalhePedido.putExtra("id_empresa", id_empresa);
detalhePedido.putExtra("id_venda", pedido_key);
startActivity(detalhePedido);*/
Intent detalhePedido = new Intent(getActivity().getApplication(), DetalhePedido.class);
detalhePedido.putExtra("id_pedido", pedido_key);
startActivity(detalhePedido);
}
});
}
};
mCardPedidos.setAdapter(firebaseRecyclerAdapter);
}
public static class CardPedidosViewHolder extends RecyclerView.ViewHolder{
View mView;
public CardPedidosViewHolder ( View itemView ){
super(itemView);
mView = itemView;
}
public void setServico_nome(String servico_nome){
TextView cardNome_servico = (TextView) mView.findViewById(R.id.tvNomeServico_CardAg);
cardNome_servico.setText(servico_nome);
}
public void setEmpresa_nome(String empresa_nome){
TextView cardNome_empresa = (TextView) mView.findViewById(R.id.tvNomeEmpresa_CardAg);
cardNome_empresa.setText(empresa_nome);
}
public void setServico_valor(String servico_valor){
TextView cardValor_servico = (TextView) mView.findViewById(R.id.tvValor_CardAg);
cardValor_servico.setText(servico_valor);
}
public void setAgenda_data(String agenda_data){
TextView cardData = (TextView) mView.findViewById(R.id.tvData_CardAg);
cardData.setText(agenda_data);
}
public void setAgenda_hora(String agenda_hora){
TextView cardHora = (TextView) mView.findViewById(R.id.tvHora_CardAg);
cardHora.setText(agenda_hora);
}
public void setStatus_situacao(String status_situacao){
TextView cardStatus = (TextView) mView.findViewById(R.id.tvStatus_CardAg);
cardStatus.setText(status_situacao);
}
public void setTimestamp_criacaoDt(String timestamp_criacao){
TextView cardTimeStamp = (TextView) mView.findViewById(R.id.tvTimeStamp);
cardTimeStamp.setText(timestamp_criacao);
}
}
}
This should work!
Add the getItem(int position) method to your FirebaseRecyclerAdapter as:
#Override
public CardPedidos_row getItem(int position) {
return super.getItem(getCount() - position - 1);
}
This will return a list in reverse order.
FirebaseRecyclerAdapter<CardPedidos_row, CardPedidosViewHolder> firebaseRecyclerAdapter = new FirebaseRecyclerAdapter<CardPedidos_row,CardPedidosViewHolder>(
CardPedidos_row.class,
R.layout.card_agendamentos_row,
CardPedidosViewHolder.class,
mDatabaseAgendamentos.child(mCurrentUser.getUid()).orderByChild("status_timeStamp").startAt("Aberto").endAt("Aberto\uf8ff")
) {
#Override
public CardPedidos_row getItem(int position) {
return super.getItem(getCount() - position - 1);
}
#Override
protected void populateViewHolder(final CardPedidosViewHolder viewHolder, final CardPedidos_row model, int position) { ....

How to Delete Items from RecyclerView and Read from two children in Firebase

Am new to android development am trying to figure out how to do two thing.
Use a close button to delete items from a RecyclerView and Firebase
Retrieve items from two children in a database. In my code I was able to retrieve from just one child (offer_Rides) but I will like to retrieve from another child called "Users".
public class WallActivity extends AppCompatActivity {
private Button ivClose;
private RecyclerView offerList;
private DatabaseReference mDatabase;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_wall);
mDatabase = FirebaseDatabase.getInstance().getReference().child("Offer_Rides");
ivClose = (Button) findViewById(R.id.ivClose);
// ivClose.setOnClickListener((View.OnClickListener) this);
offerList = (RecyclerView) findViewById(R.id.offerList);
offerList.setHasFixedSize(true);
offerList.setLayoutManager(new LinearLayoutManager(this));
}
#Override
protected void onStart() {
super.onStart();
FirebaseRecyclerAdapter<OfferPost, OfferPostViewHolder> firebaseRecyclerAdapter = new FirebaseRecyclerAdapter<OfferPost, OfferPostViewHolder>(
OfferPost.class,
R.layout.offer_list_row,
OfferPostViewHolder.class,
mDatabase
){
#Override
protected void populateViewHolder(OfferPostViewHolder viewHolder, OfferPost model, int position) {
viewHolder.setFirstname(model.getFirstname());
viewHolder.setLastname(model.getLastname());
viewHolder.setPhone(model.getPhone());
viewHolder.setPrice(model.getPrice());
viewHolder.setSeats(model.getSeats());
viewHolder.setLocation(model.getLocation());
viewHolder.setDestination(model.getDestination());
}
};
offerList.setAdapter(firebaseRecyclerAdapter);
}
public static class OfferPostViewHolder extends RecyclerView.ViewHolder{
View mView;
public OfferPostViewHolder(View itemView) {
super(itemView);
mView = itemView;
}
public void setFirstname(String firstname){
TextView post_firstname = (TextView) mView.findViewById(R.id.tvFirstname);
post_firstname.setText(firstname);
}
public void setLastname(String lastname){
TextView post_firstname = (TextView) mView.findViewById(R.id.tvLastname);
post_firstname.setText(lastname);
}
public void setPhone(String phone){
TextView post_phone = (TextView) mView.findViewById(R.id.tvPhone);
post_phone.setText(phone);
}
public void setPrice(String price){
TextView post_price = (TextView) mView.findViewById(R.id.tvCash);
post_price.setText(price);
}
public void setSeats(String seats){
TextView post_seats = (TextView) mView.findViewById(R.id.tvSeats);
post_seats.setText(seats);
}
public void setLocation(String location){
TextView post_location = (TextView) mView.findViewById(R.id.tvLocation);
post_location.setText(location);
}
public void setDestination(String destination){
TextView post_destination = (TextView) mView.findViewById(R.id.tvDestination);
post_destination.setText(destination);
}
}
}
If you want to delete users values in firebase use this code
DatabaseReference databaseReference = firebaseDatabase.getReference().child("Users");
databaseReference.removeValue();

Categories

Resources