Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5997325
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T00:14:51+00:00 2026-05-23T00:14:51+00:00

I have a weird problem where, the first time you start the app, it

  • 0

I have a weird problem where, the first time you start the app, it works well, the 2nd time it crashes, the 3rd works, the 4th crashes and so on..
Here is the logcat:

E/AndroidRuntime(18039): FATAL EXCEPTION: main
E/AndroidRuntime(18039): java.lang.RuntimeException: Unable to start activity Co
mponentInfo{omar.quran1/omar.quran1.Quran}: java.lang.NullPointerException
E/AndroidRuntime(18039):        at android.app.ActivityThread.performLaunchActiv
ity(ActivityThread.java:1768)
E/AndroidRuntime(18039):        at android.app.ActivityThread.handleLaunchActivi
ty(ActivityThread.java:1784)
E/AndroidRuntime(18039):        at android.app.ActivityThread.access$1500(Activi
tyThread.java:123)
E/AndroidRuntime(18039):        at android.app.ActivityThread$H.handleMessage(Ac
tivityThread.java:939)
E/AndroidRuntime(18039):        at android.os.Handler.dispatchMessage(Handler.ja
va:99)
E/AndroidRuntime(18039):        at android.os.Looper.loop(Looper.java:130)
E/AndroidRuntime(18039):        at android.app.ActivityThread.main(ActivityThrea
d.java:3835)
E/AndroidRuntime(18039):        at java.lang.reflect.Method.invokeNative(Native
Method)
E/AndroidRuntime(18039):        at java.lang.reflect.Method.invoke(Method.java:5
07)
E/AndroidRuntime(18039):        at com.android.internal.os.ZygoteInit$MethodAndA
rgsCaller.run(ZygoteInit.java:847)
E/AndroidRuntime(18039):        at com.android.internal.os.ZygoteInit.main(Zygot
eInit.java:605)
E/AndroidRuntime(18039):        at dalvik.system.NativeStart.main(Native Method)

E/AndroidRuntime(18039): Caused by: java.lang.NullPointerException
E/AndroidRuntime(18039):        at omar.quran1.Quran.getReaders(Quran.java:565)
E/AndroidRuntime(18039):        at omar.quran1.Quran.onCreate(Quran.java:414)
E/AndroidRuntime(18039):        at android.app.Instrumentation.callActivityOnCre
ate(Instrumentation.java:1047)
E/AndroidRuntime(18039):        at android.app.ActivityThread.performLaunchActiv
ity(ActivityThread.java:1722)
E/AndroidRuntime(18039):        ... 11 more

So when the code reaches getReaders(), it crashes, and exactly on this line

    int lengthtmp=f.listFiles().length;

Here is the function:

public void getReaders()
    {
        File f = new File(SuraDatabase.Audio_PATH);
        if(f!=null)
        {
        int lengthtmp=f.listFiles().length;  //It crashes here - NullPointerException
        if(lengthtmp==0||lengthtmp>10)
        {
            SoundFiles=false;
        }
        else
        {
            SoundFiles=true;
            File[] readArrays=f.listFiles();
            for(int i =0;i<lengthtmp;i++)
            {
                if(readArrays[i].isDirectory())
                {
                    ReaderOptions.add(readArrays[i].getName());
                }
            }
        }
        }
    }

Can anyone tell me why is that line returning Null?
Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T00:14:51+00:00Added an answer on May 23, 2026 at 12:14 am

    First off, Since you are checking if f is null, instead, check if f.exists() . Because if that doesn’t exist, then there is no way that it can list anything, thus it would be null, which would be causing your exception.
    This isn’t exactly an answer to your question, but try that and see what happens, and post your results so we can give you a better answer.

    I’m also guessing you are somehow deleting this directory after your first run, but it’s just a guess without seeing actual code.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is a really weird problem: I have set up the authlogic_openid_selector_example app .
another weird problem with the iPhone SDK here. I have a UITableView which contains
i have a weird problem. i would like to delete an assembly(plugin.dll on harddisk)
I have a weird problem with images in visual web developer, I cant change
We have a weird intermittent problem with saving from Word 2007 to our SharePoint
I have a very weird problem: sometimes when I call nHibernate update to an
I have a weird date rounding problem that hopefully someone can solve. My client
This is a weird problem I have started having recently. My team is developing
This is a really weird problem that I have been having. When I download
The following code demonstrates a weird problem I have in a Turbo C++ Explorer

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.