Well its pretty clear from your stack trace and code that sometimes
the howtoplayButton is null.
If its working most of the time, are you sure you don't have multiple
layouts of the same view?
Double check that *all* versions of R.layout.main in your app contain
the button.

in fact, search for "howtoplayButton" in main.xml and see what you
come up with... every one will need that button, or you need to handle
cases when it doesn't.

- Brill Pappin

On Mar 13, 11:40 pm, acr <[email protected]> wrote:
> sorry for got to add this..
>
> 53:    howtoplayButton.setOnClickListener(this);
>
> this works on 99.9 percent of devices
>
> here's a larger snippet:
> @Override
>         public void onCreate(Bundle savedInstanceState) {
>                 super.onCreate(savedInstanceState);
>                 setContentView(R.layout.main);
>
>                 setVolumeControlStream(AudioManager.STREAM_MUSIC);
>                 //Get Screen Width
>                 Panel.screenWidth =
> getWindowManager().getDefaultDisplay().getWidth();
>                 // Set up click listeners for all the buttons
>                 //View continueButton = findViewById(R.id.continue_button);
>                 //continueButton.setOnClickListener(this);
>                 View newButton = findViewById(R.id.new_button);
>                 newButton.setOnClickListener(this);
>                 View aboutButton = findViewById(R.id.about_button);
>                 aboutButton.setOnClickListener(this);
>                 View howtoplayButton = findViewById(R.id.howtoplay_button);
>                 howtoplayButton.setOnClickListener(this);
>                 View exitButton = findViewById(R.id.exit_button);
>                 exitButton.setOnClickListener(this);
>                 View buyButton = findViewById(R.id.buy_full);
>                 buyButton.setOnClickListener(this);
>                 newButton.startAnimation(AnimationUtils.loadAnimation(this,
> R.anim.shake));
> ......
>
> On Mar 13, 11:30 pm, Dianne Hackborn <[email protected]> wrote:
>
>
>
>
>
>
>
> > Given this:
>
> > Caused by: java.lang.NullPointerException at
> > com.myco.myappfree.myapp.onCreate(myapp.java:53)
> > at 
> > android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
> > at 
> > android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
>
> > What is on line 53 of your app?
>
> > On Sun, Mar 13, 2011 at 8:03 PM, acr <[email protected]> wrote:
> > > I have a relatively successful app in the android market that a very
> > > small amount of users experience force close on start up of the app.
>
> > > It is not happening on a specific device, im not sure if it's
> > > something these users have installed that is interfering with the app.
> > > I've tried to troubleshoot with a few users having the problem, but
> > > cannot get to the bottom of it.
>
> > > it happens on both rooted and non-rooted phones
>
> > > I keep getting a NullPointerException for a small number of users who
> > > use a variety of phones that normally work.
> > > anyone know what may be causing this, or how to get around this? I
> > > can't figure this one out and cannot replicate the problem, please
> > > help.
>
> > > below are the stack traces from the market (package name changed to
> > > not spam the board)
>
> > > java.lang.RuntimeException: Unable to start activity
> > > ComponentInfo{com.myco.myappfree/com.myco.myappfree.myapp}:
> > > java.lang.NullPointerException
> > > at
> > > android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
> > > 2663)
> > > at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:
> > > 2679)
> > > at android.app.ActivityThread.access$2300(ActivityThread.java:125)
> > > at android.app.ActivityThread$H.handleMessage(ActivityThread.java:
> > > 2033)
> > > at android.os.Handler.dispatchMessage(Handler.java:99)
> > > at android.os.Looper.loop(Looper.java:123)
> > > at android.app.ActivityThread.main(ActivityThread.java:4627)
> > > at java.lang.reflect.Method.invokeNative(Native Method)
> > > at java.lang.reflect.Method.invoke(Method.java:521)
> > > at com.android.internal.os.ZygoteInit
> > > $MethodAndArgsCaller.run(ZygoteInit.java:858)
> > > at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
> > > at dalvik.system.NativeStart.main(Native Method)
> > > Caused by: java.lang.NullPointerException
> > > at com.myco.myappfree.myapp.onCreate(myapp.java:53)
> > > at
> > > android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:
> > > 1047)
> > > at
> > > android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
> > > 2627)
> > > ... 11 more
>
> > > --
> > > You received this message because you are subscribed to the Google
> > > Groups "Android Developers" group.
> > > To post to this group, send email to [email protected]
> > > To unsubscribe from this group, send email to
> > > [email protected]
> > > For more options, visit this group at
> > >http://groups.google.com/group/android-developers?hl=en
>
> > --
> > Dianne Hackborn
> > Android framework engineer
> > [email protected]
>
> > Note: please don't send private questions to me, as I don't have time to
> > provide private support, and so won't reply to such e-mails.  All such
> > questions should be posted on public forums, where I and others can see and
> > answer them.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to