How can we change android application icon dynamically in Android [duplicate] - java

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.

Related

Android Studio activity landscape [duplicate]

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" />

Add different/own icon for android app [duplicate]

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"

Force device to keep screen working [duplicate]

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

How to use pictures from the phone in android memory game [duplicate]

This question already has answers here:
How to access an image from the phone's photo gallery?
(2 answers)
Closed 9 years ago.
I am making a small application for my daughter (in android) where I want to use some of the pictures from the phone as pictures for the memory cards.
As far as I know the pictures that can be used are the ones in the resource folder so I am basically looking for some suggestions as to use pictures outside the resource folder (in the application)???
You need to ask permission for this inside the manifest file
uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"

how to make a simple launcher in android? [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
How to make a launcher
I want to make a launcher something similar to go launcher which changes all the icons and stuff... Currently I wanna know where should I start from? I need to make a very simple launcher so any sample code will be appreciated. Thanks!
Any helpful codes I should know or any tips?
There is a Launcher sample app included in the SDK samples that has some simple launcher code that you could base your app on. I doubt there's any simpler code available than that one.

Categories