Google Play崩溃了; ANR次数

时间:2014-01-18 04:38:59

标签: android

我想知道谷歌游戏商店在Crashes& amp; ANR如同日志,但实际上我游戏中的那条路径正常。

所以,任何人都可以解释我如何解决问题如下:

Play商店中的日志副本:

java.lang.NullPointerException
at kids.iq.kidsiqpicturesquestionfull.animal_q_easy_1$1$1.run(animal_q_easy_1.java:83)
at android.os.Handler.handleCallback(Handler.java:587)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4627)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:893)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:651)
at dalvik.system.NativeStart.main(Native Method)

我的完整代码(animal_q_easy_1)

final MediaPlayer whatanimal = MediaPlayer.create(this, R.raw.what_is_that_animal);
    int timeout = 700;
    new Timer().schedule(new TimerTask()
    {
     @Override
     public void run()
     {
        animal_q_easy_1.this.runOnUiThread(new Runnable()
         {
             public void run()
             {
                whatanimal.start();

             }
            });
          }
      }, timeout);


    //get intent data
    Intent i = getIntent();

    //get string from image clicked
    final String imageName = getIntent().getExtras().getString("image_name");

    final String[] answers = {"cat", "dog", "bear", imageName, "ant", "donkey", "bat", "beaver", "bee", "butterfly", "camel", "chicken", "cobra", "cockroach", "coyote", "crab", "crane", "crocodile", "crow", "curlew", "deer", "dinosaur", "dogfish", "dolphin", "dove", "dragonfly", "duck", "elephant", "emu", "falcon", "fish", "flamingo", "fly", "fox", "frog", "giraffe", "goat", "goldfinch", "goldfish", "horse", "human", "jellyfish", "kangaroo", "kouprey", "lobster", "lyrebird", "manatee", "monkey", "mouse", "mosquito", "opossum", "oyster", "parrot", "penguin", "rabbit", "raccoon", "rat", "raven", "salmon", "scorpion", "seal", "sheep", "skunk", "squirrel", "tiger"};

    // Selected image id
    final int position = i.getExtras().getInt("id");
    //Toast.makeText(animal_q.this, "Current Position" + position, Toast.LENGTH_SHORT).show();
    //Remember Id for the First time start game
    final int firstTimeID_1 = i.getExtras().getInt("rememberID_frist");
    //Toast.makeText(animal_q.this, "First Position:" + firstTimeID_1, Toast.LENGTH_SHORT).show();
    final int firstTimeID_2 = i.getExtras().getInt("rememberID_second");
    //Toast.makeText(animal_q.this, "Pre-Current Position:" + firstTimeID_2, Toast.LENGTH_SHORT).show();

    final ImageAdapter_Animal_24_easy_1 imageAdapter = new ImageAdapter_Animal_24_easy_1(this);
    final ImageView imageView = (ImageView) findViewById(R.id.animal_gridview_question);
    imageView.startAnimation(end_time);
    imageView.setImageResource(imageAdapter.mThumbIds[position]);

    //Get random of fruit in array
    final ArrayList<Integer> numbers = new ArrayList<Integer>();
    boolean vowel_added = false;
       Random rnd = new Random();
       while (numbers.size()<=4) {
         int randomInteger = rnd.nextInt(answers.length);
         if (!numbers.contains(randomInteger))
         {
             if(answers[randomInteger].equalsIgnoreCase(imageName))
             {
                 if (!vowel_added)
                 {
                     vowel_added = true;
                     numbers.add(randomInteger);
                 }
             }
             else
             {
                 numbers.add(randomInteger);
             }
          }
       }
       if (!vowel_added)
       {
         int index = rnd.nextInt(numbers.size());//this random to set the index of vowel at random position
         numbers.set(index,3); //you can find the index of one vowel and put here
       }

0 个答案:

没有答案