简体   繁体   中英

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

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.

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.

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="........&nom=Canada........."

it's working

bt if i lanch my request like this

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

it's not working

post your RecycleView Adapter code and your onCreate() code !! so ican figure what you are missing !! it can be so many reasons !!!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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