Saturday, October 23, 2010

Got It!

I guess I just needed some time away from the code and some different search keywords. I identified the cause this morning, but was suspect of it last night. Since my initial round with Google didn't provide any results that were usable, I was left with two options. First was to just give up, but this is not really my style. The second option, hack and hack until it works was what I went with.

I thought my code was already stripped down to the bare essentials so I just started chopping. There were only a few lines that I knew were 100% required to implement but everything else just got cut. I was stuck with a non-functional app again. I put the few lines back one by one until it worked. As great as it was to get it functioning the way I expected, I still didn't understand what the difference was. 

I went to Google to figure out what the line did that I removed. In the top few results, I found a post with somebody having the exact same problem as well as the explanation of the issue. The basic answer is that the line, myIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK)caused my sub-activity to not really be a sub-activity. So as soon as the new activity was launched, it was becoming it's own application so my main activity would immediately receive the "RESULT_CANCELED" result. 

We have a bit of a busy weekend so I am not sure when I will get back to my Arduino Client, but I am hoping it will be this weekend still. Either way, the kids are getting up. I just wanted to take advantage of this extra morning time before my normal day kicks in.

No comments:

Post a Comment