Skip to content

Crashing while choosing the last element in the basic list "DSListView" #17

@Umarlovesall

Description

@Umarlovesall

DSListView stringDSListView;
stringDSListView = findViewById(R.id.ds_sport_list);

    ArrayList<String> al = new ArrayList<>();
    al.add("umar");
    al.add("akshay");
    al.add("arun");

    ArrayAdapter<String> arrayAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_dropdown_item_1line,al);
    stringDSListView.setAdapter(arrayAdapter);

This is the code and following is the logcat :

java.lang.IndexOutOfBoundsException: Index: 3, Size: 3
at java.util.ArrayList.get(ArrayList.java:437)
at android.widget.ArrayAdapter.getItem(ArrayAdapter.java:394)
at com.ramotion.directselect.DSListView.hideListView(DSListView.java:225)
at com.ramotion.directselect.DSListView.access$200(DSListView.java:37)
at com.ramotion.directselect.DSListView$4.run(DSListView.java:411)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7711)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:516)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions