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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T16:36:53+00:00 2026-05-15T16:36:53+00:00

I have been slowing learning and building my first android app. I’m VERY new

  • 0

I have been slowing learning and building my first android app. I’m VERY new to java but have already done a couple of projects in C#, VB.NET (back in the day), Objective-C (have 6 apps in the store) and Fortran (waaaaaaaaaaaaaaaaaaaay back in the day 😉

So I just received from overseas a htc legend (I’m not in the US), which i bought in order to have a decent mid-level device for development (it’s running non-rooted adnroid 2.1)

The application I have been developing is target level 4 (android 1.6). It uses a 5 Mb sqlite3 database with a .mp3 extension to avoid compression within the apk and proper copying from assets to system folder.

It all works fine on the emulator, and on the device I see that the file size of the app after copying the database matches exactly what I see on the emulator.

now, on my main activity with a list view and a spinner, I bind some data through two array adapters. when running on the device all does smoothly. but when trying to run on the device this part of the code:

public class mainAct extends Activity implements OnItemSelectedListener, TextWatcher, OnItemClickListener
{   
        /** members */
        //private EditText searchtext;
        private ListView designations;
        private ArrayAdapter<String> adapterShapes;
        private ArrayAdapter<String> adapterTypes;
        private Spinner types;
      .  
      .  
      .    
    public void onCreate(Bundle savedInstanceState)   
    {  
      .  
      .  
      .    
        // DESIGNATIONS  
        // 
        adapterShapes = new ArrayAdapter<String>(this,R.layout.list_item,shapes);       // custom TextView Adapter  
        designations=(ListView)findViewById(R.id.designations);
        Log.e("MAIN.ACCT", "ok to 172");
        designations.setAdapter(adapterShapes);
        Log.e("MAIN.ACCT", "ok to 174");
        designations.setOnItemClickListener(this);

        // TYPES
        //
        adapterTypes=new ArrayAdapter<String>(this,R.layout.spinner_item,DT.get().typesInLibrary);
        types=(Spinner)findViewById(R.id.types);
        types.setAdapter(adapterTypes);
        types.setOnItemSelectedListener(this);
      .  
      .  
      .  
    }
}

Both designations.setAdapter(adapterShapes);
& types.setAdapter(adapterTypes);

give me a Null Pointer exception.

I’m using eclipse under mac, the LogCat window throws:

06-25 18:41:37.842:
ERROR/AndroidRuntime(9523): Uncaught
handler: thread main exiting due to
uncaught exception

06-25 18:41:37.891:
ERROR/AndroidRuntime(9523):
java.lang.RuntimeException: Unable to
start activity
ComponentInfo{com.davidhomes.steel/com.davidhomes.steel.mainAct}:
java.lang.NullPointerException

06-25 18:41:37.891:
ERROR/AndroidRuntime(9523): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2596)

06-25 18:41:37.891:
ERROR/AndroidRuntime(9523): at

android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2621)

06-25 18:41:37.891:
ERROR/AndroidRuntime(9523): at
android.app.ActivityThread.access$2200(ActivityThread.java:126)

06-25 18:41:37.891:
ERROR/AndroidRuntime(9523): at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1932)

06-25 18:41:37.891:
ERROR/AndroidRuntime(9523): at
android.os.Handler.dispatchMessage(Handler.java:99)

06-25 18:41:37.891:
ERROR/AndroidRuntime(9523): at
android.os.Looper.loop(Looper.java:123)

06-25 18:41:37.891:
ERROR/AndroidRuntime(9523): at
android.app.ActivityThread.main(ActivityThread.java:4595)

06-25 18:41:37.891:
ERROR/AndroidRuntime(9523): at
java.lang.reflect.Method.invokeNative(Native
Method)

06-25 18:41:37.891:
ERROR/AndroidRuntime(9523): at
java.lang.reflect.Method.invoke(Method.java:521)

06-25 18:41:37.891:
ERROR/AndroidRuntime(9523): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)

06-25 18:41:37.891:
ERROR/AndroidRuntime(9523): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)

06-25 18:41:37.891:
ERROR/AndroidRuntime(9523): at
dalvik.system.NativeStart.main(Native
Method)

06-25 18:41:37.891:
ERROR/AndroidRuntime(9523): Caused by:
java.lang.NullPointerException


————————————————————– 06-25 18:41:37.891:
ERROR/AndroidRuntime(9523): at
com.davidhomes.steel.mainAct.onCreate(mainAct.java:183)

————————————————————–

06-25 18:41:37.891:
ERROR/AndroidRuntime(9523): at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)

06-25 18:41:37.891:
ERROR/AndroidRuntime(9523): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2544)

06-25 18:41:37.891:
ERROR/AndroidRuntime(9523): … 11
more

06-25 18:46:38.252:
ERROR/ActivityManager(99): fail to set
top app changed!

Line 183 is the first setAdapter call (designations.setAdapter(adapterShapes);), when I comment it out the second setAdapter is the one breaking code

I’m a little lost here, the adapters show the proper number of items on the log window when running from the simulator and the device.

I admit to being a noob to both java and android, so any help is highly appreciated.

regards
david

  • 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-15T16:36:54+00:00Added an answer on May 15, 2026 at 4:36 pm

    Oops! it was my fault all along, somehow I had TWO layouts (one for different resolutions), the one being used on my device did not have the proper ListView and Spinner ID. That alternative layout was collapse into a folder and I just forgot about it (I had paused development of the app for about 2 month until I actually got a device to test on).

    the one working fine was installing on the simulator but not on the device and vice-versa, weird as the good one matches the resolution of my device (I’m pretty sure I’m also missing something there but that’s not important right now)

    Still, thanks Chris for pointing me to looking at the Null return value on findViewById. Being new to android I was lost as to were to begin

    Best regards
    david

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

Sidebar

Related Questions

I am absolutely new to the Android platform and have been building an application
Lately I have been experiencing Eclipse Galileo (3.5) slowing down under Java 1.5b12 OR
Have been studying the file system related classes of Adobe AIR 1.5, but so
I have been using PHP and JavaScript for building my dad's website. He wants
I have a new web app that is packaged as a WAR as part
I know similar questions have been asked before but i think this is slightly
I have been looking around on how to customize Android TabWidget using XML with
I have been reading lots of articles and also questions here on SO but
Currently learning Linq to Entity. I been successful, but came stumped with the orderby
I have been so confused lately regarding difference between predicate and function in first

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.