How to change the way a new activity starts in android? - android

I don't like the look of how a new activity starts in android, the "fade in" and getting bigger untill it covers the screen.
Is there anyway to change the way?
Ideally, i want the activity just to appear all in one go

You can use the overridePendingTransition()method in Activity class to change the transition.Here are a good tutorial for this topic, the link.
But I should mention the point that animation can be disable in phone setting and in this situation your animation transition wont show.

Related

Popup window using Fragment

I want to create a pop-up window (with black transparent background around it) that would appear above the application activity screen (by clicking on a button). This pop-up would contain a video player, a list of videos to be played and some other elements.
This pop-up has to be a fragment since I need to re-use it from other app fragments.
So my question is : what is the best way to achieve that? I personally see 2 options :
1) adding the pop-up as a fragment on the layout and to show + activate it whenever I need. But in that case, how can I put a black transparent background around it that would fill the whole screen?
2) using DialogFragment but it seems that this class is not very well-designed for this kind of stuff.
What do you think?
Thanks in advance.
DialogFragments are the suggested way to launch Dialog views from within a Fragment, so this is the solution I would suggest for you.
You can do pretty much anything you need within the DialogFragment. You will be in full control of the UI using this method.
Here is a SO discussion of the same point, with good info: Android DialogFragment vs Dialog

Theme.Translucent then show image after click

I have completely lost my focus now.
I was trying to create a transparent background to show users phone screen like this.
https://market.android.com/details?id=net.kreci.crackedscreen&hl=en
Now i got it working. But i want to now add an image but it wont show till after the click.
Can this be done in Viewflipper with showing the activity Transclucent then showing image after the click? (cause i dont want the screen to flip to another activity, I want it to show straight away)
So technically if you don't understand what I meant.... Similar to the market link i added in this post.
I don't have knowledge regarding ViewFlipper class to implement in this situation,
But
I have one Idea to implement while creating two different activities to show 2 Images.
In onCreate of both activities write the below line right after super.onCreate()
getWindow().setWindowAnimations(0);
This will set Window Animation to 0 so your screen will be changed without any effects.

Getting blank screen when switching between activities

I am working on an app , where I am switching between two activities. When control is inside onStart of second activity , there is screen drawing and processing logic being handled.Because of this , when switching between the two activities happens, there is a blank screen that comes up.
Along with this , i also need to render a live video feed in background of my activities/app
What could be the best way to deal with this?
TIA
If you're getting a blank screen it could be because your activity is setting a new contentview but it hasn't been processed properly. Does it ever load completely? If it's just that it's black at the beginning and then renders. Try setting the contentview at the end of your switching in onCreate. This will make it remain on the first activity and avoiding switching views on till everything is loaded.
With regards your second question. Is the live video feed from the Camera?
If it is, set the camera view in the background, make a transparent LinearLayout (or whatever your layout is) over it and then put your various views there.
Your question doesn't have enough specific information to get an accurate idea as to what you're talking about, if my answer doesn't address your problem please respond with elaboration and some code! :-)

Transparent, floating Android Activity doesn't allow updates to content behind it

I have tried and tried to get a transparent, floating Activity to show up (as an overlay), but allow whatever is behind it to still show AND update. Right now it seems that if the Activity behind mine is closed or a new one opens (could be either in this case), the new underneath Activity does not shine through my Activity to the user.
I have tried every combination of Flags I can come up with, and at this point I'm assuming Flags are not the answer. Can anyone help me find the proper code to do such a thing?
Before anyone asks, I have a valid use case for this type of Activity; no, I don't plan to annoy the user with it.
As far as I know, this is not possible. It should be possible to create an activity using the theme Theme.Dialog or Theme.Translucent (see http://developer.android.com/guide/topics/ui/themes.html) to have whatever activity is beneath it still show at least partially. The problem is, is that the Activity below will be Paused (it's onPause will have fired, but it's onStop will not have) and I don't believe it is possible in any way to have it run any code.
I have not investigated in making a transparent Activity but I don't think it's possible in an Activity way. This seems to be logical since even if you have a transparent Activity it's still relying on the View inside it - the View makes the transparent part, not the Activity. This means you're probably gonna end up with a transparent View instead.
If you have a "front" Activity with a transparent View and then a "back" Activity, the "back" Activity would not be visible to the user - and that's because you're in another Activity.
So, the correct way is to use a transparent View.
It is possible to update the activity below by implementing a Broadcast receiver on it, and sending Broadcasts from whenever you want.

How can I keep current screen (contentView) when l Iaunch a new Activity

I have an NoContentViewActivity which has no Content View (i.e. I did not call setContentView() in the onCreate of my Activity).
My question is how can I keep the content view of the launching activity on the screen? Right now, I am getting a blank screen whenever I launch NoContentViewActivity? I want the content view of the launching activity (the activity which start the NoContentViewActivity) to show on the screen.
Thank you for any help.
Excuse me, people, but my guess is that hap497 wants exactly the thing he wants. There is a bunch of situations where invisible activity would fit while Service will not.
Imaging you want to show a set of dialogs, each next of them is shown after the previous one based on the user choices. And imaging you want to have this (exactly the same) functionality to be available when pressing different buttons on different (lots of them) activities.
To write the same dialog processing logic would be an overkill whether the transparent activity will deal nicely...
Anyway, as stated above, all you need to do is to specify:
android:theme="#android:style/Theme.Translucent"
or
android:theme="#android:style/Theme.Translucent.NoTitleBar"
(if you do not want a titlebar either)
It sounds like you'd be better off using a Service than an Activity. Activities are for code that is to be viewed; Services are for code that runs without a UI, which is what it sounds like you want.
An Activity with no Views assigned is an empty black screen, so it will still obscure the calling Activity. You could make your Activity transparent by assigning it a transparent theme:
android:theme="#style/Theme.Translucent"
Keep in mind though, that your invisible Activity will have focus, so the user won't be able to interact with the Activity underneath.
Why do you want to create a fully transparent Activity? As Daniel suggests, a Service might be a better solution to your problem if you genuinely don't want any user interaction.

Categories

Resources