Android ArrayAdapter and JSONArray

后端 未结 4 2007
忘了有多久
忘了有多久 2021-01-07 10:48

I am new to Android Development.

I purely like to work with JSON Objects and Arrays for my simple application considering the lightness of the JSON Carrier compared

4条回答
  •  日久生厌
    2021-01-07 11:18

    You can pass null to super instead of creating a string array and implement getCount method:

    public myAdaptor(Context context, int resource, JSONArray array)
    {
        super(context, resource, null);
        // Store in the local varialbles to the adapter class.
        this.context = context;
        this.resource = resource;
        this.profiles = array;
    }
    
    public int getCount(){
       return profiles.length();
    }
    

提交回复
热议问题