action bar not showing extending from a different module - android

I've created a :core module that stores some of my basic activities, some of these should show an actionbar, in the manifest I've something like this:
<activity
android:name=".components.home.HomeActivity"
android:theme="#android:style/Theme.Holo.NoActionBar">
</activity>
<activity
android:name=".components.activities.ContactsActivity"
android:theme="#style/AppTheme.TranslucentActionBar" >
</activity>
I don't understand why but now that I've created another module :extension that includes :core, the actionbars in that activities seems to not show.
The manifest of extension is very simple:
<application
android:name=".App"
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme"
tools:replace="android:icon" >
<activity
android:name=".components.activities.TestActivity"
android:label="#string/title_activity_test" >
</activity>
<activity
android:name=".components.home.WelcomeActivity"
android:label="#string/title_activity_welcome"
android:theme="#style/AppTheme" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
Usually this is a problem that concerns themes, but to me everything seems fine, I don't understand why it works when I build simply :core, but it doesn't work when building :extension project

I've spent too much time when the answer was easy.
Pressing Ctrl+click made me see how the theme was made, I've simply switched parent to the old layout.
<style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar">

Related

How to pre-load on boot all activities in android

I'd like to solve a "too much waiting" problem. Hi to everybody :)
The case is that i've an application with a main menu that has 2 buttons. I'll paste the manifest here so you can see what I'm talking about.
<?xml version="1.0" encoding="utf-8"?>
<uses-permission android:name="android.permission.WRITE_INTERNAL_STORAGE" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="razvitrance.administradorcontraseas.PantallaPrincipal"
android:label="#string/title_activity_pantalla_principal"
android:windowSoftInputMode="adjustResize|stateHidden" >
</activity>
<activity
android:name="razvitrance.administradorcontraseas.PantallaPrincipalAdministrar"
android:label="#string/app_name"
android:windowSoftInputMode="adjustResize|stateHidden" >
</activity>
<activity
android:name="razvitrance.administradorcontraseas.PantallaAyuda"
android:label="#string/title_activity_pantalla_ayuda"
android:windowSoftInputMode="adjustResize|stateHidden" >
</activity>
<activity
android:name="razvitrance.administradorcontraseas.PantallaAdministraroGenerar"
android:label="#string/title_activity_pantalla_administraro_generar"
android:windowSoftInputMode="adjustResize|stateHidden" >
</activity>
<activity
android:name="razvitrance.administradorcontraseas.PantallaPrincipalGenerar"
android:label="#string/title_activity_pantalla_principal_generar"
android:windowSoftInputMode="adjustResize|stateHidden" >
</activity>
<activity
android:name="razvitrance.administradorcontraseas.SplashScreen"
android:label="#string/title_activity_splash_screen"
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>
</application>
My main menu called .PantallaPrincipalAdministraroGenerar has 2 buttons and each of them call the new .PantallaPrincipalAdministrar and .PantallaPrincipalGenerar activities.
Well, my problem is that when I push the first of them, it takes no time to show the activite because it seems that that activity is already loaded, but when I push the second one the .PantallaPrincipalAdministrar takes too long until it appears on front and I do see on android studio's console how it is loading and creating all the files & allocating all the memory.
Is there any way I can preload all my activities in the boot of the app or while the splashscreen??
Thank you so much.
Luckily you cannot really. And you are most likely addressing problem in wrong place - if your activity takes too long to start check what you are doing in onCreate(), offload some tasks to background thrads, rework your ui, use Fragments, use lazy initialization etc, etc.

Application starting with different activity, Android Studio

first timer here (both in development and posting in SO). I've used idunnololz to create an animated listview for a simple reference app I'm trying to make. It's turned out really well, but after I've created it, when I run the app to test it, it now runs as AnimatedExpandableListView both in the ActionBar title and in the app drawer. I've searched here and found that you can get the app to launch with a different activity by editing the AndroidManifest.xml, so I verified that I'm pointing to my MainActivity class:
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<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>
</application>
I presume this may be an issue with the MainActivity class, but maybe there's something here that I'm missing?
I found my answer here:
Android: App name shows the first page name, not the app name
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="#string/app_name" >
<intent-filter **NEED #string/app_name HERE**>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

How to insert an android activity into the manifest given in a tutorial?

I am very new to android development with eclipse, and I encounter dozen of errors and problems. Here is the next one:
I am following an android tutorial given here in order to set up the action bar. In this tutorial is says to insert an activity as follows:
<activity android:theme="#style/Theme.AppCompat.Light" ... >
Can I just put this line into the xml manifest file?
<activity android:theme="#style/Theme.AppCompat.Light">
Or do I need to replace the '...' by something more useful?
Please read the docs: activity-element
The activity's name is required, so you would need to have:
<activity android:theme="#style/Theme.AppCompat.Light" android:name="MyActivity">
Other than that, you are not required to add any other attributes.
Although be sure to place the activity element within the proper place in your xml. It should be contained in your application block:
<application android:label="#string/app_name"
android:icon="#drawable/ic_launcher"
android:theme="#android:style/Theme.Holo.Light">
<activity android:name="MyActivity"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
Unless you really want your app to work under API levels under 3.0 then you have to add it like this.
android:theme="#style/Theme.AppCompat.Light"
Inside your already defined activity in your manifest (the one that has the intent filter and other declarations).
otherwise you dont have to add that at all.
This is one example.
<activity
android:name=".MainActivity"
android:theme="#style/Theme.AppCompat.Light"
android:screenOrientation="portrait"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
and this is another
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme=#style/Theme.AppCompat.Light"" >
<activity android:name=".DetailActivity"
android:label="#string/app_name" >
</activity>
The second way you posted is just fine, be sure to close the activity tag so it looks like <activity android:theme="#style/Theme.AppCompat.Light"></activity>
Also, if you're using eclipse, it is easier to go into the AndroidManifest and under the Application tab scroll to the bottom where there's Application Nodes and then add your view from there. Eclipse will auto generate the correct code in the xml file.

Label attribute in AndroidManifest.xml

I have a manifest with its label declared so the launcher label is different from the Main Activity (the one that is launched at start).
It was working fine, but today I saw on a friends phone it took the activity's label instead.
I have no idea what could be happening.
If it is of any help, the phone was a Motorola Razr.
Here's the relevant portion of the manifest:
<application
android:name="com.app.eventiame.EventiameApp"
android:allowBackup="true"
android:icon="#drawable/logo"
android:label="#string/app_name"
android:theme="#style/Theme.Sherlock.Light.DarkActionBar" >
<activity
android:name="com.app.eventiame.MainActivity"
android:label="#string/title_activity_main" >
<intent-filter android:label="#string/app_name">
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
You have wrote
android:name="com.app.eventiame.EventiameApp"
instead you can just specify your app name here as below
android:name="EventiameApp"

How to change activity hierarchy?

I build a project with many activities. Every time, when I was creating new activity, I set a hierarchy parent. But I decided to make an activity with animation, which should be first. I tried to change some information inside manifest file and set the new one activity as the starting activity, but I'm doing something wrong and all the project is crushing. Ofc, I will be keep going and trying to change the manifest file, but maybe I can do that in an easier way using Eclipse tools?
--EDIT--
I solved my problem, it was a quite small mistake. I was just setting wrong layout and forget to change one more thing. I'm not a specialist yet on this topic, but maybe for other readers I will put here some information how to change the hierarchy using manifest file. If I will make any mistakes here, feel free to edit.
Ok, so let's suppose we have our project with a few activities. Inside Manifest file we can find some information about activities, this informations are between markers: . So, it may looks like:
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.mastermind.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="com.example.mastermind.StartGameActivity"
android:label="#string/title_activity_start_game"
android:parentActivityName="com.example.mastermind.MainActivity" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.example.mastermind.MainActivity" />
</activity>
<activity
android:name="com.example.mastermind.NewActivity"
android:label="#string/title_new_activity" >
</activity>
Now we want to change the MainActivity, which is the first one and set as the first one the NewActivity. We only need to change the name of activity which contains markers:
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
for the name of NewActivity and also set it's layout, like this:
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.mastermind.NewActivity"
android:label="#string/title_new_activity" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.example.mastermind.StartGameActivity"
android:label="#string/title_activity_start_game"
android:parentActivityName="com.example.mastermind.MainActivity" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.example.mastermind.MainActivity" />
</activity>
<activity
android:name="com.example.mastermind.MainActivity"
android:label="#string/app_name" >
</activity>
That should be Ok.
In the manifest file locate category.LAUNCHER:
<activity
android:name="com.example.StartActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" /><!-- This -->
</intent-filter>
</activity>
<activity
android:name="com.example.MainActivity"
android:label="#string/app_name" >
</activity>
The category.LAUNCHER declares your launch Activity.

Categories

Resources