Various activities, various intents, failed at name app - android

I have some intents to execute different activities, my problem is that when I run the app in the device, eclipse install it with the name of the last activity. For example:
We have, three activities: 1 - 2 - 3. The first is the main activity (1), it name is Noow but I have an Intent to another activity (3) to get the location and return the data to (1). The app installed is named as getLocation (3) and it must have the name of the (1).
This is the manifiest xml file. Could someone help me with this? Thanks
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="victor.martin.noow"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="7"
android:targetSdkVersion="16" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="victor.martin.noow.SplashScreen"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="victor.martin.noow.LoginScreen"
android:label="#string/title_activity_login_screen" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="victor.martin.noow.MainActivity"
android:label="#string/title_activity_main" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="victor.martin.noow.getLocationActivity"
android:label="#string/getLocationActivity" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>

This is happening because the SDK will use the name of the activity having the LAUNCHER property:
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
The simplest solution would be to delete the LoginScreenActivity label and set it programatically. In this case the label provided in the tag will be used.

First of all there has to be one activity set as main activity i.e launcher activity. What you have done is set all activities as main which is incorrect in all terms of programming logic.
The activity with
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
gets the by default name, and by convention in your case after reading your xml the last activity got default name.

Related

getting error No Launcher activity found! in creating a setting activity for a widget

in writing a widget and after i tried to add a setting activity for my widget , i got the error "No Launcher activity found!"
this is my AndroidManifest.xml :
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.persianweather"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="18" />
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<receiver android:name="com.example.persianweather.Main" >
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<!-- This specifies the widget provider info -->
<meta-data
android:name="android.appwidget.provider"
android:resource="#xml/widget" />
</receiver>
<activity
android:name="com.example.persianweather.SettingActivity"
android:label="#string/title_activity_setting" >
<intent-filter >
<action android:name="android.appwidget.action.APPWIDGET_CONFIGURE" />
</intent-filter>
</activity>
</application>
No Launcher activity found! means that you not mentioned any activity on launching the application. Try to add these lines in manifest. To specify these MAIN and LAUNCHER in the the intent filter for the activity you want to start on launch like:
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
Note: Multiple action tags in a single intent-filter tag will also cause the same error.
Make your SettingActivity as launcher activity, Only then you will be able to proceed further,
<activity
android:name="com.example.persianweather.SettingActivity"
android:label="#string/title_activity_setting" >
<intent-filter >
<action android:name="android.appwidget.action.APPWIDGET_CONFIGURE" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

App is installed and has two icons

I made a android app and it worked very well, but there are two icons in my device screen. I think it could be a AndroidManifest problem. Any idea what it could be?
This my AndroidManifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="pk.aeh.ideos.taa"
android:versionCode="1"
android:versionName="1.0" >
<application
android:icon="#drawable/icon"
android:label="#string/app_name"
android:theme="#android:style/Theme.NoTitleBar" >
<activity
android:name=".Ghinho_congviecActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="Nhap_congviecActivity"></activity>
<activity android:name="Sua_congviecActivity"></activity>
<activity
android:name=".Quizzes"
android:launchMode="singleTask">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".PlayGame" />
<activity android:name=".Result" />
</application>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
This could be because you have declared two activities as MAIN and LAUNCHER
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
in your Androidmanifest.xml file. You need to have only one activity with these intent filters so that when the app is installed the system will know which activity is to be used as the main launcher activity.
It is. You have two of these:
<category android:name="android.intent.category.LAUNCHER" />
Get rid of the one you don't want.
You need to make these changes to your Manifest.xml
<activity
android:name=".Ghinho_congviecActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="Nhap_congviecActivity"></activity>
<activity android:name="Sua_congviecActivity"></activity>
<activity
android:name=".Quizzes"
android:launchMode="singleTask">
</activity>
I am assuming that the Activity with the attribute android:label="#string/app_name" might be your main activity.
It could be because you have changed your package name and installed it twice with different package names.
Remove the intent filter of one the activity and it would work perfectly.!
Your manifest file should only have one activity with below Intent Filter, Activity which you want to have an icon:
<intent-filter>
<action android:name = "android.intent.action.MAIN" />
<category android:name = "android.intent.category.LAUNCHER" />
</intent-filter>
Based on your description, it sounds like two activities have this line. Check your Manifest...
You can declare only one Intent filter in the activity, on AndroidManifest.
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
If you used two or more intent filter in AndroidManifest, then you will have display 2 app icon, So remove it & set one intent filter.
I hove this is usedful to you.

How can you know what the main launch Activity is?

Newb question. How can you know what the main launch Activity is? Learning Android.
Assuming this is for your code, check out the manifest.xml and look for this element:
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
It should be contained within <Activity> ... </Activity> tags, and that Activity is the one that a user can launch from their phone.
You have to put the right intent tag on the activity in the manifest:
<activity android:name=".SomeActivity"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
The main activity can be considered the one which handles the initial screen of the application you're creating.
?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="clustering.android"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="10"
android:targetSdkVersion="11" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<application
android:icon="#drawable/gene_launcher"
android:label="#string/app_name" >
<activity
android:name=".MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".yourSubActivity" android:label="#string/<ActivityName>"> </activity>
...list of other activities...
</application>
</manifest>
The main activity can be found and set in AndroidManifest.xml; look for
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
The <activity> with that action is the main activity (is the entry point for the app).
You can look into AndroidManifest.xml in your porject
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
This will help you to find Launch activity.

How to create a transparent activity? which will start after every 5 minutes.And the background should remain what it was

I am creating an application which will call a new transparent activity to launch every 5 minutes.whether the phone is locked or not.
Every thing is working fine.But the problem is when this activity is started,it will start on
a MAIN Launcher activity.
I want to show that activity on Desktop, menu or whatever user is in.
How can i do this?
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.spec.test"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="8" />
<application android:icon="#drawable/icon" android:label="#string/app_name">
<activity android:name=".BroadCastDemoActivity"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".TransparentActivity"
android:label="Transparent"
android:theme="#style/YourTheme">
</activity>
<receiver android:name="MyBroadCastReceiver"></receiver>
<service android:name="MyService"></service>
</application>
<uses-permission android:name="android.permission.VIBRATE"></uses-permission>
<uses-permission android:name="DEVICE_POWER"></uses-permission>
<uses-permission android:name="android.permission.WAKE_LOCK" />
</manifest>
You TransparentActivity needs an <intent-filter> change your TransparentActivity part in the manifest to this
<activity android:name=".TransparentActivity"
android:label="Transparent"
android:theme="#style/YourTheme">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
Or to this if you want the transparent activity to start when you start the application from the users homescreen.
<activity android:name=".TransparentActivity"
android:label="Transparent"
android:theme="#style/YourTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

How to put widget and app in same apk?

I'm trying to put a widget and an app in the same apk.
Here's my manifest
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.me.mywidget"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="7" />
<application android:icon="#drawable/icon" android:label="#string/app_name">
<activity android:name=".settingsPage"
android:label="#string/app_name"
android:theme="#style/app_theme"
>
<intent-filter>
<action android:name="com.me.mywidget.SETTINGSPAGE" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<receiver android:name="MyWidgetProvider" android:label="My Widgets">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data android:name="android.appwidget.provider"
android:resource="#layout/widget_info" />
</receiver>
<service android:name=".UpdateWidgetService"></service>
<activity android:name=".Test"></activity>
</application>
<uses-permission android:name="android.permission.INTERNET" />
<uses-sdk android:minSdkVersion="7" />
</manifest>
How do I put an app and market in the same apk? I tried this and while it runs, the app does not show up in the app drawer.
Also, when I add android:name=".mywidgets" my widget crashes when I run it.
Also, I will be adding multiple sizes to the widget later on.
You need to add the intent filter for launcher to whichever activity you want to show in the launcher...
<category android:name="android.intent.category.LAUNCHER" />
So if .Test is your primary launching activity you would modify your manifest like below..
<activity android:name=".Test"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

Categories

Resources