Hide app content when overview button clicked - android

I would like to be able to hide the content of the app when it is not in foreground, for example, when I click the overview button(task list), the Chase banking app would just show pure solid color and hide all the content. Does anyone know how to do this?

I found out the answer should be add the following in onCreate of activity. This also block user from taking screen shots of the activity.
getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE,
WindowManager.LayoutParams.FLAG_SECURE);

You can override onStop method in an activity and make the view invisible.

Related

How to make DialogFragment show on android home screen?

The hosting blank activity is shown behind the dialog, but I want it to be shown on top of the home screen. Is there a way to "hide" the activity since nothing is shown inside of it anyway? The activity is needed because I am planning on showing another dialog after the user clicks a selection from the first one.
Figured it out! For anyone wondering, the answer is to make the activity transparent. Here's another stack overflow question that describes how: How do I create a transparent Activity on Android?

Show splash screen when application enters background android

How can I show android splash screen when the application goes to the back ground?
The issue is that I need to hide my application main page when the user sends the app to the background, and when s/he double tabs the home button, they will see the splash screen.
We were using the following inside our code :
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
getWindow().setFlags(LayoutParams.FLAG_SECURE,
LayoutParams.FLAG_SECURE);
.
.
It looks like it is fixing the issue, but this code is preventing the user from taking screenshot on the device if the app is in the foreground.
I'm not sure how to implement what i need like I did in iOS.
thanks.
Now I haven't personally tried this so I'm not sure if it'll work, but you can try overriding the onPause() method. After overriding onPause() add code that sets your splash screen to cover the entire activity. This should put the image as the app preview in the Recents Panel. Then override the onResume() method to remove the image from the activity, giving the user control again.

How to affect the snapshot Android takes from application when going to background

My question is about the Android system taking snapshot of application screen when entering background. I have some secure content in application which I would like to hide in that point, so if user enters background and opens recent apps, I could show always the same content (for example splash screen) for my application instead of the last screen visible before entered to background.
Is this possible at all?
Thanks.
Please do not post answers about FLAG_SECURE, I do not want the screen to be black and also found a bug from it: http://code.google.com/p/android/issues/detail?id=64086
Use FLAG_SECURE .
Usage:
public class FlagSecureTestActivity extends Activity {
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(LayoutParams.FLAG_SECURE,
LayoutParams.FLAG_SECURE);
setContentView(R.layout.main);
}
}
That will prevent from a screenshot being taken of that activity. And will show a blank screen for that app in the recent apps list.
Edit:
Other than FLAG_SECURE there doesn't seem any method to prevent a screenshot from being taken. However, I'd suggest this unclean workaround instead. I've not tried this, just an idea:
Override the onPause() and onBackPressed() methods of the Activity. So when the home or back button are pressed, these are called.
Then , inside these, use setContentView() to show another dummy view or a splash screen for that matter. So that this splash view becomes the last shown View.
After point 2, call super.onPause() or super.onBackPressed() , so that the screenshot is taken, of this splash screen. Don't call them before point 2.

Good Android user interface design - when to add an explicit cancel button?

I was wondering, since on Android one closes a screen by pressing the "return" round-arrow, is it still OK to have a cancel button on each screen or does it look rather clumpsy and confuse because the user might think it does something different than the return button.
Is there a good rule or even guideline for this ?
Many thanks
On each screen it's from my point of view useless, you are suppose to go to your previous screen (previous Activity since one screen is one Activity... usually) with the back button. For dismissing an AlertDialog, keyboard, ProgressDialog : back button is still ok. Where a cancel button can be added is when the user is processing a complex chain of action and in the middle of it he thinks : screw this... here a cancel button which bring him back to your home Activity is welcome.
Downloading lots of app and look at their application's flow (navigation between screens) will teach you what's intuitive, natural and what's not.
Personal thoughts.

How to hide activity GUI in android 2.2

I have an activity here.
I want to click a button and then hide the activity GUI.
That is, GUI is needed and you can hide it by clicking a "Hide App" button. How can i
implement this "Hide App"?
Somebody help! Thanks in advance!
To do what you want within the organizational model of android, your "program" should be written as a service, not an activity. You would then have a gui that is an activity and a client of your service, which can be started (made visible) and paused/stopped (hidden) as desired.
Presumably when your user clicks the hide application button, you're going to want to show something - at the very least a show button, so the user isn't stuck without input options!
So what you really have then is two views, one with the GUI hidden.
Two approaches I can see:
Hide app calls another activity with only the UI shown that you want. When the activity is finished, use Activity.finish() to return to the original activity with the GUI
Look at ViewAnimator and its subclasses (ViewFlipper and ViewSwitcher)
You could also just enable the screen lock. ;-)
That would automatically lock the screen (hide your app). And when the user unlocked the screen (using the UI and a gesture the user is already very familiar with) he would automatically get back into your app without you needing to do any extra coding.
The additional advantage of the screen lock is that it can be be password-protected, so if the user has his screen-lock already set to a password, instead of a slide bar -- he would just get the slide password thingy.

Categories

Resources