Android - displays a constant view of all actions

I would like to recreate functionality similar to Swing GlassPane to display animations while the user uses the β€œbelow” application in normal mode. I can’t just create a separate layout and attach it to each type of activity, since the state of the animation will be lost when switching actions. Is there a way to keep a constant view of all the actions of the Android application?

Thanks.

+6
android
source share
2 answers

No no. Each activity works in its own flow and by design should be autonomous autonomous.

But you can save the animation state in the database or in sharedPreferences and start it with a new action.

You can also use Spinner or another control instead of individual actions. Then you can have a constant look.

+1
source share

why not think in TabActivity?

Hello! I do this earlier with TabActivity, never with a single action, always with many actions that I started with, get their windows and set them as the window view of the TabActivity window ... I have not tested the code below, as this is an idea, but maybe , recently (when I will be at home), I will write an example ...

So my idea is ... TabActivity consists of TabWidget and FrameLayout, where activity windows are highlighted.

TabWidget can be any kind, so you can place an animated view here.

The hardest part is that if you start the action with a child of TabActivity, the new activity will be on top of TabActivity. To override this behavior, TabActivity must know when a nested activity wants to start another action. When this happens, TabActivity should clean its decor (with the old window activity) and set the decorative look of the new one. Something like that:

in a child activity, start a new action when we click the button: ... on the client ...

((MyTabActivity)getParent()).createNewActivity("NewActivity", NewActivity.class); 

now we say that TabActivity, that it should start a new activity, get a new view of the activity decor and put this view in the view of the TabActivity scenery ... so createNewActivity will do something like this:

 public void createNewActivity(String activityId, Class<?> class1) { Intent intent = new Intent( getIntent().getAction() ).setClass(MyTabActivity.this, class1); Window wList = getLocalActivityManager().startActivity(activityId, intent); getWindow().setContentView(wList.getDecorView()); } 

I hope you understand me.

I will write an example later

0
source share

All Articles