I got some very strange problem:
Let's say I've got two activities.
If I launch each one of them as the main activity of the application - everything seems great.
But if I launch, let's say activity A from activity B. Activity A has the same theme settings as activity B.
Why is this happening?
Activity A is translucent, and if I start the application from activity A - it is transparent, but if I start it from activity B - it is not??
This is my AndroidManifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="gg.thesis.gallant.command" android:versionCode="1"
android:versionName="1.0">
<application android:icon="#drawable/icon" android:label="#string/app_name">
<activity android:name=".viewall.A" android:label="#string/app_name"
android:clearTaskOnLaunch="true" android:launchMode="singleTask"
android:theme="#android:style/Theme.Translucent">
<intent-filter>
<!-- <action android:name="android.intent.action.MAIN" />-->
<!-- <category android:name="android.intent.category.LAUNCHER" />-->
</intent-filter>
</activity>
<activity android:name=".viewall.B" android:label="#string/app_name"
android:clearTaskOnLaunch="true" android:launchMode="singleTask">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
....
Is there any theme inheritance for the activities in Android?
Thanks!
write one line in your second activity tag....
android:theme="#android:style/Theme.Translucent"
<activity android:name=".viewall.B" android:label="#string/app_name"
android:clearTaskOnLaunch="true" android:launchMode="singleTask"
android:theme="#android:style/Theme.Translucent">
</activity>
may be work...
Related
I start the app on phone through Android Studio, it is shown an error in app. If I open application through an icon on my phone, then it works. I think that a problem in AndroidManifest.xml
P.S. If devices isn't in Lolipop, then it doesn't work anyhow.
UPD: I publish my app in Google Play. In Developer Console I received a notification message that an error in Main Activity, onCreate. But I don't found anything here.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.engineers.great.firstapp"
>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<application
android:allowBackup="true"
android:icon="#mipmap/icon"
android:label="#string/app_name"
android:theme="#style/AppTheme">
<!--Below MA which started at first. I can can return here, if I use a back button -->
<activity android:name="com.engineers.great.firstapp.MainActivity"
android:windowSoftInputMode="adjustResize"
android:configChanges="orientation"
android:screenOrientation="portrait">
<intent-filter>
<category android:name="android.intent.category.LAUNCHER"/>
<action android:name="android.intent.action.MAIN"/>
</intent-filter>
</activity>
<!-- It's not a main menu lol if you click from MA on "START" then you will be here -->
<activity android:name=".MainMenu"
android:windowSoftInputMode="adjustResize"
android:configChanges="orientation"
android:screenOrientation="portrait">
<intent-filter>
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<!-- Below from MA1_! to MA2 are questions and results of my test. I set intent extras in everyone. I don't know, maybe it's important -->
<activity android:name=".MainActivity1_1"
android:windowSoftInputMode="adjustResize"
android:configChanges="orientation"
android:screenOrientation="portrait">
</activity>
<activity android:name=".MainActivity1_2"
android:configChanges="orientation"
android:screenOrientation="portrait">
</activity>
<activity android:name=".MainActivity1_3"
android:configChanges="orientation"
android:screenOrientation="portrait">
</activity>
<activity android:name=".MainActivity2"
android:configChanges="orientation"
android:screenOrientation="portrait">
</activity>
<!-- It's many buttons with different results of test -->
<activity android:name=".Sociotypes"
android:configChanges="orientation"
android:screenOrientation="portrait">
</activity>
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
</application>
</manifest>
You are not using any Launcher intent filter in first activity.
Add this in the activity you want to launch first :
<intent-filter>
<category android:name="android.intent.category.LAUNCHER"/>
<action android:name="android.intent.action.MAIN"/>
</intent-filter>
I made an Android application, but when I look at it in my device, the appName just disappeared whereas I added it in the manifest and strings.xml. My application is the one at the bottom left
manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.package.package.package"
android:versionCode="3"
android:versionName="2">
<application
android:allowBackup="true"
android:icon="#drawable/countdown_icono"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
// Activities
</application>
strings.xml
<resources>
<string name="app_name">I can\'t wait!</string>
</resources>
If someone could helps :)
SOLUTION :
<activity
android:name=".MainActivity"
android:label="APP NAME" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
You probably need to add
android:label="#string/app_name"
inside your Activity tag in the AndroidManifest.xml.
<activity android:name=".theJavaClassActivity"
android:label="yourString">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Android Launcher shows the title of the activity that has the Intent-filter of android.intent.action.MAIN. In this way it is able to show more than one activity icons and titles if your application requires so.
I'm trying to combine android manifest files from 2 plugins in Unity, but there are two activities with the same intent-filter and I can only get 1 or the other to work at the same time....
Of the 2 conflicting activities, whichever is on top in the manifest file is the one that will work. So if activity from manifest #1 is on top, plugin #1 will work but not #2, and vice versa.
The two conflicting activities are:
<activity
android:name="com.devfo.andutils.DevfoUnityPlayerActivity"
android:label="#string/app_name"
android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
And:
<activity android:name="com.qualcomm.QCARUnityPlayer.QCARPlayerProxyActivity"
android:label="#string/app_name" android:screenOrientation="portrait"
android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
is there any way I can merge the two and get them to work from the same app? I'm using Unity 3d.
For example in the manifest where you want to use only the first activity as launcher you have to add this 2 modifications:
At the beginning of the manifest:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
And for the activity for which you want to remove the intent filter add this code:
<activity android:name="com.qualcomm.QCARUnityPlayer.QCARPlayerProxyActivity"
android:label="#string/app_name" android:screenOrientation="portrait"
android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
<intent-filter tools:node="removeAll">
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
The important part is to add the tools:node="removeAll" attribute in the intent-filter tag
Declare your manifest header like this:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
And then add one of the following appropriate attributes to the relevant Activity(s):
tools:merge="override"
tools:merge="remove"
Slightly different to #amarkovits answer, I've found success with:
<activity android:name="com.qualcomm.QCARUnityPlayer.QCARPlayerProxyActivity"
android:label="#string/app_name" android:screenOrientation="portrait"
android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen"
tools:node="merge">
<intent-filter tools:node="remove"> ...
which I believe will try to merge it first, then replaces just the intent filter causing both Icons on the launcher screen
The Activity that has this intent-filter:
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
is the main Activity that will start on application start up, you can't make both activities work at the same time.
what you should do is let only one Activity ( your main one have this filter) and leave the other one without it.
the second Activity will also be part of the application, but it will not be the first Activity you will see. You can start it by using the startActivity() method.
I have done this, the solution is that when you have multiple flavors, like
1. flavorA,
2. flavorB
and main application id is - com.android.vivek
and main flavorA is using com.android.vivek
and second flavorB is using com.android.vivek.flavorb
flavorA's manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.android.vivek">
<application xmlns:tools="http://schemas.android.com/tools"
android:allowBackup="true"
android:icon="#mipmap/flavorA_ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme"
tools:replace="android:icon" />
<activity
android:name=".ActivitySplash"
android:label="#string/app_name"
android:launchMode="singleTop"
android:screenOrientation="portrait"
tools:node="replace">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
then simply flavorB's manifest mention like below
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.android.vivek">
<application xmlns:tools="http://schemas.android.com/tools"
android:allowBackup="true"
android:icon="#mipmap/flavorB_ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme"
tools:replace="android:icon" />
<activity
android:name=".flavorB.SecondActivity"
android:label="#string/app_name"
android:launchMode="singleTop"
android:screenOrientation="portrait"
tools:node="replace">
<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
android:name=".ActivitySplash"
android:label="#string/app_name"
android:launchMode="singleTop"
android:screenOrientation="portrait">
<intent-filter tools:node="remove">
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
when you run flavorA or flavorB then it will work fine
I have the same problem everyone reports but this began happening suddenly. My app was working as expected, automatically launching the MAIN activity.
But all of the sudden it stopped working and I started seeing the No Launcher activity found! message.
This is my Manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.xitrica.android">
<uses-permission android:name="android.permission.INTERNET" />
<uses-sdk android:minSdkVersion="8" />
<application android:icon="#drawable/icon" android:label="#string/app_name"
android:theme="#style/Theme.Transparent">
<uses-library android:name="com.google.android.maps" android:required="true" />
<activity android:name="ElBusetonActivity" android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="andoid.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="RouteInfoActivity"></activity>
<activity android:theme="#android:style/Theme.Translucent.NoTitleBar"
android:name="GetDirectionsActivity"></activity>
<activity android:theme="#android:style/Theme.Dialog"
android:name="PointProviderList"></activity>
</application>
</manifest>
Sorry if I'm not posting this snippet correctly. It's the first time I ever post a question.
Thanks in advance.
<activity android:name=".ElBusetonActivity" android:label="#string/app_name">
try this, prefix (".") on activity name
here (.) refer to package path
Remove
category android:name="android.intent.category.DEFAULT"
as it is not required.
Say if you have the Activity names TestActivity
If you want the TestActivity to be the first to launch when you hit "run", simply add two lines:
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
To the position like below in your AndroidManifest.xml:
<activity
android:name="TestActivity"
android:label="#string/name"
android:screenOrientation="portrait" >
<intent-filter android:label="#string/app_name" >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
use the dot before the activities in your manifest to declare it. or you can write the package name dot your activity name.
like this.........
<activity android:name=".ElBusetonActivity" android:label="#string/app_name">
if you not using package name then it decide the default one.
I am trying to develop a basic app to display information in 2 tabs, and from my understanding the info in each tab needs to have its own activity, in addition to the one for the tabs. I have done this, all of the java code looks right, and I have declared all 3 activities in my AndroidManifest.xml. When I launch the app, it crashes on start, and when I run logcat, I find:
java.lang.RuntimeException: Unable to start activity ComponentInfo{android.wingdom.convention/android.wingdom.convention.TabWidget}: android.content.ActivityNotFoundException: Unable to find explicit activity class {android.wingdom.convention/android.wingdom.convention.Schedule}; have you declared this activity in your AndroidManifest.xml?
I keep doublechecking the file, and I dont see anything wrong, it currently looks like this:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="android.wingdom.convention"
android:versionCode="1" android:versionName="1.0">
<application android:icon="#drawable/icon" android:label="#string/app_name">
<activity android:name=".TabWidget"
android:label="#string/app_name"
android:theme="#android:style/Theme.NoTitleBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<activity android:name=".Map" />
<activity android:name=".Schedule" />
</activity>
</application>
You are defining activities in your activity.
Try the following code instead:
<activity android:name=".TabWidget"
android:label="#string/app_name"
android:theme="#android:style/Theme.NoTitleBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".Map" />
<activity android:name=".Schedule" />