Bubble-Picker icon indicating copy to clipboard operation
Bubble-Picker copied to clipboard

lateinit property items has not been initialized

Open benzscoutout opened this issue 7 years ago • 18 comments

I'm not use kotlin project, I use java

I try to use this library but error when startActivity

"lateinit property items has not been initialized"

benzscoutout avatar May 15 '17 05:05 benzscoutout

Hi @Mercidez Does this exception appears in the sample app? Otherwise could you please share your code?

igalata avatar May 18 '17 19:05 igalata

  1. I hit the same issue. Log
kotlin.UninitializedPropertyAccessException: lateinit property items has not been initialized
                                                                  at com.igalata.bubblepicker.rendering.PickerRenderer.initialize(PickerRenderer.kt:79)
                                                                  at com.igalata.bubblepicker.rendering.PickerRenderer.onSurfaceChanged(PickerRenderer.kt:67)
                                                                  at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1537)
                                                                  at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1253)
  1. BTW, [Feature request] Is there any way to load image from network?

dbof10 avatar Jun 12 '17 14:06 dbof10

Hello. Have you by any chance figured out the solution? Cause actually i am facing the same problem right now.

stathiskaps avatar Jul 04 '17 19:07 stathiskaps

To be more precise this is the code (i believe it is the way it should be)

2017-07-04_23-19-19

and this is the error

2017-07-04_23-19-44

stathiskaps avatar Jul 04 '17 20:07 stathiskaps

I have the exactly the same problem

CHRISPASP95 avatar Jul 04 '17 20:07 CHRISPASP95

I got many errors in GLSurfaceView class. Any ideas that could help?

2017-07-05_00-10-44 2017-07-05_00-15-03 2017-07-05_00-15-13 2017-07-05_00-15-54

stathiskaps avatar Jul 04 '17 21:07 stathiskaps

I am also getting this issue, any help!!

ArsalRaza avatar Nov 27 '17 23:11 ArsalRaza

Please check if your array is non zero so that the bubblepicker can initialize and adapter get set as otherwise, the PickerRenderer.initialize(PickerRenderer) doesn't get initialized and this issue occur

sujeet-kumar-mehta avatar Dec 08 '17 06:12 sujeet-kumar-mehta

declare array before main instance this solve my problem

ismailtosun avatar Jan 15 '18 13:01 ismailtosun

It is very sad that the developer is not addressing the issue many of us are facing :(

rosanlal26 avatar Jan 17 '18 11:01 rosanlal26

@ismailtosun Could you paste the code as it should be according to you?

rosanlal26 avatar Jan 17 '18 11:01 rosanlal26

Here is my code: @ismailtosun @igalata Kindly help

 public class BubblePicker extends AppCompatActivity {


com.igalata.bubblepicker.rendering.BubblePicker picker;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_bubble_picker);
    final String[] titles = getResources().getStringArray(R.array.countries);
    final TypedArray colors = getResources().obtainTypedArray(R.array.colors);
    final TypedArray images = getResources().obtainTypedArray(R.array.images);

    picker=new com.igalata.bubblepicker.rendering.BubblePicker(this);


   picker.setAdapter(new BubblePickerAdapter() {
        @Override
        public int getTotalCount() {
            return images.length();
        }

        @NotNull
        @Override
        public PickerItem getItem(int position) {
            PickerItem item = new PickerItem();
            item.setTitle(titles[position]);
            item.setGradient(new BubbleGradient(colors.getColor((position * 1) % 2, 0),
                    colors.getColor((position) % 1 + 1, 0), BubbleGradient.VERTICAL));

          //  item.setTypeface(mediumTypeface);
            item.setTextColor(ContextCompat.getColor(BubblePicker.this, android.R.color.white));
            item.setBackgroundImage(ContextCompat.getDrawable(BubblePicker.this, images.getResourceId(position, 0)));
            return item;
        }
    });

}

@Override
protected void onResume() {
    super.onResume();
    picker.onResume();
}

@Override
protected void onPause() {
    super.onPause();
    picker.onPause();
}

}

rosanlal26 avatar Jan 17 '18 11:01 rosanlal26

same issue, any working solutions?

Karlheinzniebuhr avatar Apr 16 '18 22:04 Karlheinzniebuhr

I am getting error when i write junit testcase:

kotlin.UninitializedPropertyAccessException: lateinit property inventoryService has not been initialized

at com.e8om.books.junit.svc.InventoryServiceTests.stockGroupListTest(InventoryServicesTest.kt:22)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)

anujkv avatar Apr 23 '18 10:04 anujkv

Hi All, I too got same exception, any working solution found?

maheswarich avatar May 07 '18 06:05 maheswarich

I noticed that this happens when your adapter is not set at the time when "onResume" is called. This happens to me too when I try to fetch items from the API and onResume gets called earlier than I get them and thus I got it to not crash by setting an empty list for an adapter, but now when I do get the items, they do not get displayed even though adapter's methods do get called e.g. getItem.

MilanVucic avatar Jun 24 '18 09:06 MilanVucic

@BenzScoutOut @dbof10 @P130 @CHRISPASP95 @MilanVucic @rosanlal26 please review my lib was developed based on this lib. This is a conflict between java and kotlin library and I fixed this issue https://github.com/hantrungkien/Bubble-Picker

hantrungkien avatar Jul 20 '18 16:07 hantrungkien

I am facing this issue, Any solution

kotlin.UninitializedPropertyAccessException: lateinit property viewModelFactory has not been initialized at com.kavin.task.landist.country.ui.CountryFragment.onCreateView(CountryFragment.kt:31) at androidx.fragment.app.Fragment.performCreateView(Fragment.java:2605) etc.

Kavinrajan avatar Jan 05 '20 18:01 Kavinrajan