在Google Play控制台的onPostCreate中获取NullPointerException

时间:2019-04-30 07:19:17

标签: java android

我在Play控制台中出现了空指针异常,无法在我的代码中找到问题。

我已经尝试了所有可能的方法来找到该异常。我也曾在几种设备上尝试过,但徒劳无功。

这是我的onPostCreate代码:

@Override
protected void onPostCreate(@Nullable Bundle savedInstanceState) {
    super.onPostCreate(savedInstanceState);

    pageRange= (EditText)findViewById(R.id.pageRange);
    pageRange.addTextChangedListener(new TextWatcher() {
        @Override
        public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
        }

        @Override
        public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
            String text = pageRange.getText().toString();
            for (int x = 0; x < selected.size(); x++)
                selected.set(x, false);
            textChanged(text);
        }

        @Override
        public void afterTextChanged(Editable editable) {
            String text = pageRange.getText().toString();
            for (int x = 0; x < selected.size(); x++)
                selected.set(x, false);
            textChanged(text);
        }
    });
    img_recycler = (RecyclerView) findViewById(R.id.recycler);
    recyclerAdapter = new RecyclerAdapter();
    img_recycler.setLayoutManager(new GridLayoutManager(this,3));
    img_recycler.setAdapter(recyclerAdapter);
    Thread t = new Thread(){
        public void run()
        {
            getImages();
        }
    };
    t.start();
    // fileName=getFileName(SplitFiles.path);
    // fileName = SplitFiles.filePath.lastIndexOf("/");
    String path=SplitFiles.filePath;
    fileName=path.substring(path.lastIndexOf("/")+1);
    AdView mAdView = findViewById(R.id.adView);
    AdRequest adRequest = new AdRequest.Builder().addTestDevice("41B2730621B6EDDB8BF5E8148E0CC1CE").build();
    mAdView.loadAd(adRequest);
}

这是Google Play控制台中的日志详细信息。

java.lang.RuntimeException: 
at android.app.ActivityThread.performLaunchActivity 
(ActivityThread.java:2974)
at android.app.ActivityThread.handleLaunchActivity 
(ActivityThread.java:3059)
at android.app.ActivityThread.-wrap11 (Unknown Source)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1724)
at android.os.Handler.dispatchMessage (Handler.java:106)
at android.os.Looper.loop (Looper.java:164)
at android.app.ActivityThread.main (ActivityThread.java:7000)
at java.lang.reflect.Method.invoke (Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run 
(RuntimeInit.java:441)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1408)
Caused by: java.lang.NullPointerException: 
at com.skytek.pdf.creator.SplitFiles2.onPostCreate (SplitFiles2.java:121)
at android.app.Instrumentation.callActivityOnPostCreate 
(Instrumentation.java:1292)
at android.app.ActivityThread.performLaunchActivity 
(ActivityThread.java:2956)

0 个答案:

没有答案