This question already has answers here:
Keep the screen awake throughout my activity
(5 answers)
Closed 7 years ago.
Is there any way to force device not to sleep, if my app is shown on the screen? Does manifest.xml have a special attribute for this?
add this tag to your manifest file under activity tag
android:keepScreenOn="true"
Try this in your activity:
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
or use tag in manifest
android:keepScreenOn="true"
Read
Android Documentation
Related
This question already has answers here:
Android, Detect when other apps are launched
(8 answers)
Detect When other Application opened or Launched
(3 answers)
Closed 23 days ago.
I want to open my app when some other app is opened.
Ex:
I want to open my game launcher when some game is opened and i want to draw over the other app
How can i make this in android studio? If you found any online article or videos attach the link down.
If you want to be notified of the execution of other applications, you must use AccessibilityService, by activating AccessibilityService, your app will be notified whenever a application is executed, this is the simplest and best solution for that.
You can also get permission Appear on top to draw on other apps or start an activity from your app instead of drawing, there is currently no other control solution.
This question already has answers here:
How to prevent Screen Capture in Android
(16 answers)
Closed 4 years ago.
I have an Android banking app that prevents from taking a snapshot of the screen how do I do that in my own app.
Does anyone know how this is achieved?
It can be achieved by adding a simple code in the activity
if(android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE);
}
Just add FLAG_SECURE flag in the activity. It Works for all Android versions higher than HONEYCOMB ie API 11 or higher.
Window flag: treat the content of the window as secure, preventing it from appearing in screenshots or from being viewed on non-secure displays.
Thsi prevents screenrecording and screenshots
This question already has answers here:
Android, landscape only orientation?
(6 answers)
Closed 4 years ago.
Im trying to create a table in Android Studio with several fields, so the common Vertical mode for the activities doesn't seem useful to me.
I just want to change only one activity landscape mode to "Horizontal" and whenever i just change from this activity to another, go back to the regular "Vertical" mode.
I have tried searching on Google but all i found is just tutorials for changing the entire app to Vertical or Horizontal and i don't need that.
How can i do it?
Thanks
You can set this in your AndroidManifest.xml for each activity individually. For example:
<activity
android:name=".MyHorizontalActivity"
android:label="#string/my_horiz_activity"
android:screenOrientation="landscape" />
This question already has answers here:
Set icon for Android application
(17 answers)
Closed 6 years ago.
I'm beginner at Android-programming/developing and I would like to change my own logo at my application.
I've found a folder, called 'mipmap'. I think, it could be this location where I can change it. Also I tried it without success.
Could somebody help me in this project?
Thanks a lot
Copy your image in the folder "mipmap"
Go to "manifests"
Here find the line :
android:icon="#mipmap/ic_launcher"
Change ic_launcher to your image name
android:icon="#mipmap/Your_icon_name"
This question already has answers here:
How to change an application icon programmatically in Android?
(11 answers)
Closed 2 years ago.
I know that same kind of question has been asked for activity icon, but my question is little bit different.
I just wanted to know whether we can set the application icon programmatically, I am not asking to change, I am just asking for setting it. I hope I am clear.
<application android:icon="drawable resource"> </application>
In the above example I am setting it in manifest file, but instead of manifest can I set it through java code.
As you can read here http://developer.android.com/guide/topics/manifest/manifest-intro.html the default's app icon is set in the manifest. As manifest is located in the app's /root it cannot be modified, so there's no way to do it.
You may consider that if you could change it while the app is running, changes wouldn't be saved in the manifest.