Implementing Search Filter in Adapter Class which parses a json array (without using pojo)

后端 未结 1 1159
小蘑菇
小蘑菇 2020-12-22 05:18

I would like to implement a search filter in my adapter class (used in a fragment class showing a list of colors), but although I managed to do it for simpler examples, I do

相关标签:
1条回答
  • 2020-12-22 05:56

    Change the code from get(i) to getJSONObject(i) like below and try.If error is still there then you need to check the logs and post the logs.

    for(int i = 0; i<colorList.length(); i++){
                    try {
                        filterableString = ((JSONObject) colorList.getJSONObject(i)).getString("Name");
                    } catch (JSONException e) {
                        e.printStackTrace();
                    }
    
    0 讨论(0)
提交回复
热议问题