Monday, August 1, 2011

[android-developers] Re: button id causes app to crash

mAddCoInfo = (EditText) findViewById(R.id.addCoInfo);
mAddPltInfo = (EditText) findViewById(R.id.addPltInfo);
mAddSquadInfo = (EditText) findViewById(R.id.addSquadInfo);
mPickWeapon = (EditText) findViewById(R.id.pickWeapon);
mPickDist = (EditText) findViewById(R.id.pickDist);
mPickLocation = (EditText) findViewById(R.id.pickLocation);

mAddData = (Button) findViewById(R.id.addData);
mPickDate = (Button) findViewById(R.id.pickDate);

deleteModeOn = new ImageView(getApplicationContext());
deleteModeOn.setImageResource(R.drawable.deletenotification);

this is all my code is doing around line 60, could it be that I have a
id for a button in the xml file but I don't have it assigned to a
handler variable assigned to it?

On Jul 29, 2:48 pm, Adam Ratana <adam.rat...@gmail.com> wrote:
> On Friday, July 29, 2011 12:58:04 PM UTC-4, DB12 wrote:
>
> > Adam, that makes some sense, I'll investigate it.
>
> > I took my app home from work and for some reason it did not crash when
> > I added that 3rd id (my home comp runs windows 7).  Then I took it
> > back to work (where we have xp) and it works fine with the extra id.
> > But then I added another custom dialog with 3 buttons and it crashed
> > again.
>
> The other thing I found is that sometimes you may need to check all your
> XMLs for any errors, too.  But if its getting a class cast exception and
> you're absolutely positive the ID you're using is the right one, it's
> probably an R generation issue, it may not be ordering the IDs right so
> yours is now pointing to the wrong type of view.

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

No comments:

Post a Comment