How to change Android Homescreen look? - android

Each manufacturer makes a custom build of Android. Is this modification done in source or is it in app ?
If its in source : pointers to appropriate links would be useful.

It's called a launcher, which is a normal APK application. It's a normal Activity which reacts to a certain Intent.
You can create another one, and install it on your phone. When you press the home button it will ask which Launcher to use.
<activity
android:label="#string/app_name"
android:name=".ClassNameOfYourLauncher">
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>

I think you're talking about the Launcher. That's the first thing which comes to my mind. Its a System apk which will be there in app folder in system directory. If you need to modify that, you better create a new launcher of your own. Here is a link on how to go about doing that.

Related

Android apk installing both the activity with its default name and with its alias

The main activity of my Android app, has a default name and an alias name that should be put to the app if the user chooses to. I've defined that on my AndroidManifest.xml in the following manner.
<activity
android:name="com.example.fgd.myapplication4.MainActivity4"
android:label="mydefaultlabel"
android:theme="#style/AppTheme.NoActionBar"
android:exported="true" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity-alias
android:label="myaliaslabel"
android:name=".MainActivity-Flavor-One"
android:enabled="true"
android:targetActivity=".MainActivity4"
android:exported="true" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity-alias>
</application>
But I've tried to build the apk and install it my phone and it installs either an icon with the name "mydefaultlabel" to access the app and another one with "myaliaslabel" to access it, which is not my desired behavior, on start I want it to just install the icon with "mydefaultlabel".
Any idea on what should I do to achieve this behavior?
PD: Trying to delete and
, causes to not be able to run the app any longer, once I change the alias of the app with this code:
getPackageManager().setComponentEnabledSetting(
new ComponentName("com.example.alber.myapplication4", "com.example.alber.myapplication4.MainActivity-Flavor-One"),
PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP);
getPackageManager().setComponentEnabledSetting(
new ComponentName("com.example.alber.myapplication4", "com.example.alber.myapplication4.MainActivity4"),
PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP);
I get the error that the app is not installed on my Android device.
It looks like, no matter what, the alias has to be defined with the launcher category to be able to change the application alias this way.
I see no way to change alias except in this way.
Is there something else that could be done?
You are setting two Main Activity and LAUNCHER
<action android:name="android.intent.action.MAIN" /> //<--wrong
<category android:name="android.intent.category.LAUNCHER" /> <--wrong
you need to add these lines only to your specific activity that implement your icon or whatever.
Well, it was actually easier than what I though.
In activity-alias you just need to change android:enabled="true" to android:enabled="false", this way the alias will still be functional but won't show as a launcher for the first time.

Making a custom launcher

Followed this tutorial.
FROM TUTPLUS
Tut seems very simple and logical, the annoying part is, it just don't work(although everything seems to make sense).
when i click the home button my app wont run, neither i get any option to select among the default launcher app and my app, i can see the app among launcher app when i go to settings>home.
I did provide filters as given in tutorial.
<activity
android:name=".HomeActivity"
android:label="Bawa launcher"
android:theme="#style/apptheme"
android:launchMode="singleTask"
android:stateNotNeeded="true"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
Though a bit late, may help others. In phone's settings, selecting the default launcher to your launcher will solve the problem. In my case, above code worked by this method.
Everything is perfect in your code. All you need to do is remove:
<category android:name="android.intent.category.LAUNCHER" />

Inconsistent behavior of classes as shortcuts/apps in Android 4.1+?

I made two apps, each one has classes that I want to use as shortcuts or independent apps (equally fine with me). They worked fine in Android 4.0.3, but not in 4.1+.
The fist app is called xvf, and has a class FolderList (named Fima) that I want to make into a shortcut. The other app is ave that has a class ViewMap (named Ave Map) that I want as a shortcut too. However, I have two problems:
1) I cannot add the shortcut to the home screen in 4.1+. I find the shortcut inside "Widgets", but when I release the shortcut in the home screen, instead of placing the icon, the class is executed as if it was clicked, and it is not added.
2) Fima appears as an independent app in Android 4.4 and not as a shortcut, so I was able to add it, but appears as a widget in Android 4.1.2... Why Fima appears as an independent app???
This is the relevant part of both manifests:
xvf:
<activity
android:name=".FolderList"
android:label="Fima"
android:icon="#drawable/fima_launcher_128"
android:theme="#style/MyThemeNonFS" >
<intent-filter>
<action android:name="android.intent.action.CREATE_SHORTCUT" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
ave Manifest:
<activity
android:name=".ViewMap"
android:label="Ave Map"
android:icon="#drawable/guara_128"
android:configChanges="orientation|screenSize"
android:launchMode="singleTask"
android:theme="#style/MyThemeNonFS" >
<intent-filter>
<action android:name="android.intent.action.CREATE_SHORTCUT" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/comma-separated-values" />
<data android:mimeType="text/csv" />
</intent-filter>
</activity>
What am I doing wrong? How do I make the shortcuts to work properly, or how do I make the classes to look as independent apps?
Thanks!!
L.
The only solution I found to this problem was to add
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
to the two activities. Now the second activity appears as an independent app, but at least now the icon stays in the HOME screen when released.

android) can i set a default activity that runs right after installing

in my app, there is two activity and i want to make activity1 to the starting activity after installation.
But now the RUN button (is showed right after packgae installing) is disabled.
below is the manifest file. thanks.
<activity ...1>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity ...2>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.ACTION_POWER_CONNECTED" />
<action android:name="android.intent.action.ACTION_POWER_DISCONNECTED" />
</intent-filter>
</activity>
android) can i set a default activity that runs right after installing
No activity "runs right after installing". The user has to launch it from the launcher.
below is the manifest file
No, it is not. That is not even valid XML.
Also, note that your third <intent-filter> is invalid. Not only are you missing any category (you need at least DEFAULT for activities), but ACTION_POWER_CONNECTED and ACTION_POWER_DISCONNECTED are not activity actions.
I am going to take a guess that you really mean to ask: "I have two activities, both described as ACTION_MAIN/CATEGORY_LAUNCHER, and now the Run button does not work -- what can I do?" The answer would be "either remove the ACTION_MAIN/CATEGORY_LAUNCHER <intent-filter> from one of them, or mark one of the two as disabled (android:enabled="false") and enable it later on using PackageManager."
I think the problem is the second:
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
You shouldn't have 2 activities flagged as the MAIN and LAUNCHER activity.
Try removing it within activity2.
Check out: http://developer.android.com/reference/android/content/Intent.html the intentfilter s are discussed.

Android application packaging

I have two android applications- A and B.
I'm trying to package them as a single unit so that upon installation the system installs both apps. However, I could not find any reliable answer till now.
In A's manifest file I added activity tag of B, resulting in error.
Could anyone guide me on how to package two applications as a single unit?
Thanks in advance!
I do not believe this is possible. An APK corresponds to a single AndroidManifest.xml which corresponds to a single Application.
However, if you want mulitple "launchers" or icons, it is possible by exposing multiple Activities by adding IntentFilters to the ones you want (which take the launcher event). However, they are still, technically, a single application.
Update:
Here's how to expose multiple Activities. The main activity would have something similar in the AndroidManifest.xml
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
Copy-paste this inside the other Activities you want to expose. For example:
<activity
android:name="com.example.app.FirstActivity"
android:label="#string/first_app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.example.app.SecondActivity"
android:label="#string/second_app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

Categories

Resources