0
I need to recover from Firebase in Recyclerview user order requests in a way that organizes these requests in a list without overwriting the other one. For now my list is static.
Each user has an id in the BD and each request tbm.
Adapter
public class AdapterSolicitacoes extends RecyclerView.Adapter <AdapterSolicitacoes.MyViewHolder> {
public class MyViewHolder extends RecyclerView.ViewHolder{
TextView bairro;
TextView endereco;
TextView data;
public MyViewHolder(View itemView) {
super(itemView);
bairro = itemView.findViewById(R.id.tv_bairro);
endereco = itemView.findViewById(R.id.tv_endereco);
data = itemView.findViewById(R.id.tv_data);
}
}
@Override
public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View itemLista = LayoutInflater.from(parent.getContext())
.inflate(R.layout.adapter_lista_solicitacao, parent, false);
return new MyViewHolder(itemLista);
}
@Override
public void onBindViewHolder(MyViewHolder holder, int position) {
holder.bairro.setText("ITAJAI");
holder.endereco.setText("Rua JOAO DE BARRO, 222.");
holder.data.setText("27 Abr 18");
}
@Override
public int getItemCount() {
return 10;
}
}
Fragment
public class SolicRecebidaFragment extends Fragment {
private RecyclerView recyclerViewListaSolicitacao;
private DatabaseReference referencia ;
public SolicRecebidaFragment() {
// 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_solicitacao_recebida, container, false);
//Config.Inciais
recyclerViewListaSolicitacao = view.findViewById(R.id.recyclerView_ListaSolicitacao);
//Config.Adapter
AdapterSolicitacoes adapter = new AdapterSolicitacoes();
//Config.RecyclerView
RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(getActivity());
recyclerViewListaSolicitacao.setLayoutManager( layoutManager);
recyclerViewListaSolicitacao.setHasFixedSize(true);
recyclerViewListaSolicitacao.setAdapter( adapter );
//Recupera endereço do nó usuarios
referencia = ConfiguracaoFirebase.getFirebaseDataBase().child("usuarios");
referencia.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
Log.i("DADOS FIREBASE: ", dataSnapshot.getValue().toString());
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
});
return view;
}
}
But how will this information transition? Type the user App data into the company App?
– E FRANÇA
What is the purpose of your code? I understood that you were having problems with your Recyclerview. Your question is a little poorly worded.
– Daniel Gherard
I made a mistake with another question I had asked in the forum. This already manage to solve, obg by help.
– E FRANÇA
The other question is: https://answall.com/questions/294960/troca-de-informa%C3%A7%C3%B5es-entre-recycleviews. Vlw
– E FRANÇA