This is not quite an answer ... is it ?

On Tuesday, August 4, 2015 at 3:40:53 PM UTC+1, MagouyaWare wrote:
>
> The documentation does not state that each time the activity is created it 
> will also create a new process. From your email, the documentation states:
>
> "If the name assigned to this attribute begins with a colon (':'), a new 
> process, private to the application, is created when it's needed and the 
> activity runs in that process"
>
> The way I read this (maybe I'm wrong, but I don't think so), it means the 
> activity with the process name will have a process separate from other 
> activities in your app. If it needs to create a new process it will... 
> "when it's needed." If it can reuse that same process that it created 
> before, which is separate from all other activities in your app, it will do 
> that because it doesn't NEED to create a new one.
>
>
>
> *"Anyway that gives me some troubles since, for no good reasons, a 
> System.exit(0) is called at the end of the onDestroy() thus terminating the 
> whole VM and preventing the activity from being created and restarted 
> again, such bit was commented out during the tests I have made to make it 
> possible for me to gather the traces and debug the issue."*
> Ummm..... why in the world are you doing this? You should NEVER need to 
> call System.exit() in an Android app. That is the sign of a poorly designed 
> app.
>
> On Tue, Aug 4, 2015 at 4:12 AM pedr0 <[email protected] <javascript:>> 
> wrote:
>
>> Hi all,
>>
>> I am using such field in the AndroidManifest file to unsure that an 
>> activity it's started as a separate process each time, I am using it in 
>> this way :
>>
>>
>> <activity ....
>>   android:process=":testprocess"
>> ...
>> />
>>
>> Following the Android documentation the colon ":" should mean the 
>> activity will be started in a new private process each time, or at least it 
>> will not share the process with anybody else, quoting from the Android 
>> website:
>>
>> "If the name assigned to this attribute begins with a colon (':'), a new 
>> process, private to the application, is created when it's needed and the 
>> activity runs in that process"
>>
>> What I see is that this is not happening all the time, actually it looks 
>> like the process is recycled to recreate the same activity, what I have 
>> done is to add a print right at the top of pretty much every on* activity's 
>> methods:
>>
>> I am printing the object id and the process id obtained through
>>
>> android.os.process.myPid();
>>
>> Yes, I did not need it since the process id is printed out each time but 
>> I've realized it just now :-)
>>
>>
>> [...]
>> I/user  ( 9428): onCreate 9428 Object Activity@41b5da18
>> I/user  ( 9428): onStart 9428 Object Activity@41b5da18
>> I/user  ( 9428): onResume 9428 Object Activity@41b5da18
>> I/user  ( 9428): onStop 9428 Object Activity@41b5da18
>> I/user  ( 9428): onStart 9428 Object Activity@41b5da18
>> I/user  ( 9428): onResume 9428 Object Activity@41b5da18
>> I/user  ( 9428): onStop 9428 Object Activity@41b5da18
>> I/user  ( 9428): onStart 9428 Object Activity@41b5da18
>> I/user  ( 9428): onResume 9428 Object Activity@41b5da18
>> I/user  ( 9428): onStop 9428 Object Activity@41b5da18
>> I/user  ( 9428): onStart 9428 Object Activity@41b5da18
>> I/user  ( 9428): onResume 9428 Object Activity@41b5da18
>> I/user  ( 9428): onStop 9428 Object Activity@41b5da18
>> I/user  ( 9428): onStart 9428 Object Activity@41b5da18
>> I/user  ( 9428): onResume 9428 Object Activity@41b5da18
>> I/user  ( 9428): onStop 9428 Object Activity@41b5da18
>> I/user  ( 9428): onStart 9428 Object Activity@41b5da18
>> I/user  ( 9428): onResume 9428 Object Activity@41b5da18
>> I/user  ( 9428): onStop 9428 Object Activity@41b5da18
>> I/user  ( 9428): onDestroy 9428 Object Activity@41b5da18
>> I/user  ( 9428): onCreate 9428 Object Activity@41b5cad8 <-- New activity 
>> created using the old process
>> I/user  ( 9428): onStart 9428 Object Activity@41b5cad8
>> I/user  ( 9428): onResume 9428 Object Activity@41b5cad8
>> [...]
>>
>>
>> Such behavior is not always consistent, it could as it could not happen 
>> and sometimes the activity is really started in a new process.
>>
>>
>> Anyway that gives me some troubles since, for no good reasons, a 
>> System.exit(0) is called at the end of the onDestroy() thus terminating the 
>> whole VM and preventing the activity from being created and restarted 
>> again, such bit was commented out during the tests I have made to make it 
>> possible for me to gather the traces and debug the issue.
>>
>>
>> Unfortunately I can't change such incorrect application behavior 
>> nevertheless I wonder if I have some other tricks to play from an 
>> application point of view which enables the activity to be restarted in a 
>> new process each time.
>>
>> I wouldn't dislike for the sake of my own knowledge to be pointed where 
>> such behavior is implemented, where is the Activity created and started and 
>> where is decided to start it from a new process or not ?
>>
>>
>>
>> -- 
>> You received this message because you are subscribed to the Google
>> Groups "Android Developers" group.
>> To post to this group, send email to [email protected] 
>> <javascript:>
>> To unsubscribe from this group, send email to
>> [email protected] <javascript:>
>> For more options, visit this group at
>> http://groups.google.com/group/android-developers?hl=en
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "Android Developers" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" 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-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to