火力地堡用户界面不显示在火力

问题描述:

IM数据尝试在片段显示不显示数据,但我可以在活动火力地堡用户界面不显示在火力

我为相同的代码是什么我忘了 和

这里使用从Firebase UI不知道我在火力

enter image description here

我的结果数据,我得到

enter image description here

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尝试任何事情,以解决我的问题

你有不同的命名惯例你的数据库和代码。例如,rp_autherrpAuther。适配器不知道如何映射这些值,这可能是空数据的原因。

您可以重命名数据库中的属性名称或将@SerializedName("rp_auther")注释添加到pojo类。

+0

Thx先生我为了得到这个很长的时间IM完成 –