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 6646921
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T00:28:34+00:00 2026-05-26T00:28:34+00:00

I builded a splashscreen which is showen for 5 sec afterwards it goes to

  • 0

I builded a splashscreen which is showen for 5 sec afterwards it goes to my main activity. In this splashscreen I have a boolen which checks if the app is opened up the first time, if yes, it puts some stuff into my database. But exactly at this point I get a NullPointerException.

I don’t get why its not working. In my eyes it should. It also really strange ’cause I tested the code in a demoapp with no errors.

So here is the Code of my SplashScreenActivity.java

    package de.retowaelchli.filterit;


    import org.apache.http.util.ByteArrayBuffer;
    import android.app.Activity;
    import android.content.ContextWrapper;
    import android.content.Intent;
    import android.content.SharedPreferences;
    import android.content.SharedPreferences.Editor;
    import android.os.Bundle;
    import android.preference.PreferenceManager;
    import android.widget.ImageView;

    import de.retowaelchli.filterit.database.DBAdapter;
    import de.retowaelchli.filterit.database.SmileyDBAdapter;

    public class SplashScreenActivity extends Activity {

        //Variablen definieren
        public static final String KEY_APP_IS_INITIALIZED = "APP_INITIALIZED";

        public SmileyDBAdapter mDbHelper;
        private DBAdapter db;

        ImageView iv;
        ContextWrapper context;
        ByteArrayBuffer baf;

       /** Called when the activity is first created. */
       @Override
       public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.splash);

          //Datenbank filling
          db = new DBAdapter(this);
          db.open();
          db.close();
          mDbHelper = new SmileyDBAdapter(this);
          startupcheck();

          //Splash-Screen Animation
          Thread splashThread = new Thread() {

              @Override
              public void run() {
                try {
                   int waited = 0;
                    while (waited < 5000) {
                          sleep(100);
                          waited += 100;
                            }
                        } 
                        catch (InterruptedException e) {
                            // do nothing
                        } 
                    finally {
                        finish();
                        Intent i = new Intent();
                        i.setClassName("de.retowaelchli.filterit",
                                  "de.retowaelchli.filterit.StartseiteActivity");
                        startActivity(i);
                        }
                     }
                  };
                  splashThread.start();
       }

       //Hier wird getestet ob das App bereits die Datenbankeinträge besitzt
       private void startupcheck(){
       SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(SplashScreenActivity.this);
              boolean appIsInitialized = prefs.getBoolean(KEY_APP_IS_INITIALIZED, false);
                if (appIsInitialized == false){

                    //Hier werden die Smiley gefüllt
                    devil();  <--THIS IS GIVING ME A NULLPOINTEREXCEPTION


                   //Hier wird eingetragen das die Datenbank gefüllt wurde
                    Editor editor = prefs.edit();
                    editor.putBoolean(KEY_APP_IS_INITIALIZED, true);
                    editor.commit();                
                }

             }

       /** Hier sind alle Datenbank Einträge definiert**/
       private void devil(){

            int drawableID = context.getResources().getIdentifier("devil", "drawable", getPackageName());
            iv.setImageResource(drawableID);

            String info = String.valueOf(drawableID);

            mDbHelper.open();

            mDbHelper.createSmiley("You received a satanic message", info);

            mDbHelper.close();
        }
}

Probably it has something to do that drawable isn’t loaded but I can’t image why its not loaded….

So and here is my LogCat:

09-30 10:44:04.808: INFO/ActivityManager(1760): Starting activity: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=de.retowaelchli.filterit/.SplashScreenActivity } from pid 3193
09-30 10:44:04.838: VERBOSE/HtcAppUsageStats(1760): (launch app, package): (Filter It, de.retowaelchli.filterit)
09-30 10:44:04.858: INFO/ActivityManager(1760): Start proc de.retowaelchli.filterit for activity de.retowaelchli.filterit/.SplashScreenActivity: pid=9074 uid=10150 gids={}
09-30 10:44:04.868: INFO/SuperPowerSvc(16326): [SuperPowerSvc] App launched: [de.retowaelchli.filterit]
09-30 10:44:04.918: ERROR/jdwp(9074): Failed sending reply to debugger: Broken pipe
09-30 10:44:04.918: DEBUG/dalvikvm(9074): Debugger has detached; object registry had 1 entries
09-30 10:44:05.038: VERBOSE/levels(6925): ::Bundle[{icon-small=17302166, present=true, scale=100, level=75, technology=Li-ion, status=3, voltage=3965, plugged=2, health=2, temperature=270}]
09-30 10:44:05.548: DEBUG/Database(9074): dbopen(): path = /data/data/de.retowaelchli.filterit/databases/filterit, flag = 6
09-30 10:44:05.548: DEBUG/Database(9074): dbopen(): path = /data/data/de.retowaelchli.filterit/databases/filterit, free size = 689
09-30 10:44:05.578: DEBUG/AndroidRuntime(9074): Shutting down VM
09-30 10:44:05.578: WARN/dalvikvm(9074): threadid=1: thread exiting with uncaught exception (group=0x4001d5a0)
09-30 10:44:05.628: ERROR/AndroidRuntime(9074): FATAL EXCEPTION: main
09-30 10:44:05.628: ERROR/AndroidRuntime(9074): java.lang.RuntimeException: Unable to start activity ComponentInfo{de.retowaelchli.filterit/de.retowaelchli.filterit.SplashScreenActivity}: java.lang.NullPointerException
09-30 10:44:05.628: ERROR/AndroidRuntime(9074):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1816)
09-30 10:44:05.628: ERROR/AndroidRuntime(9074):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1837)
09-30 10:44:05.628: ERROR/AndroidRuntime(9074):     at android.app.ActivityThread.access$1500(ActivityThread.java:132)
09-30 10:44:05.628: ERROR/AndroidRuntime(9074):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1033)
09-30 10:44:05.628: ERROR/AndroidRuntime(9074):     at android.os.Handler.dispatchMessage(Handler.java:99)
09-30 10:44:05.628: ERROR/AndroidRuntime(9074):     at android.os.Looper.loop(Looper.java:143)
09-30 10:44:05.628: ERROR/AndroidRuntime(9074):     at android.app.ActivityThread.main(ActivityThread.java:4196)
09-30 10:44:05.628: ERROR/AndroidRuntime(9074):     at java.lang.reflect.Method.invokeNative(Native Method)
09-30 10:44:05.628: ERROR/AndroidRuntime(9074):     at java.lang.reflect.Method.invoke(Method.java:507)
09-30 10:44:05.628: ERROR/AndroidRuntime(9074):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
09-30 10:44:05.628: ERROR/AndroidRuntime(9074):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
09-30 10:44:05.628: ERROR/AndroidRuntime(9074):     at dalvik.system.NativeStart.main(Native Method)
09-30 10:44:05.628: ERROR/AndroidRuntime(9074): Caused by: java.lang.NullPointerException
09-30 10:44:05.628: ERROR/AndroidRuntime(9074):     at de.retowaelchli.filterit.SplashScreenActivity.devil(SplashScreenActivity.java:109)
09-30 10:44:05.628: ERROR/AndroidRuntime(9074):     at de.retowaelchli.filterit.SplashScreenActivity.startupcheck(SplashScreenActivity.java:76)
09-30 10:44:05.628: ERROR/AndroidRuntime(9074):     at de.retowaelchli.filterit.SplashScreenActivity.onCreate(SplashScreenActivity.java:40)
09-30 10:44:05.628: ERROR/AndroidRuntime(9074):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1093)
09-30 10:44:05.628: ERROR/AndroidRuntime(9074):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1780)
09-30 10:44:05.628: ERROR/AndroidRuntime(9074):     ... 11 more
09-30 10:44:05.628: WARN/ActivityManager(1760):   Force finishing activity de.retowaelchli.filterit/.SplashScreenActivity
09-30 10:44:06.128: WARN/ActivityManager(1760): Activity pause timeout for HistoryRecord{40a95900 de.retowaelchli.filterit/.SplashScreenActivity}
09-30 10:44:06.228: WARN/ResourceType(1760): Skipping entry 0x7f040005 in package table 0 because it is not complex!

Thx for you help in advance!

  • 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-26T00:28:34+00:00Added an answer on May 26, 2026 at 12:28 am

    I dont see anywhere you init your ImageView iv from onCreate().

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

Sidebar

Related Questions

I created an abstract Activity which extends the android.app.Activity. Then I created an activity
I have a page which builded with jquery mobile and play framework. It's refreshing
I try to execute essentially some sql like this (which gets builded in a
i'm trying to submit my app, i have builded in simulator, then click on
I am trying to install a voice recognition app,that I builded ,on my device,
I builded a RibbonGroupBox like this in a C# file: public class TextControl :
I have a table dinamically generated by a mySQL query as this: | title
First of all, I have already readed this: Validating form dropdown in CodeIgniter But
Can someone explain this to me: I builded an really simple wcf service for
This is my code. When I click on my app logo, after the splash

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.