简体   繁体   English

java.io.EOFException RecycleView

[英]java.io.EOFException RecycleView

I'm trying to parse a json file from an API and as argument in the request http I take the text field of a recycleview item 我正在尝试从API解析json文件,并作为请求http中的参数,我使用了recycleview项目的文本字段

I make a toast to see if I recover the field text and indeed I recover it well 我举杯祝愿我是否恢复了字段文本,并且确实恢复得很好

but when I run the http request I have an "java.io.EOFException" exception. 但是当我运行http请求时,出现了“ java.io.EOFException”异常。

I tried to run the same request but instead of retrieving the text field I put the name directly in the request 我尝试运行相同的请求,但没有检索文本字段,而是直接在请求中添加了名称

but when I run the http request I have an "java.io.EOFException" exception. 但是当我运行http请求时,出现了“ java.io.EOFException”异常。

I tried to run the same request but instead of retrieving the text field I put the name directly in the request 我尝试运行相同的请求,但没有检索文本字段,而是直接在请求中添加了名称

When I searched, I found that apparently the text field is null and that's why the query returns an exception but when I test with my toast it's wrong the field is not null! 当我搜索时,我发现文本字段显然为空,这就是查询返回异常的原因,但是当我用烤面包进行测试时,该字段不为空是错误的!

that's how I get back the text field 这就是我返回文本字段的方式

public void onClick(View view) {
        String nom =  getItem(getAdapterPosition()) ;
        Toast.makeText(AppContext.getContext(),"string ; "+nom,Toast.LENGTH_LONG).show(); 
    }

so if for example in my request http i put like this 因此,例如,在我的请求http中,我这样输入

    http="........&nom=Canada........."

it's working 它正在工作

bt if i lanch my request like this bt,如果我这样处理我的请求

  String nom = getItem(getAdapterPosition()) ; // Canada
  http="..........&nom="+nom+"........"

it's not working 它不起作用

post your RecycleView Adapter code and your onCreate() code !! 发布您的RecycleView适配器代码和onCreate()代码! so ican figure what you are missing !! 所以我想你想念的是什么! it can be so many reasons !!! 可能有很多原因!!!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM