This lesson teaches you to
You should also read
finish(). The system may also destroy your activity if it's
currently stopped and hasn't been used in a long time or the foreground activity requires more
resources so the system must shut down background processes to recover memory.When your activity is destroyed because the user presses Back or the activity finishes itself, the system's concept of that
Activity instance is gone forever because
the behavior indicates the activity is no longer needed. However, if the system destroys
the activity due to system constraints (rather than normal app behavior), then although the actual
Activity instance is gone, the system remembers that it existed such that if
the user navigates back to it, the system creates a new instance of the activity using a set of
saved data that describes the state of the activity when it was destroyed. The saved data that the
system uses to restore the previous state is called the "instance state" and is a collection of
key-value pairs stored in a Bundle object.
Caution: Your activity will be destroyed and recreated each time
the user rotates the screen. When the screen changes orientation, the system destroys and recreates
the foreground activity because the screen configuration has changed and your activity might need to
load alternative resources (such as the layout).
By default, the system uses the Bundle instance state to save information
about each View object in your activity layout (such as the text value entered
into an EditText object). So, if your activity instance is destroyed and
recreated, the state of the layout is restored to its previous state with no
code required by you. However, your
activity might have more state information that you'd like to restore, such as member variables that
track the user's progress in the activity.
Note: In order for the Android system to restore the state of
the views in your activity, each view must have a unique ID, supplied by the
To save additional data about the activity state, you must override
the android:id attribute.onSaveInstanceState() callback method.
The system calls this method when the user is leaving your activity
and passes it the Bundle object that will be saved in the
event that your activity is destroyed unexpectedly. If
the system must recreate the activity instance later, it passes the same Bundle object to both the onRestoreInstanceState() and onCreate()
methods.
Figure 2. As the system begins to stop your activity, it
calls
onSaveInstanceState() (1) so you can specify
additional state data you'd like to save in case the Activity instance must be
recreated.
If the activity is destroyed and the same instance must be recreated, the system passes the state
data defined at (1) to both the onCreate() method
(2) and the onRestoreInstanceState() method
(3).Save Your Activity State
As your activity begins to stop, the system calls
onSaveInstanceState() so your activity can save state information with a collection of key-value
pairs. The default implementation of this method saves information about the state of the activity's
view hierarchy, such as the text in an EditText widget or the scroll position
of a ListView.To save additional state information for your activity, you must implement
onSaveInstanceState() and add
key-value pairs to the Bundle object. For example:static final String STATE_SCORE = "playerScore"; static final String STATE_LEVEL = "playerLevel"; ... @Override public void onSaveInstanceState(Bundle savedInstanceState) { // Save the user's current game state savedInstanceState.putInt(STATE_SCORE, mCurrentScore); savedInstanceState.putInt(STATE_LEVEL, mCurrentLevel); // Always call the superclass so it can save the view hierarchy state super.onSaveInstanceState(savedInstanceState); }
Caution: Always call the superclass implementation of
onSaveInstanceState() so the default implementation
can save the state of the view hierarchy.Restore Your Activity State
When your activity is recreated after it was previously destroyed, you can recover your saved state from the
Bundle that the system
passes your activity. Both the onCreate() and onRestoreInstanceState() callback methods receive
the same Bundle that contains the instance state information.Because the
onCreate() method is called whether the
system is creating a new instance of your activity or recreating a previous one, you must check
whether the state Bundle is null before you attempt to read it. If it is null,
then the system is creating a new instance of the activity, instead of restoring a previous one
that was destroyed.For example, here's how you can restore some state data in
onCreate():Instead of restoring the state during@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Always call the superclass first // Check whether we're recreating a previously destroyed instance if (savedInstanceState != null) { // Restore value of members from saved state mCurrentScore = savedInstanceState.getInt(STATE_SCORE); mCurrentLevel = savedInstanceState.getInt(STATE_LEVEL); } else { // Probably initialize members with default values for a new instance } ... }
onCreate() you
may choose to implement onRestoreInstanceState(), which the system calls
after the onStart() method. The system calls onRestoreInstanceState() only if there is a saved
state to restore, so you do not need to check whether the Bundle is null:public void onRestoreInstanceState(Bundle savedInstanceState) { // Always call the superclass so it can restore the view hierarchy super.onRestoreInstanceState(savedInstanceState); // Restore state members from saved instance mCurrentScore = savedInstanceState.getInt(STATE_SCORE); mCurrentLevel = savedInstanceState.getInt(STATE_LEVEL); }
Caution: Always call the superclass implementation of
To learn more about recreating your activity due to a
restart event at runtime (such as when the screen rotates), read Handling Runtime Changes.onRestoreInstanceState() so the default implementation
can restore the state of the view hierarchy.

I tried several software options to replace Outlook, and finally settled on 
Finally,
I had to address the fact that I'd often think of things I needed to do
while driving. I can send a text message from my cell phone and the
message ends up on my to-do list -- but that isn't a safe option while
driving. The problem was solved
The
best choice appears to be a paid program -- SalesForce.com. The
deal-breaker for me is the way they integrate with the suite of Google
products that have helped my productivity so much. In fact, last Spring
they rolled out a specially branded product: "



Una excelente técnica para iniciar en éste tema es: siéntense juntos y escriban un presupuesto para su primer mes de casados. Si ambos trabajan, ¿con cuánto disponen y cómo planean distribuirlo?, siempre planeen qué porcentaje pueden gastar y cuánto deben ahorrar. Para ello deben analizar sus prioridades, gustos, necesidades. También deben platicar sobre sus proyectos a largo, mediano y corto plazo, y hacer propósitos y acciones que los lleven a cumplirlos.
¿Cuáles son sus expectativas? Siempre es una buena idea poner en la balanza el trabajo y el hogar, y tratar de darle tiempo de calidad a ambos. Si trabajarán de 9 a 5 pueden verse para comer juntos. Es justo que ambos prioricen su tiempo juntos, su tiempo con amigos, su tiempo a solas. Todo es cuestión de hablar y darse cuenta de lo que la otra persona tiene en mente.
Aunque suene cliché, deben preguntarse “¿en dónde me veo en un año?, ¿en cinco?, ¿en 15? ¿Cuántos hijos quiero tener?, ¿quiero tener hijos?, ¿cuáles son mis ambiciones?, ¿qué haremos si hay una oferta de trabajo que implique a alguno de los dos mudarse? ¿Qué pasará si alguien de los dos decide no trabajar? Y sobre todo, ¿cómo se siente mi pareja al respecto?
Este tema es muy importante, porque aunque parezca que te lo está diciendo tu abuelita, las cosas cambian después del matrimonio. Es simple, con un matrimonio vienen más responsabilidades, y con ellas, más presiones y menos tiempo para la intimidad. Pero no siempre debe ser así, por eso es indispensable que hablen abierta y sinceramente. Aquí lo más importante es no dejar que la llama de la pasión de extinga, y para ello deben saber sus gustos, sus fantasías, sus deseos, sus historias, las cosas que quieren probar, las cosas que no quieren probar, las cosas que han probado y quieren volver a hacer y también las que no. ¡TODO! Porque más vale saber y poner manos a la obra a lamentarse por el resto de sus vidas.
Toda relación tiene sus puntos altos pero también sus puntos bajos. Cuando éstos últimos lleguen, deben estar preparados, deben discutir cómo se sienten respecto a terapias con profesionales en el tema, y por qué no, crear sus propias. Ustedes se han casado por una razón, porque son el uno para el otro y han jurado amarse hasta la muerte, por ende ustedes pueden crear su propios códigos para saber sobrellevar un punto bajo en su relación. Lo importante es no dejar que el enojo o la discordia se apoderen de ustedes, pues su hogar y sus hijos son los principales afectados.
Este punto aunque parezca sencillo puede ser la causa de muchos conflictos, especialmente en los primeros años. El hablar de los roles de cada quien puede ser una herramienta muy efectiva y segura. Deben juntarse con calma, hablar sobre las actividades de la casa y ser abiertos, tolerantes y tratar de apoyarse el uno al otro, deben decidir quién hará qué y cuándo, y lo más importante es que deben apegarse a los acuerdos que tengan. Muchas veces uno debe sacrificar un poco, pero al final, la disciplina en el matrimonio siempre es bien recompensada.
Deben saber las cosas que uno hace y que al otro no le parecen muy higiénicas, y llegar a acuerdos para cambiarlas y llegar a un punto intermedio en el que ambos estén contentos. Subir de peso es también algo que muy frecuentemente pasa, se debe ser abierto y honesto con la manera en que la otra persona se siente respecto a esto. ¿Tienen enfermedades? Deben compartir y discutir su cuadro clínico y tener un plan de acción para prevenir riesgos. ¿Les gustan los deportes?, ¿pueden practicarlo juntos?
¿Cómo piensan planear los viajes en familia? ¿Qué tan apegada será la familia de tu pareja en su relación?, ¿o tu propia familia? Deben sentirse cómodos respecto a este tema, y para ello deben sentar algunas reglas, como por ejemplo: tiempos de visita, llamadas, otros tipos de comunicación. Muchas veces tu pareja piensa una cosa sobre tu familia que aún no sabes, para ello deben ser siempre honestos y respetuosos.
¿Cuáles son sus prioridades? Las amistades después del matrimonio pueden llegar a desgastarse un poco y deben apoyarse el uno al otro para que esto no suceda. También tu pareja puede tener amigos que no te simpaticen tanto, ¿cómo piensan llevar eso? ¿Cómo te sientes si tu pareja sale con sus amigos/as de vez en cuándo? Hablar sobre ello con anticipación puede evitar cientos de momentos bochornosos que pueden resultar muy mal. También deben discutir sobre cómo pueden cultivar su relación, es decir, sus salidas juntos o en familia, momentos de diversión, etc.













