I know you should use services, backgroundtasks and AsynTask for long running processes. I've also seen this and this.
is there any way to start a activity in background and when process finishes, change the activity to current activity?
Suppose I have two activity A and B.
When user clicks on a view(a item in bottom navbar for example) on activity A, the desired action is to animate that view then start activity B.
But the problem is that there is a lag between animation terminate and starting of Activity B.
What I'm thinking of is to setup activity B while the view in activity A is animating.
As soon as animation terminates the activities swipe smoothly.
Is there a possible solution for this?
Related
How can i keep an animation alive while the transitions between activities are occurring?
Suppose that i have two activities A and B. Activity B has a "slide in" transition over the activity A. I want to keep a button rotating in my activity A while the transition of B is occurring. My button stop the rotating animation when the Activity B starts the slide over the activity A. I guess it happens because the android switch the UI Thread process to the new activity that is coming and stop what the previous activity was doing, but in my case the user still can see the activity A being covered by the activity B.
I have one activity with ListView and 2nd activity which have ViewPager. Now I want in one activity if status true then go to 2nd activity `
Intent n = new Intent(one, two);
startActivity(n);`
But here problem is it giving opening animation is any i can do within that 1st activity
any way i can avoid that animation and it look like it is same activity
or i have to redo full code and this inside 2 fragments ? so have one fragment activity and then but one activity code inside fragment and two activity inside fragment which will have view pager.
Paraphrasing you, your are trying to call activity B from activity A, based on a result, which is an item picked from list item, however you wanna avoid any sort of screen transitions (animations) when moving from one another.
I may be wrong but my google search didn`t revealed any way to avoid transition between activities.What your could actually do is to refactor your code using fragments and sort them out within the parent activity view group in a way that fragment B maximizes itself or pops up over fragment A pausing it.
Brs.,
I have an Activity with a fragment in front. now when i use StartActivity() the fragment is first removed and you can see for a half a sec the Ui of the activity before it moves to the next Activity...
any idea how to keep the fragment in the front until the last moment before switching to the next Activity?
Thanks
I have a main activity that launches another activity, let's call it A2. When A2 finishes loading, it triggers an event that updates the main activity's view. This works great.
The problem is that when I press back or finish() in A2 and it begins the transition animation back to the main activity, the main activity's view doesn't seem to have been redrawn prior to the animation commencing, so as it slides back in it still has the old layout. When the transition finishes, it updates to what it should be.
Is there a way to force the main activity to invalidate its view or otherwise force it to redraw its view prior to the transition, so that the animation looks nice and smooth? I have tried invalidate(), but that does not redraw until after the transition.
(To avoid the XY problem: as a part of a complex animation from the main activity to A2, I create and fade in a black overlay view on the main activity. When A2 onResume()'s, it sends a navigation finished event that causes the main activity to remove the overlay. When returning from A2, that overlay is still rendered, so it looks like it's transitioning into a black screen until the transition finishes and the view re-renders.)
I tried and searched a lot, but did not find an answer for this. I have an activity A, transparent over an Activity B. I am trying to make the activity A scroll up to the top, like the notification bar, so that activity B becomes active. And I should be able to scroll down back A when necessary. Moreover, I am trying to implement this scrolling over an imageview in A, not anywhere on the activity A. can onTouch and onTouchListener help me? Please help me here. I am searching an answer to achieve this functionality.
You can animate Activity A to the top, saving its state, and have it start Activity B and then stop. When the user swipes down in an attempt to get back Activity A, Activity B simply starts A, which starts by animating down from the top. It restores the data it has saved, so to the user it's the same as if it has been active all the time.
If you need Activity A to continue processing, you an either delegate processing to Activity B, or to a Service, or to a class that is under control of RoboGuice and is kept active because it's injected in both A and B.
The only way I can think to do this is with Activity.overridePendingTranistion. Using this, you will have to start and finish your activity each time for it to animate. Have you considered using a view that animates down, like a SlidingDrawer?