Activitiy Behavior

by Shekhar » Fri, 23 Apr 2010 01:21:02 GMT


Sponsored Links
 I have a problem.

I have to design an application in which three activities A ,B,C are
such that if I move across the activities, previous
activities are not killed.A,B,C should be in the application stack so
that their OnCreate
function is not called everytime.Activities should be killed only when
finish() is called explicitly.What is the solution for it?

Also what intent flag I should use to call another activity?

Thanks,
Shekhar

--



Activitiy Behavior

by Mark Murphy » Fri, 23 Apr 2010 01:31:11 GMT


 


If the user goes from A -> B -> C, then presses the BACK button, C will
be destroyed. If the user presses the BACK button again, B will be
destroyed.

If the user goes from A -> B, then takes a phone call and meanders away
from your application for a while, A or B may be destroyed to free up
RAM (though you will be able to use onSaveInstanceState() to retain some
knowledge of your current condition).

None of that is avoidable. All of that is very important for the proper
operation of the users' phones.

The only way to have the functionality of A, B, and C all exist as a
unit is for it all to *be* a unit -- having a *single* activity do all
three things.

On the whole, I think Android works better where A, B, and C can work
independently, and so I really recommend you consider why your design
requires those activities to all be in memory at the same time.


I do not understand this question, sorry.

-- 
Mark Murphy (a Commons Guy)
 http://commonsware.com  |  http://twitter.com/commonsguy 

Android Training in US: 14-18 June 2010:  http://bignerdranch.com 

--


Sponsored Links


Activitiy Behavior

by Shekhar » Fri, 23 Apr 2010 01:55:48 GMT


 Hi,

1.Thanks for your prompt reply.Why I need to have all the three
activities in the stack because I  want to avoid the time it takes
to create the activity.So that user will not feel smoother screen
transition.to explain in a better way suppose that A and B activity
has a text view that updates the timer that is updated from a common
place.

Only objective is to have a smoother transition.

2.What is the use of "Single Top" activity.If I press back key on a
single top activity.Will it be killed?

Thanks,
Shekhar





>



Activitiy Behavior

by Mark Murphy » Fri, 23 Apr 2010 02:02:06 GMT


 


Then improve the performance of the activities, so they start up faster.

Or, redesign the UI such that the transition time between activities is
not going to be distracting for users.


Yes.

-- 
Mark Murphy (a Commons Guy)
 http://commonsware.com  |  http://twitter.com/commonsguy 

Android Online Training: 10-14 May 2010:  http://onlc.com 

--



Activitiy Behavior

by Shekhar » Fri, 23 Apr 2010 02:22:05 GMT


 Hi Murphy,

Thanks for your suggestions.

I have a basic querry.suppose all  the three activities are declared
as singletop and suppose from activity A i call
B activity with intent flag as

i.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
startActvity(i)

and from B->C the same intent.Now if i call the activity Aor B from C
with the same intent flag .will the oncreate() function of A,B will be
called again?

If not then it means that the A,B,C are there in the application stack
and their old instance is called again? Am I right?

Thanks,
Shekhar





>



Activitiy Behavior

by Shekhar » Fri, 23 Apr 2010 02:24:09 GMT


 Hi Murphy,

Thanks for your suggestions.

I have a basic querry.suppose all  the three activities are declared
as singletop and suppose from activity A i call
B activity with intent flag as

i.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
startActvity(i)

and from B->C the same intent.Now if i call the activity Aor B from C
with the same intent flag .will the oncreate() function of A,B will be
called again?

If not then it means that the A,B,C are there in the application stack
and their old instance is called again? Am I right?

Thanks,
Shekhar





>



Activitiy Behavior

by Mark Murphy » Fri, 23 Apr 2010 02:29:53 GMT


 


Possibly. Those activities might have been destroyed (e.g., to free up RAM).


AFAIK, yes.

However, bear in mind that the user can press the BACK button, which
will destroy an activity, regardless of singleTop or whatever.

-- 
Mark Murphy (a Commons Guy)
 http://commonsware.com  |  http://twitter.com/commonsguy 

Android Online Training: 10-14 May 2010:  http://onlc.com 

--



Activitiy Behavior

by faizan khan » Fri, 23 Apr 2010 02:39:21 GMT


 use ViewFlipper whereby you can flip views in the same activity and get the
desired result.






>



Other Threads

1. SOLD WTS Nexus One new 6,88jt

Sorry baru sempet update
Sudah laku :D

Nanti kalo ada lg diposting.
Sorry buat yg uda japri belom sempet kebales

Thx all




-- 
Sent from my mobile device

-- 
"Indonesian Android Community [id-android]" 

2. Query related to adding a new flag in the WindowManager (Similar to FLAG_IGNORE_CHEEK_PRESSES)

Hi All,

I am working on an adding a FLAG similar to FLAG_IGNORE_CHEEK_PRESSES.
I have added an entry in the WindowManager.java for my flag and in the
Phone application activity incallscreen.java i have added this flag
along with FLAG_IGNORE_CHEEK_PRESSES using
getWindow().addFlags(WindowManager.LayoutParams.MY_FLAG_ENTRY). Also
in the dispatchPointer method of WindowManagerService.java i am
checking for this current window flag along with
FLAG_IGNORE_CHEEK_PRESSES.

I have following queries:
1. Is this only i need to do to create a new flag and application can
then register for this one ?
2. Also i commented the statement
getWindow().addFlags(WindowManager.LayoutParams.FLAG_IGNORE_CHEEK_PRESSES)
in the InCallScreen.java but still i could see that the condition
if ((target.mAttrs.flags &
 
WindowManager.LayoutParams.FLAG_IGNORE_CHEEK_PRESSES) != 0) {
being satisfied. Can someone let me about this?

Thanks in advance
Rahul

-- 

3. Batere N1

4. White Paper - Sony Ericsson Vivaz, the HD ready phone

5. OOT: lagi di gedung indosat

6. Need help on how to execute a ARM executable on Zoom2 board

7. Solved Wta: nandroid backup