The local variable xxx is never read

后端 未结 6 1633
不思量自难忘°
不思量自难忘° 2021-01-29 13:24

This is my code:

boolean startGameBoolean;
Bundle extras = getIntent().getExtras();
extras.getInt(\"startGameBoolean\");
if (startGameBoolean = true){
    counte         


        
6条回答
  •  再見小時候
    2021-01-29 13:38

    I had this same problem developing for Android.

    The reason you're seeing those warnings saying the "variable is never read" is because you're assigning it RIGHT AFTER creating it. Try creating the variable at the start of the class, then assigning it in an OnCreate() or other appropriate method that gets called when the class is first created.

提交回复
热议问题