Hmmm...
But in my main Activity, I do create a variable "me" of type Person2,
and "me" is supposed to be created with a field known as "Id" of type
StrRecord.  So shouldn't "Id" be created at the same time as "me"? If
so, then I should be able to access "me.Id".

Moreover, if I change the field "Id" of type  StrRecord to be field
"Id" of type String, it works fine, even though I never created the
new string specifically...

Finally, If you are right, I don't see how I can call "new
StrRecord()" without creating a new variable which is different then
the "Id" field, and it is the "Id" field that I am trying to assign...


thanks,
jim



On Sep 26, 5:51 pm, Mark Murphy <[EMAIL PROTECTED]> wrote:
> gymshoe wrote:
> > But the following code fails. It fails whenever I try to assign a
> > value to the "value" field or the "visibility" field. (It fails with
> > either direct assignment or with creating a setter method -not
> > shown.).  The error code indicates a null pointer exception is thrown
> > when I try to make the assignment, but I do not know why this should
> > be the case, or how to fix it.... (BTW if I don't use the extra
> > subClass containing two pieces of data, and just use a String type in
> > the primary Class, it works fine, but that's not what I was hoping to
> > do...)
>
> You're never creating an instance of StrRecord. You're declaring a
> variable named Id that is of a StrRecord type, but you are not calling
> new StrRecord() anywhere that I see. Hence, Id is null (or, technically,
> could be a garbage value) and, upon usage, goes blooey.
>
> --
> Mark Murphy (a Commons Guy)http://commonsware.com
> Warescription: All titles, revisions, & ebook formats, just $35/year
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" 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-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to