您好我正在获取Resources $ NotFoundException。我尝试了很多方法,但我可以找到我的错误。我不熟悉android.Kindly想出解决方案。这是我的代码。我正在使用recyclelerview适配器来设置json的值。
public class AnalyticAssessAdapter extends RecyclerView.Adapter<AnalyticAssessAdapter.Holder> {
private Context context;
private int userID;
private List<AnalyticModel> arraList;
public AnalyticAssessAdapter(Context context, int userID, List<AnalyticModel> arraList) {
this.context = context;
this.userID = userID;
this.arraList = arraList;
}
@Override
public AnalyticAssessAdapter.Holder onCreateViewHolder(ViewGroup parent, int position) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.adapter_analytical_assess, parent, false);
Holder holder = new Holder(view);
return holder;
}
@Override
public void onBindViewHolder(final Holder holder, final int position) {
holder.testNum.setText(arraList.get(position).getTest_id());
holder.testCategory.setText(arraList.get(position).getCategory_id());
holder.mark.setText(arraList.get(position).getTestscore());
holder.topScore.setText(arraList.get(position).getHighscore());
}
@Override
public int getItemCount() {
return arraList.size();
}
public class Holder extends RecyclerView.ViewHolder {
TextView testNum;
TextView testCategory;
TextView testDate;
TextView mark;
TextView topScore;
public Holder(View itemView) {
super(itemView);
this.testNum = (TextView) itemView.findViewById(R.id.test_no_aa);
this.testCategory = (TextView) itemView.findViewById(R.id.test_name_aa);
this.testDate = (TextView) itemView.findViewById(R.id.test_date_aa);
this.mark = (TextView) itemView.findViewById(R.id.mark_aa);
this.topScore = (TextView) itemView.findViewById(R.id.top_score_aa);
}
}
}
这是我的例外。
致命的例外:主要
Process: com.admin.crackanalytics, PID: 15972
android.content.res.Resources$NotFoundException: String resource ID #0x39
at android.content.res.Resources.getText(Resources.java:312)
at android.support.v7.widget.ResourcesWrapper.getText(ResourcesWrapper.java:52)
at android.widget.TextView.setText(TextView.java:4422)
at com.admin.crackanalytics.view.adapter.AnalyticAssessAdapter.onBindViewHolder(AnalyticAssessAdapter.java:45)
at com.admin.crackanalytics.view.adapter.AnalyticAssessAdapter.onBindViewHolder(AnalyticAssessAdapter.java:21)
at android.support.v7.widget.RecyclerView$Adapter.onBindViewHolder(RecyclerView.java:5825)
at android.support.v7.widget.RecyclerView$Adapter.bindViewHolder(RecyclerView.java:5858)
at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5094)
at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:4970)
at android.support.v7.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:2029)
at android.support.v7.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1414)
at android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1377)
at android.support.v7.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:578)
at android.support.v7.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:3315)
at android.support.v7.widget.RecyclerView.onMeasure(RecyclerView.java:2843)
at android.view.View.measure(View.java:18804)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5954)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1465)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:748)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:630)
at android.view.View.measure(View.java:18804)
at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:715)
at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:461)
at android.view.View.measure(View.java:18804)
at android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1630)
at android.view.View.measure(View.java:18804)
at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:715)
at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:461)
at android.view.View.measure(View.java:18804)
at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:715)
at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:461)
at android.view.View.measure(View.java:18804)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5954)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
at android.support.v7.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:135)
at android.view.View.measure(View.java:18804)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5954)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1465)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:748)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:630)
at android.view.View.measure(View.java:18804)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5954)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
at android.view.View.measure(View.java:18804)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5954)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1465)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:748)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:630)
at android.view.View.measure(View.java:18804)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5954)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
at com.android.internal.policy.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2643)
at android.view.View.measure(View.java:18804)
at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2112)
at android.view.ViewRootImpl