YuhanXu / omnidroid

Automatically exported from code.google.com/p/omnidroid
Apache License 2.0
0 stars 0 forks source link

Child activity/dialog causes parent activity to force close #93

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create Rule -> Time is -> +Action -> SMS -> SMS Send -> Param
2. Wait as each dialog along the chain has to Force Close

What is the expected output? What do you see instead?
SMS Send should force close, but the previous dialogs/activities should handle 
the bad return nicely if at all possible.

Original issue reported on code.google.com by case.and...@gmail.com on 22 Jun 2010 at 8:05

GoogleCodeExporter commented 8 years ago

Original comment by case.and...@gmail.com on 22 Jun 2010 at 8:32

GoogleCodeExporter commented 8 years ago
Testable by referencing a null pointer in a ActivityDlg class.
  View v = null;
  v.setVisibility(false);

Watch all parent activities crash in order.  :-/

Original comment by case.and...@gmail.com on 2 Jul 2010 at 9:46

GoogleCodeExporter commented 8 years ago

Original comment by case.and...@gmail.com on 3 Jul 2010 at 6:53

GoogleCodeExporter commented 8 years ago
Actually it's:
    View v = null;
    v.setVisibility(View.INVISIBLE);

Original comment by case.and...@gmail.com on 4 Jul 2010 at 9:18

GoogleCodeExporter commented 8 years ago
I'm not sure why this happens.  From the docs:

When an activity exits, it can call setResult(int)  to return data back to its 
parent. It must always supply a result code, which can be the standard results 
RESULT_CANCELED, RESULT_OK, or any custom values starting at RESULT_FIRST_USER. 
In addition, it can optionally return back an Intent containing any additional 
data it wants. All of this information appears back on the parent's 
Activity.onActivityResult(), along with the integer identifier it originally 
supplied.

If a child activity fails for any reason (such as crashing), the parent 
activity will receive a result with the code RESULT_CANCELED.

If I use:
    setResult(RESULT_CANCELED);
    finish();
it is handled properly.

If I use:
    View v = null;
    v.setVisibility(View.INVISIBLE);
it crashes the entire Activity Stack.

I can't think of how to fix this and haven't been able to find any references 
to this in the mailinglists or docs.

Original comment by case.and...@gmail.com on 4 Jul 2010 at 11:02

GoogleCodeExporter commented 8 years ago

Original comment by case.and...@gmail.com on 6 Jul 2010 at 2:20

GoogleCodeExporter commented 8 years ago
With new coding changes that limit the amount of crashing going on this is no 
longer as important of an issue, dropping milestone and priority.

Original comment by case.and...@gmail.com on 13 Jul 2010 at 11:20