"java.lang.IndexOutOfBoundsException
See original GitHub issueI’m getting an “java.lang.IndexOutOfBoundsException: Invalid index 6, size is 6 at java.util.ArrayList.throwIndexOutOfBoundsException”
while using Admobadapter. This is my click handler in recycler adapter class
` @Override public void onBindViewHolder(final RecyclerView.ViewHolder holder, final int position) { holder.itemView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { callback.onOverViewSelected(data.get(holder.getAdapterPosition())); } });
if (holder instanceof TextViewHolder) {
((TextViewHolder) holder).title.setText(data.get(position).getText(context));
} else if (holder instanceof ImageViewHolder) {
Picasso.with(context)
.load(data.get(position).categoryImageUrl)
.placeholder(R.drawable.placeholder)
.into(((ImageViewHolder) holder).image);
((ImageViewHolder) holder).title.setText(data.get(position).getText(context));
}
}`
Logcat info-----
05-24 18:38:33.743 6393-6393/com.malayalamapp.plingapp E/chromium: [ERROR:interface_registry.cc(99)] Failed to locate a binder for interface: autofill::mojom::AutofillDriver 05-24 18:38:33.790 6393-6393/com.malayalamapp.plingapp E/chromium: [ERROR:interface_registry.cc(99)] Failed to locate a binder for interface: autofill::mojom::AutofillDriver 05-24 18:38:33.828 6393-6393/com.malayalamapp.plingapp E/chromium: [ERROR:interface_registry.cc(99)] Failed to locate a binder for interface: autofill::mojom::AutofillDriver 05-24 18:38:33.852 6393-6393/com.malayalamapp.plingapp E/AndroidRuntime: FATAL EXCEPTION: main Process: com.malayalamapp.plingapp, PID: 6393 java.lang.IndexOutOfBoundsException: Invalid index 6, size is 6 at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:260) at java.util.ArrayList.get(ArrayList.java:313) at com.malayalamapp.plingapp.fbdirectfeed.providers.overview.CategoryAdapter$1.onClick(CategoryAdapter.java:70) at android.view.View.performClick(View.java:5269) at android.view.View$PerformClick.run(View.java:21556) at android.os.Handler.handleCallback(Handler.java:815) at android.os.Handler.dispatchMessage(Handler.java:104) at android.os.Looper.loop(Looper.java:207) at android.app.ActivityThread.main(ActivityThread.java:5769) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:679)
It happens when click on last item…Any idea about this issue?
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (2 by maintainers)
Top GitHub Comments
You should try callback.onOverViewSelected(data.get(position)) instead of callback.onOverViewSelected(data.get(holder.getAdapterPosition()));
@Sarun1001 If you have fork lib, You can create pull requests