0
イムのデータは、データを表示しませんが、私は活動Firebase UIはfirebase
に私はFirebase UIから私はここで と
忘れわから同じコードとして使用していないよできフラグメントに表示しようと表示されません私のデータはfirebase
マイ結果に私は
を取得します0
Heire私のコード
SOS.Fragment
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.view_sos, container, false);
SupportMapFragment mapFragment = (SupportMapFragment)getChildFragmentManager().findFragmentById(R.id.map_report);
mapFragment.getMapAsync(this);
preferences = getActivity().getSharedPreferences(shared_preferences, Context.MODE_PRIVATE);
mRecyclerView = (RecyclerView)view.findViewById(R.id.rv_sos);
mRecyclerView.setHasFixedSize(true);
mLayoutManager = new LinearLayoutManager(getContext());
mAuth = FirebaseAuth.getInstance();
mRef = FirebaseDatabase.getInstance().getReference();
mBtn = (ImageButton)view.findViewById(R.id.s_o_s_btn);
mBtn.setOnClickListener(this);
mAdapter = new FirebaseRecyclerAdapter<SOS, SoSViewHolder>
(
SOS.class,
R.layout.sos_list,
SoSViewHolder.class,
mRef.child("report")
)
{
@Override
protected void populateViewHolder(SoSViewHolder holder, SOS sos, int position) {
holder.setMtopic(sos.getRpTitle());
holder.setMlocation(sos.getRpLocation());
}
};
mRecyclerView.setLayoutManager(mLayoutManager);
mAdapter.notifyDataSetChanged();
mRecyclerView.setAdapter(mAdapter);
return view;
}
SOSモデル
package com.enovagroup.army3.Model;
/** * 29/8/2560でAndroidのDevによって作成されます。 */ パブリッククラスSOS {
private String rpAddress;
private String rpAuther;
private String rpBody;
private String rpCreate;
private String rpId;
private String rpLocation;
private String rpPic;
private Integer rpTimestamp;
private String rpTitle;
public SOS(){
}
public SOS(String rpAddress, String rpAuther, String rpBody, String rpCreate, String rpId, String rpLocation,
String rpPic, Integer rpTimestamp, String rpTitle) {
this.rpAddress = rpAddress;
this.rpAuther = rpAuther;
this.rpBody = rpBody;
this.rpCreate = rpCreate;
this.rpId = rpId;
this.rpLocation = rpLocation;
this.rpPic = rpPic;
this.rpTimestamp = rpTimestamp;
this.rpTitle = rpTitle;
}
public void setRpAddress(String rpAddress) {
this.rpAddress = rpAddress;
}
public void setRpAuther(String rpAuther) {
this.rpAuther = rpAuther;
}
public void setRpBody(String rpBody) {
this.rpBody = rpBody;
}
public void setRpCreate(String rpCreate) {
this.rpCreate = rpCreate;
}
public void setRpId(String rpId) {
this.rpId = rpId;
}
public void setRpLocation(String rpLocation) {
this.rpLocation = rpLocation;
}
public void setRpPic(String rpPic) {
this.rpPic = rpPic;
}
public void setRpTimestamp(Integer rpTimestamp) {
this.rpTimestamp = rpTimestamp;
}
public void setRpTitle(String rpTitle) {
this.rpTitle = rpTitle;
}
public String getRpAddress() {
return rpAddress;
}
public String getRpAuther() {
return rpAuther;
}
public String getRpBody() {
return rpBody;
}
public String getRpCreate() {
return rpCreate;
}
public String getRpId() {
return rpId;
}
public String getRpLocation() {
return rpLocation;
}
public String getRpPic() {
return rpPic;
}
public Integer getRpTimestamp() {
return rpTimestamp;
}
public String getRpTitle() {
return rpTitle;
}
ソスViewHolder
public class SoSViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
public TextView mtopic , mlocation;
private ItemClickListener itemClickListener;
public String rptitle,rpbody,rpauther,rpaddress,rplocation;
public SoSViewHolder(View view) {
super(view);
mtopic = (TextView)view.findViewById(R.id.sos_topic);
mlocation = (TextView)view.findViewById(R.id.sos_location);
view.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(view.getContext(), SoSDetail.class);
intent.putExtra("rp_title",mtopic.getText().toString());
intent.putExtra("rp_location",mlocation.getText().toString());
intent.putExtra("rp_body",rpbody);
intent.putExtra("rp_title",rptitle);
intent.putExtra("rp_address",rpaddress);
intent.putExtra("rp_auther",rpauther);
intent.putExtra("rp_location",rplocation);
}
});
}
public void setMtopic(String topic){
mtopic.setText(topic);
}
public void setMlocation(String location){
mlocation.setText(location);
}
私は誰もが私の問題イムはあなたが別の命名規則を持っている私の問題
Thxサー –