Neto Lima,
The activity is finishing or being destroyed by the system.
The entire lifetime of an activity happens between the first call to onCreate(Bundle) through to a single final call to onDestroy().
The entire lifetime of an activity happens between the first call to onCreate(Bundle) through to a single final call to onDestroy().
Então, não seria para ser chamado ao finalizar a activity?
Tipo...activity 1 call -> activity 2...(then, close activity 2 with button return) está activity não teria que disparar o metodo OnDestroy()?
Lucio,
A ideia não é salvar dados e tal.
É simplesmente controlar o botal de voltar do android,
Para que ao voltar com o botão, disparar um evento, e ele executar uma outra activity.
Grato,
Abraços,
Att.
Psy Khé
2012/4/24 luciofm <luciofm@gmail.com>
e mais...
"Note: do not count on this method being called as a place for saving
data! For example, if an activity is editing data in a content
provider, those edits should be committed in either onPause() or
onSaveInstanceState(Bundle), not here. This method is usually
implemented to free resources like threads that are associated with an
activity, so that a destroyed activity does not leave such things
around while the rest of its application is still running. There are
situations where the system will simply kill the activity's hosting
process without calling this method (or any others) in it, so it
should not be used to do things that are intended to remain around
after the process goes away."
Lúcio Maciel
luciofm@gmail.com
2012/4/24 Neto Lima <desilio@gmail.com>:
> O OnDestroy só é chamado quando seu aplicativo é eliminado da memória, no
> seu exemplo não deve estar acontecendo isso.
>
> Dá uma lida no ciclo de vida de uma activity
> http://developer.android.com/reference/android/app/Activity.html
>
>
> 2012/4/24 Psy Khé <psykhe6@gmail.com>
>>
>> Poxa,
>>
>> Bati um pouco a cabeça aqui, ...
>>
>> Eu creio que o metodo da activity OnDestroy() etc, deveriam ser chamados.
>>
>> Porém não está ocorrendo. Testei em mais de uma activity.
>>
>> Segue:
>>
>> protected void OnStart() {
>> super.onStart();
>> Log.d("POW", "ONSTART!!!");
>> }
>>
>> protected void OnDestroy() {
>> super.onDestroy();
>> Log.d("POW", "ONDESTROY!!!");
>> }
>>
>> Não loga nada,
>>
>> Deve ter algum equivoco, não é possivel.
>>
>> Hum?
>>
>> Grato,
>>
>> Att.
>>
>> Psy Khé.
>
>
>
>
> --
> ----------------------------------
> | TURN THE | Se acha esperto? então encare
> |---------------------------------| esse desafio http://bit.ly/pugpad
> | LIGHTS ON |
> ----------------------------------
>
> @netolobo
>






0 comentários:
Postar um comentário