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

  • SEARCH
  • Home
  • 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 8738973
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T10:50:46+00:00 2026-06-13T10:50:46+00:00

I’m a novice android app developer. I wrote an application which fetches Bible Readings

  • 0

I’m a novice android app developer. I wrote an application which fetches Bible Readings from online. I wrote the separate Java class for fetching the reading and I tested it and it’s working fine. But when I tried to use that in my Android App, my app crashed and stops working. I’ve understood from the logs that it’s throwing a null pointer exception, but I don’t how to fix that. I’ve also checked the internet and I can’t find an exact solution for this. I’m attaching the logs and file related to my application below. Could anyone go through my code and throw some light on fixing the error. I appreciate your time on my behalf and many thanks in advance.

10-25 09:49:23.243: E/AndroidRuntime(620): FATAL EXCEPTION: main
10-25 09:49:23.243: E/AndroidRuntime(620): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mgocsm/com.mgocsm.EveningKymthaPrayers}: java.lang.NullPointerException: println needs a message
10-25 09:49:23.243: E/AndroidRuntime(620):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059)
10-25 09:49:23.243: E/AndroidRuntime(620):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
10-25 09:49:23.243: E/AndroidRuntime(620):  at android.app.ActivityThread.access$600(ActivityThread.java:130)
10-25 09:49:23.243: E/AndroidRuntime(620):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
10-25 09:49:23.243: E/AndroidRuntime(620):  at android.os.Handler.dispatchMessage(Handler.java:99)
10-25 09:49:23.243: E/AndroidRuntime(620):  at android.os.Looper.loop(Looper.java:137)
10-25 09:49:23.243: E/AndroidRuntime(620):  at android.app.ActivityThread.main(ActivityThread.java:4745)
10-25 09:49:23.243: E/AndroidRuntime(620):  at java.lang.reflect.Method.invokeNative(Native Method)
10-25 09:49:23.243: E/AndroidRuntime(620):  at java.lang.reflect.Method.invoke(Method.java:511)
10-25 09:49:23.243: E/AndroidRuntime(620):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
10-25 09:49:23.243: E/AndroidRuntime(620):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
10-25 09:49:23.243: E/AndroidRuntime(620):  at dalvik.system.NativeStart.main(Native Method)
10-25 09:49:23.243: E/AndroidRuntime(620): Caused by: java.lang.NullPointerException: println needs a message
10-25 09:49:23.243: E/AndroidRuntime(620):  at android.util.Log.println_native(Native Method)
10-25 09:49:23.243: E/AndroidRuntime(620):  at android.util.Log.d(Log.java:138)
10-25 09:49:23.243: E/AndroidRuntime(620):  at com.mgocsm.BibleReader.getVerses(BibleReader.java:44)
10-25 09:49:23.243: E/AndroidRuntime(620):  at com.mgocsm.EveningKymthaPrayers.onCreate(EveningKymthaPrayers.java:25)
10-25 09:49:23.243: E/AndroidRuntime(620):  at android.app.Activity.performCreate(Activity.java:5008)
10-25 09:49:23.243: E/AndroidRuntime(620):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
10-25 09:49:23.243: E/AndroidRuntime(620):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
10-25 09:49:23.243: E/AndroidRuntime(620):  ... 11 more

EveningKymthaPrayers.java (Activitiy from where I call the Java class to fetch readings)
=========================

.

public class EveningKymthaPrayers extends Activity {
    AssetManager am;
    FileReader f;
    TextView kymtha_prayer;
    BibleReader bible;
    //ReadingList rl = new ReadingList();
    @Override   
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.evening_kymtha);        
        am = getAssets();
        f = new FileReader(am,"kymtha.txt");               
        kymtha_prayer = (TextView) findViewById(R.id.show_kymtha);    
        kymtha_prayer.setMovementMethod(new ScrollingMovementMethod());
        bible = new BibleReader("John 3:16-17");
        kymtha_prayer.setText(bible.getVerses());        
        //kymtha_prayer.setText(f.readFile());
        //kymtha_prayer.setText(setText);                          
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
    }

}

BibleReader.java (Java class for fetching Bible verses)

public class BibleReader {
    public static final String  URL="http://labs.bible.org/api/?passage=";
    String verse;   
    String logName = "BibleReader";
    String line;
    StringBuilder recText;
    private static final int BUFFER_SIZE = 1024 * 10;    
    private final byte[] dataBuffer = new byte[BUFFER_SIZE];

    public BibleReader(String verse) {
        // TODO Auto-generated constructor stub
        this.verse = verse; 
        this.verse = this.verse.toString().replaceAll(" ", "%20");      
    }

    public String getVerses() 
    {
        String body = null;
        try{        
            URL url = new URL(URL+this.verse);
            URLConnection con = url.openConnection();
            InputStream in = con.getInputStream();
            String encoding = con.getContentEncoding();
            encoding = encoding == null ? "UTF-8" : encoding;
            ByteArrayOutputStream baos = new ByteArrayOutputStream();   
            int len = 0;
            while ((len = in.read(dataBuffer)) != -1) {
                baos.write(dataBuffer, 0, len);
            }   
            body = new String(baos.toByteArray(), encoding);
            Log.d(logName, "Fetched Verse"+body);
        }
        catch(Exception e){
            Log.d(logName, e.getMessage());
        }               
        return body.toString();     
    }

}

AndroidMainfest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.mgocsm"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="15" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"></uses-permission>

    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name=".MainActivity"
            android:label="@string/title_activity_main" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:name=".DailyPrayers" android:label="@string/app_name"></activity>        
        <activity android:name=".EveningPrayers" android:label="@string/app_name"></activity>
        <activity android:name=".EveningKymthaPrayers" android:label="@string/app_name"></activity> 
    </application>  
</manifest>

MainActivity.java

public class MainActivity extends Activity {


    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
    }

    public void onClick(View v){
        switch(v.getId()){
        case R.id.daily_prayers:
            startActivity(new Intent(getApplicationContext(),DailyPrayers.class));
            break;
        }

    }

}

DailyPrayers.java

public class DailyPrayers extends Activity {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.daily_prayers);
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
    }
    public void onClick(View v){
        switch(v.getId()){
        case R.id.home:
            startActivity(new Intent(getApplicationContext(),MainActivity.class));
            break;
        case R.id.evening_prayers:
            startActivity(new Intent(getApplicationContext(),EveningPrayers.class));
            break;
        }
    }
}

EveningPrayers.java

public class EveningPrayers extends Activity {

    @Override   
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.evening_prayers);
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
    }

    public void onClick(View v){
        switch(v.getId()){
        case R.id.kymtha_evening:
            startActivity(new Intent(getApplicationContext(),EveningKymthaPrayers.class));          
            break;
        case R.id.sleeba_evening:
            break;
        }
    }

}
  • 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-06-13T10:50:47+00:00Added an answer on June 13, 2026 at 10:50 am

    What i have noticed in your code:

    • bible.getVerses() is returning null
    • It seems INTERNET permission is not included in AndroidManifest.xml file

    <uses-permission android:name="android.permission.INTERNET"></uses-permission>

    • Don’t make a web call on Main thread. Instead you can use AsyncTask or AsyncTaskLoader
    • Instead of using:

    this.verse = this.verse.toString().replaceAll(" ", "%20");

    You must use:

    String webURL = URLEncoder.encode("your web url", "utf-8");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a text area in my form which accepts all possible characters from
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I would like to run a str_replace or preg_replace which looks for certain words
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I have an autohotkey script which looks up a word in a bilingual dictionary

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.