Change again the launcher logo in Android Studio 2.1.1 - java

When I first built my Android application the launcher logo was automatically set to this:
android:icon="#mipmap/ic_launcher"
which shows the Android logo. Now I changed it (with the instruction of this link) to a flashlight picture. If I try to run my app everything is working fine and it is the right launcher logo (flashlight).
But I decided to take a new launcher logo, so I deleted the whole new folder which was created in my mipmap folder. At first, I changed the android:icon in the AndroidManifest.xml back to the ic_launcher.
But if I try to run the app again, my launcher logo is still the flashlight. But it should be the Android logo. What did I do wrong?
I followed the instruction again and tried to add a new .png file, but now not even the new mipmap-folder is created.
Is there something else I need to consider?

I could solve the problem by myself!
I did the right-click on the app-folder
I chose New -> Image Asset
I checked the Image Checkbox as Asset Type and selected my desired path
BUT:
I forgot to review the Name. So ic_launcher was still selected!
That's why I got the following errors:
An icon with the same name already exists and will be overwritten.
And...
Some existing files will be overwritten by this operation. Files which replace existing files are marked red in the preview above.
So what you need to do is simply change the name of your image to something that is not flashlight or ic_launcher (i.e. flashlighttest , flashlight2 or ic_launcher2). Just make sure you will not overwrite an existing file!

Related

JavaFX SceneBuilder ImageView not working

I need to create a GUI with SceneBuilder. I added an ImageView to my interface and set the path to my image correctly. The image is showing inside SceneBuilder, but when I run my application, the image is not there.
I put the image inside "img/placeholder.png", and then directly into my root directory. Doesn't matter where I put it, it isn't working.
The path to my gui.fxml file:
/src/gui/gui.fxml
The path to my image file:
/placeholder.png
Can anybody help me please?
There's an easier solution to your problem, without the need of adding or removing any code.
Once you had created an ImageView control in Scene Builder and chosen an image from your computer, select the "gear" icon right beside the ellipses button and select "switch to absolute path".
Image will then automatically appear when you run the code.
Another solution in some particular context (maven related)
Given /src/main/resources/foo/gui.fxml and /src/main/resources/foo/img/foo.png, if you create an image view in SceneBuilder and set the image to foo.png, the url reads #img/foo.png. Unfortunately the image does not show in the application. If you change the image url to #/foo/img/foo.png then the image won't show anymore in SceneBuilder but it will show in the application.
SceneBuilder 8.2.0, JDK 1.8, IntellJ IDEA 2016.1
There should be # as following in image URL. Put image file in inside project folder either same package or different package.
<Image url="#../image/profile_pic.png" />
Just try to refresh Eclipse's System Explorer. I solved it this way.
Path From Content Root
src/main/resources/assets/POMME.png =
<Image url="#../../../assets/POMME.png" />
This is because you haven't added jfoenix jar in your program.
Add jfoenix jar to your project
[xdezo.com][1]

values-21, values-22 or values-xx folder is gone after Android Studio 1.0

When I create a new project with API14 as minimum, then there is no values-21 or values-22 folder in my project. I don't see any styles.XML anywhere, so how should I put in XML code for just Lollipop?
I use Android Studio 1.0.1, and I have SDK 21, 21.1.1, 24.0.2 installed.
Updated: Since API 22 has been released. API 23 is the same idea.
Right click the RES folder
Then type values-v22 as the directory name and choose xml as the resource type.
If you do NOT see the values-v22 show up, click the Project pulldown at the top of the screen like so. e.g. Change from Android to Project
Now right click styles.xml in the values folder and choose copy
Now right click the values-v22 folder and click paste.
You should see this popup
Click ok
At this point you should be good to go.
It is just a bug! Anyway I find a way to get it back:
Write anything in styles.xml that is related to new material theme
example: <item name="android:colorPrimary">#color/colorPrimary</item>
It will show you an error hover over it and press Alt+Enter.
choose the first choice Override Resource in values-v21.
I know it isn't the best way to do that, but it works until anyone can find a better way.
Try to switch from Android to [![Project][1]][1] as shown below

How can I create splash screen in Qt5.2 on Android?

I have created Android application using Qt5.2. It takes a long time to start my application. Qt5 draws black screen by default during application start up.
I want to display company's logo during application start up. How can I do it?
I have found code in QtActivity.java for loading splash screen if it presents. There is a reference in AndroidManifest.xml to splash screen layout. I have tried to create splash.xml in res/layout directory but it doesn't work.
Thank you!
There's a bug with the splash screen, and here's the ticket for it:
qt-bugreports
If you follow this link you will find a comment (link), which shows a way to display splash screen. (I haven't tested it)
One way1 to show a splash screen is to edit the android/AndroidManifest.xml. Be aware that the Android Manifest editor doesn't provide a GUI to these options2, and so it is necessary to use a text editor. The default AndroidManifest.xml has a line dealing with splash screens, but it is commented out:
<!-- Splash screen -->
<!--
<meta-data android:name="android.app.splash_screen_drawable" android:resource="#drawable/logo"/>
-->
<!-- Splash screen -->
Uncomment it, and once you've added application icons to your project via QtCreator's Android Manifest Editor then in your android directory there will be drawable-* sub-directories. Add your splash images there. The filename should match what comes after #drawable/ in the resource attribute. Do not specify the file extension in the XML.
Be sure that you add your splash page images to the project directory and not the build directory because the build directory's resources are deleted on each new build.
Tested in Qt 5.6
In QtCreator 3.6
Thanks to Larpon's post on Qt's forum for the clues.

Missing id class in R.java

I am developing an Android app using Phonegap and jQueryMobile, working in Eclipse. I want the app, with the user's permission, to auto-install a launcher icon on the user's "desktop". I've found the example LauncherShortcuts.java on Android Developers, and I am almost to the point of getting it to work. That's a big achievement, since I know extremely little of Java programming.
Almost.
This is the example code online:
http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/app/LauncherShortcuts.html
One string or thingy in the code refuses to cooperate. Line 83...
TextView intentInfo = (TextView) findViewById(R.id.txt_shortcut_intent);
...has this constant or variable in it called "R.id.txt_shortcut_intent", and Eclipse says it doesn't recognize the id part. If I follow its suggestion of adding a class 'id' in R., it tells me there is no field txt_shortcut_intent in 'R.id'. That doesn't surprise me.
I've been able to fix a few similar errors involving R.something_or_other. But not this one. My R.java only contains the classes attr,drawable,layout, and string.
What is going on here and most importantly, what should I do to get this thing up and running? The launcher icon is all that stands between here and actually launching the app (how ironic).
If you find any errors in the project. Sometimes id of R.java entries will be shifted to string folder or R.java.
For this choose
project → clean
file → close all
click on your project
See the entries in id of R.java your ids will be in this folder
An android app uses an xml to define the layout of all the elements you want to display. In this case, you're missing an element that displays text called TextView. You don't have the Textview 'txt_shortcut_intent' defined in the xml, probably.
Here's the xml you're looking for (just copy and paste it into your main.xml):
http://developer.android.com/resources/samples/ApiDemos/res/layout/launcher_shortcuts.html
The ADT Plugin in Eclipse can only rebuild the R class if there are no (Java) errors.
Therefore, fix all errors and check if your layout ressource has the correct id (txt_shortcut_intent).
It's worth a try to clean the project and restart Eclipse.

Where are all the standard Android icon resources?

I have just started writing my first ever Java/Android application, so forgive the total n00b question.
How do you access the the standard operating system icons such as search icon/menu icon etc? They are not in the res/drawable folder where I would expect to find them. Are they available as part of the SDK or must you download them seperately?
EDIT
Maybe you can help me further - I am getting the following error (repeated on):
[2011-09-08 19:59:47 - TweetTab] C:\Users\Dan\workspace\TweetTab\res\menu\options_menu.xml:4: error: Error: No resource found that matches the given name (at 'icon' with value '#drawable/ic_menu_search').
However, the icon is not empty, the xml looks like this:
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="#+id/search"
android:icon="#drawable/ic_menu_search"
android:title="#string/search"/>
</menu>
Am I missing something?
SOLVED
I changed android:icon="#drawable/ic_menu_search" to android:icon="#android:drawable/ic_menu_search" and it could then find the icon.
You can acces them via android.R.drawable.* or in xml by #android:drawable/something.
I installed the Android SDK for Eclipse on Windows.
Now I can find all ressources under "C:\Program Files\Android\android-sdk-windows\platforms\android-9\data\res..."
try this instead:
android:src="#android:drawable/ic_menu_camera"
it is now possible to use vector assets to generate standard (or customised) icons for android.
Add 'com.android.tools.build:gradle:1.4.0-beta3' to your build.gradle file. (The stable version will be out in the coming weeks).
Add a vector asset by right-clicking res/drawable/ > New > Vector Asset. Android Studio provides a built-in viewer for you to pick your drawable.
Reference your icon like you usually do. Eg: android:icon="#drawable/ic_help_24dp"
A lot of them can be found in android.R.drawable but not all are publicly accessible
You can find the android.R.drawable images in your local SDK folder. (Tested using Android Studio 3.0)
First have a look at the docs for the names of the drawables here: https://developer.android.com/reference/android/R.drawable.html
Second either search your drive for one of those image names.png or type in the name of any of them into your Android Studio activity and right click (goto declaration) on it to view the image. Then you can also right click that image to copy the path. Then open that folder and look at all the PNG's there.
Example on windows 10: android.R.drawable.star_big_on is located in user/AppData/Local/Android/Sdk/platforms/android-25/data/res/drawable-hdpi/star_big_on.png
(Note also on windows AppData is a hidden folder so you may need to set your windows explorer to show hidden if you are clicking to open each folder)
Also if you need to see material design icons / descriptions this is a good place to look: https://material.io/icons
Someone may see this page useful for getting those icons... http://developer.android.com/design/style/iconography.html
For those of you in the Visual Studio/Xamarin Android camp, you can view and add the standard Material icons pretty easily using the following plugin:
https://marketplace.visualstudio.com/items?itemName=nikainteristi.Materialiconsgenerator
I've used it a few times in my projects.

Categories

Resources