0
IM數據嘗試在片段顯示不顯示數據,但我可以在活動火力地堡用戶界面不顯示在火力
我爲相同的代碼是什麼我忘了 和
這裏使用從Firebase UI不知道我在火力
我的結果數據,我得到
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;
/** * 通過創建Android開發人員在29/8/2560。 */ 公共類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);
}
我希望每個人都能solove我的問題IM嘗試任何事情,以解決我的問題
Thx先生我爲了得到這個很長的時間IM完成 –