With that code, you are most likely getting a NullPointerException, as blip has no parent as far as your program is concerned. This is an issue with the context of events, as whenever the blip in question is not the e.getBlip() there is no parent and no children. It gets quite annoying.
However, Chris' solution should work for this, just avoid all parents and children that are not provided from e.getBlip(). On Nov 19, 8:42 pm, "Chris C." <[email protected]> wrote: > Oh, quick follow-up: on a more careful read of your code, that _might_ > work? I guess? I generally get the blip using the event method; I've > never used the parent/children methods for anything since they're not > necessary for the way my robot works. > > On Nov 19, 8:40 pm, "Chris C." <[email protected]> wrote: > > > > > Actually, for this case (and I'm familiar with this; I've written a > > roll-bot myself), you use the getBlip() method associated with the > > event to get the blip that triggered the event: > > > if (e.getType() == EventType.BLIP_SUBMITTED) { > > Blip submittedBlip = e.getBlip(); > > ... > > > } > > > and then continue on calculating rolls, inserting text, creating new > > blips, etc., as necessary. > > > On Nov 19, 1:53 am, Bryan Devaney <[email protected]> wrote: > > > > having a little trouble with my first non tutorial bot. basic "roll- > > > rot". if a blip contains the string "roll xDy" (x,y being ints) then > > > generate output. thought i had it all worked out, uploaded and > > > nothing. so im going back through my code and im thinking maybe i > > > assumed a little too much from the api. > > > > in my code i use blip_submitted, make my new blip, and then get the > > > parent blip > > > > if (e.getType() == EventType.BLIP_SUBMITTED) { > > > Blip blip = wavelet.appendBlip(); > > > Blip mBlip= blip.getParent(); > > > .. > > > > then attach the textviews and extract the text > > > > TextView textView = blip.getDocument(); > > > TextView mTextView = mBlip.getDocument(); > > > String s=mTextView.getText(); > > > > now im just wondering if i got the wrong end of the stick entirely. > > > does getParent() return the blip that when submitted caused the > > > BLIP_SUBMITTED event? > > > > or am i attempting to use a method that would only apply to an > > > embedded blip. > > > > sorry for the newbish question but my google searches didn't turn up > > > anything helpful (though that may be im asking the wrong questions) > > > > anyway thanks for any help, > > > sincerly > > > bryan devaney -- You received this message because you are subscribed to the Google Groups "Google Wave API" 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/google-wave-api?hl=.
