I'm building a time logging application and i have created the main layout.
I tried to debug my application on my phone Samsung Galaxy S and it starts fine, but if i close it and want to run it again it's not in my app drawer. It shows up in Settings->Programs->Manage and in Recent when holding down the home button.
Here is the manifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.doweb.timelog" android:versionCode="1">
<application android:icon="#drawable/icon" android:label="#string/app_name" android:theme="#android:style/Theme.NoTitleBar">
<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">
</category></action></intent-filter>
</activity>
</application>
<uses-sdk android:minSdkVersion="8">
</uses-sdk>
</manifest>
I think your closing </action> tag in the intent-filter is in the wrong position.
Should look like:
<intent-filter>
<action android:name="android.intent.action.MAIN" > </action>
<category android:name="android.intent.category.LAUNCHER"> </category>
</intent-filter>
That filter is a signal to the system that this activity should be visible in the app-drawer. When it's not correct or present, the activity won't be visible.
Usually it's best to use closed empty elements to prevent this error:
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
You're also missing a . in front of your activitys class. This always relates to your apps package name. It will internally be joined to packagename + classname. Therefore the dot, otherwise it would result in com.doweb.timelogMainActivity, which is obviously not the correct reference. So it should be android:name=".MainActivity".
your activity's name like this android:name=".MainActivity", you can have a try
Related
I'm new to android and Developing very basic App. I have completed my development but when ever I debug my app in device. It shows 2 icon. I'm facing this problem after implementing Splash Screen in my app. Please suggest me how to overcome. My manifest
<?xml version="1.0" encoding="utf-8"?>
<application
android:allowBackup="true"
android:icon="#mipmap/icc"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity
android:name=".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=".Login_page">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
In your manifest file -
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
This piece of code means which activity will first start when you launch the app. But you have put this code in both of your activities hence Android provides a separate launcher for both the activities and you see two icons.
So remove the above code from one of the activities. Just let it remain in the Activity you want to start first when your app launches.
TO have a icon on the launcher screen you need action of the activity to be action_main and category to be launcher and your both activity qualifies the criteria for this.
You should change your login_activity category to default or simply remove the category.
You can start your login activity from splash activity.
I hope it helps you.
I am trying to set up a mobile website that opens my mobile app when a link is clicked in the Android browser. To accomplish this task, I added an intent filter to AndroidManifest.xml, as seen in the code below:
<activity android:name=".MyAppActivity" android:label="#string/app_name" android:theme="#style/Theme.Titanium" android:configChanges="keyboardHidden|orientation" android:alwaysRetainTaskState="true" android:launchMode="singleInstance">
<intent-filter>
<data android:scheme="myapp" android:host="app"/>
<action android:name="android.intent.action.MAIN"/>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.LAUNCHER"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
</intent-filter>
</activity>
The link itself in the browser works great, and I'm easily able to gather parameters when the app is first opened using Ti.Android.currentActivity. The problem comes when the app is already open, but a user clicks the link to open it from within the mobile browser. When my app opens, instead of resuming where I left off before, I simply see the splashscreen. This goes both ways: If I opened the app first from the mobile browser, then tried to resume it later from the Android homescreen or app drawer, I only see the splash screen. Per tips I saw on other places of the internet, I tried adding the code below to AndroidManifest.xml (as seen above):
android:alwaysRetainTaskState="true" android:launchMode="singleInstance"
This however, appears to have no effect on anything, and the same problem persists. What am I missing here? Any help would be greatly appreciated.
The way i have done was like this
<android xmlns:android="http://schemas.android.com/apk/res/android">
<uses-sdk android:minSdkVersion="9" android:targetSdkVersion="18"/>
<manifest android:installLocation="preferExternal"
android:versionCode="1" android:versionName="1.0">
<uses-permission android:name="android.permission.CALL_PHONE"/>
<application android:label="App Name" android:largeHeap="true">
<activity
android:configChanges="keyboardHidden|orientation|screenSize"
android:label="#string/app_name"
android:launchMode="singleTop"
android:name=".mainActivity" android:theme="#style/Theme.Titanium">
<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.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data android:scheme="schemaname"/>
</intent-filter>
</activity>
</application>
</manifest>
</android>
and its working fine for me . for Android 4.XX
I'm in the process of making a Launcher app, but I can't get my app to show up in the activity chooser when the home button is pressed. I'm sure I'm just missing something simple, but I can't find it! Here's my manifest file:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.espian.jump"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="16" android:targetSdkVersion="17" />
<application
android:label="#string/app_name"
android:icon="#drawable/ic_launcher">
<activity
android:name="JumpActivity"
android:label="#string/app_name"
android:theme="#android:style/Theme.Holo.NoActionBar"
android:launchMode="singleTask"
android:clearTaskOnLaunch="true"
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.LAUNCHER" />
</intent-filter>
</activity>
</application>
Try replacing that
<category android:name="android.intent.category.LAUNCHER"/>
with
<category android:name="android.intent.category.DEFAULT"/>
As it says in the android intent filter documentation:
activities that are willing to receive implicit intents must include
"android.intent.category.DEFAULT" in their intent filters
Actually I'd suggest opening that page and searching for that text, and having a little read around it. I think you'll find these categories make a lot more sense if you do. You're specifying that this appears in the launcher instead.
I just created my first Android app, all works fine, but all of the activities are shown on my Android menu. What did I do wrong?
Screenshot: imgur.com/9CmXU
I want to have one icon, directing to MainActivity, not all activities
<!-- language-all: lang-html -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.myApps.birthdaymeter"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="15" />
<application
android:icon="#drawable/my_logo"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".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=".BirthdayMeter"
android:label="#string/title_activity_birthday_meter" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".AboutWindow"
android:label="#string/title_activity_about_window" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".ShowResult"
android:label="#string/title_activity_show_result" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
This is my manifest, changing logo didn't help
The <intent-filter> tag is used to describe the type of Intents that each Activity will respond to. The "android.intent.action.MAIN" action says that this Activity is an entrance point for your Application (think the main method that a java program requires). The "android.intent.category.LAUNCHER" category tells the OS to display the Activity in your list of Applications. Adding the DEFAULT category is ok, but effectively the same as omitting the <intent-filter> tag completely (which I find to make for much cleaner and easier to read code). You should only be using the <intent-filter> tag with these two actions and categories on the Activity that starts when a user opens your app. If wanted an Activity within your application to be able to respond to some special intents, you would use the tag to define which it responds to.
Here's a link to the google dev pages to help you learn more about Intent Filters.
http://developer.android.com/guide/components/intents-filters.html
Here's the documentation for the <intent-filter> tag. It's not the easiest to understand though.
http://developer.android.com/guide/topics/manifest/intent-filter-element.html
And here's the docs for the Manifest file and the Intent class. Both of these are good for reference if you're not sure about which tags to use in your Manifest. Good luck!
http://developer.android.com/guide/topics/manifest/manifest-intro.html
http://developer.android.com/reference/android/content/Intent.html
You phrased your question extremely generally, so I am not sure what to answer. It seems like you haven't called nameOfActivity.this.finish() when you launched another activity
If you post your manifest file I can help a little more, but it looks to me like you have not declared your activities correctly.
It should be setup somewhat like this:
<application android:icon="#drawable/icon" android:label="#string/app_name">
<activity android:name="Activity1"></activity>
<activity android:name="Activity2"></activity>
<activity android:name="Activity3"></activity>
</application>
Essentially, create an application declaration, and then include each activity within it.
My application is never shown in the RECENT APPS list whenever I put the following piece of code in my activity's manifest entry
<category android:name="android.intent.category.DEFAULT" />
If I remove above line it works fine. I've also made sure that the following flags are set to false-
android:noHistory="false"
android:excludeFromRecents="false"
But still its never displayed even if I launch app manually.
In case anybody wants to have a look the manifest, its-
<?xml version="1.0" encoding="UTF-8"?>
<uses-sdk android:minSdkVersion="8" />
<application
android:name="com.raj.poc.copypaste.MainApplication"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name" >
<activity
android:name=".CopyPasteActivity"
android:launchMode="singleTop"
android:noHistory="false"
android:excludeFromRecents="false"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<action android:name="android.intent.action.SEARCH_LONG_PRESS" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
It may also happen if you set
<activity... android:label=""/>
for your main Activity
This is the only activity in your application, right?
You are using the category tag twice. You have written in your code
<category android:name="android.intent.category.LAUNCHER" />
so you have already selected the category. When you add a new activity then you will write the Default category tag.