Where can I find documentation when coding in Eclipse? - android

Then writing XML as manifest, how can I find documentation for things like intent-filter or action? Can I somehow display information on this in Eclipse without visiting developer.android.com like I can see the JavaDoc in Eclipse?
<activity android:name=".Activity1"
android:label="Activity1">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

In Eclipse just press Ctrl+Space and you will get descriptions of elements.
Just make sure you're opening your manifest with the Manifest editor (right click on manifest -> open with -> Android Manifest Editor). Anyway why not use the GUI editor? You have tips there as well.

A good start: http://developer.android.com/guide/topics/manifest/manifest-intro.html

Related

How to choose an activity as a starter activity while launching an app?

I come up with a strange problem while trying to set "SignUpActivity" as my starter activity. I tried different ways but either I am getting an error or "mainActivity" is popping up as a starter activity.
My "AndroidManifest.xml" file has the following code.
<activity
android:name=".SignUpActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<action android:name="android.intent.action.VIEW" />
</intent-filter>
</activity>
<activity
android:name=".MainActivity" />
the above code gives me the error as shown in image
As the error states activity must be exported or contain an intent-filter
so, I did
<activity
android:name=".MainActivity"
android:exported="true"/>
and also tried adding intent-filter to activity. Of course, these methods make error go away but my app starts with MainActivity, not with SignUpActivity. What should I do to slove this issue?
Your AndroidManifest.xml is set correctly, check your run/debug configuration is set to 'App', not 'MainActvity'
If the 'App' configuration is missing - you will need to add it by first selecting 'Edit Confurations'
There are similar posts about this error msg.
Check the run configuration , probably you need to edit the app configuration and choose it to run.
As guided by #Eric I selected an option "app" from the run configuration which solved my problem. Previously, somehow it was set to MainActivity which was causing the issue. I have attached an image to demonstrate the solution for future readers.

Launch app using an intent URI (and making that URI show up as link in other apps)

I know this has been asked before, and I have looked through a lot of those questions, but none seems to hold the answer for me.
What I am trying to do is to open my app when I click a link, which in my case would look like dots://test.com/. I'm trying to get this working through intents. When I replace dots:// with http:// and use http in my scheme instead of dots, it works fine. But since the only domains I own have got pretty long urls, it's not practical to go that route.
My android manifest looks like this:
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:logo="#drawable/logo"
android:theme="#style/AppTheme" >
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<meta-data
android:name="ADMOB_ALLOW_LOCATION_FOR_ADS"
android:value="true" />
<activity
android:name="nl.delta6.dots.engine.MainActivity"
android:exported="true"
android:label="#string/app_name"
android:screenOrientation="landscape"
android:theme="#android:style/Theme.NoTitleBar.Fullscreen" >
<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="dots" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />
</application>
I have tried numerous solutions mentioned in posts like Make a link in the Android browser start up my app? and Launch android application from a browser link, but none seem to work for me. All ideas are welcome.
Edit 1:
Okay, so I noticed that if I click a link on a webpage like dots link, it does launch my app. The links just don't show as links in other apps, though I know that is possible. I'll keep looking around, but if there's anybody who could send me off in the right direction that'd be more than welcome.
I think the best article is here: Make a link in the Android browser start up my app?
Note that you really want to use hackbod's recommendation, which means that registering the scheme "dots" to yourself is not a good idea. The easiest way to create a link that a browser can use is to first, in a test setting, have your intent format itself to a uri:
Intent intent = new Intent(someContext, MainActivity.class)
System.out.println[or use logcat](intent.getUri());
Then just paste the output from intent.getUri() as a url. It will look something like:
intent:#Intent;component=[your/activty/class/NameActivity;]
If you serve that as a link on a website, connect to it on your phone with your app installed and click the link it should then open your app.
Note that you can also add "extras" to your activity using putExtra if you want to see example intent uris that can be used to send extra data back to your app.

MyFirstApp installed on emulator but can't launch it

I'm going through the Android 'Building Your First App' tutorial and have gotten stuck trying to run the app. I created the app and emulator with Eclipse (Juno Build id: 20120920-0800 on OS X, default installation. The Android SDK, etc. was updated today).
The app appears to be installed on the emulator. I.e. 'Home -> Menu -> Manage Apps' lists it and it's App info looks ok. (Total=24.00KB, App=24.00KB, USN storage app=0.00B, ...).
However, it does not appear in the apps launch list (i.e. the screen with 'API Demos', 'Browser', etc.
Is there some other way to launch it? Is there something I have to do to get it into the app list? Any help would be appreciated - this is driving me crazy.
thanks
In your manifest xml file you need to make sure that you have
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
in your activity definition. If you don't see your application in the launcher then it suggests you don't have "android.intent.category.LAUNCHER" set.
Your manifest file should have something like (this isn't a complete manifest)
<application android:icon="#drawable/icon" android:label="#string/app_name">
<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>
You can't just put the intent-filter lines in your manifest. If you double click the manifest it will open up. You get 2 methods to edit it, raw XML or using a basic interface. Personally I think you're better off with the raw interface. Look below the window that opens when you double click the manifest, you'll see some tabs like Manifest, Application... the last on is AndroidManifest.xml - this is the raw xml. The first one is basic setup.
Don't forget to save your manifest file and do a clean and build then run it.

Android application icon not showing up

I've just spent numerous hours constructing an icon for an Android app I'm working on, but can't get it to show up for the app in the emulator.
I've put it in res/drawable-hdpi, res/drawable-mdpi, res/drawable-ldpi in the respective sizes as defined in http://developer.android.com/guide/practices/ui_guidelines/icon_design_launcher.html
The manifest contains the line:
<application android:icon="#drawable/icon" android:label="#string/app_name" android:debuggable="true">
Any ideas as to why it isn't showing up?
I would like to elaborate on the answers of #Britton Pentakill and #arnav bhartiya because I could solve my problem using their answers. I added more actions on my MainActivity because Android Studio was complaining that "App not indexable by Google" and I also wanted it to be indexable.
Wrong AndroidManifest.xml:
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
<action android:name="android.intent.action.SEND"/>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data android:scheme="https"
android:host="siara.cc"
android:pathPrefix="/CrossCalc" />
</intent-filter>
So when I published my app, people could not find my App Icon on their device, no Open button after installing on Play console, even if it did pass review and published on play store (it took 7 days).
Then when I read their answers, I corrected and now I am able to see the icon for opening my app:
Correct:
<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="https"
android:host="siara.cc"
android:pathPrefix="/CrossCalc"/>
</intent-filter>
Make sure the icon is stored with the name icon.png in those folders.
Make sure android has a drawable/icon resource. Check this by looking at your gen/R.java file and seeing public static final int icon = 0x.... in the drawable inner class.
Try cleaning your project build and uninstalling any existing version of your app from your phone/emulator and then reinstall the new version.
Notice Win Myo Htet's comment on the accepted answer. He solved my problem.
Jems since your answer has so much vote, can you add the following
pointer too: Make sure that intent-filter for MAIN and LAUNCHER is not
mixed with other intent-filter. – Win Myo Htet Dec 6 '15 at 5:47
"mixed" being the keyword. I had intent in my AndroidManifest.xml file that was there to prevent all file types from being available in file selects. While it began with the second answer's solution, it contained the extra intent for the file selects. This prevented Android from installing my icons when installing the app. I wanted to post this in case anyone else ran into this issue since Win My Htet's brilliant advice could easily be missed since it is essentially one word "mixed"
Make sure that the Intent of your Launcher Activity is named MAIN i.e,
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
Moreover, add the icon to your Drawable folders and then refer it in the application block of Manifest.
<application
android:allowBackup="true"
android:icon="#drawable/icon"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
I had a similar problem recently and I eventually found out there were two causes:
File extension: To stay on the safer side, always stick to .png format. Some other formats actually work on certain devices (e.g using a .jpg icon still showed up on my Infinix note 4 phone) but .png files are guaranteed to work on all devices.
Storage location: Your icon file should be in the drawable folder. Remember to do a double check as to whether your manifest file points to the place you saved your drawable too.
I hope this helps.. Merry coding!
<manifest ...>
<application
android:icon="..."
android:roundIcon="..."/>
</manifest>
In application of manifest of your app there are two attributes, icon & roundicon. one is for debug and another is for release.
For displaying icons you need to replace the #drawable in the theme style and it will work
If you are running on Android 5.0, just add these lines into the onCreate method, inside MainActivity:
getSupportActionBar().setDisplayShowHomeEnabled(true);
getSupportActionBar().setLogo(R.drawable.ic_launcher);
getSupportActionBar().setDisplayUseLogoEnabled(true);
It might help in your case.
Add this:
android:roundicon also
In my case after assigning both ic_launcher and ic_launcher_round in all mipmap folders I had to remove the following folder "mipmap-anydpi-v26" in order to show app Icon.
in intent filter tag only action and category are allow not others
tag. if any wrong tag in intent filter tag then you can not open and
see your application in mobile phone.
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<!-- <action android:name="android.intent.action.SENDTO" />-->
<!-- <data android:scheme="mailto" />-->
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>

Android: APK Icon is not being installed

I am able to deploy my application but for some reason, I am not able to get the icon to display in the pull up menu on the Home page of the OS. Does anyone know what I can do to solve this?
By the way, the application shows up in "Manage Applications" but does not show up as an icon for some reason. Through Eclipse, I am able to start the application after deployment but that's it... After that, I don't have any way to start it because there is no icon. :( Following is my manifest file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.ApplicationName"
android:versionCode="1"
android:versionName="2.0">
<application android:icon="#drawable/icon"
android:debuggable="true"
android:label="#string/app_name">
<activity android:name=".EntrySplash"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.BROWSABLE"></category>
<data android:scheme="com.android.ApplicationName"></data>
</intent-filter>
</activity>
<activity android:name=".EntryScreen" android:label="#string/app_name">
</activity>
<activity android:name=".ApplicationName" android:label="#string/app_name">
</activity>
</application>
<uses-sdk android:minSdkVersion="3" />
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
</manifest>
I had this problem as well, i think the fix that worked for me is i separated the intent tag like below
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<category android:name="android.intent.category.BROWSABLE"></category>
<data android:scheme="com.android.ApplicationName"></data>
</intent-filter>
when i changed my manifest file like that, my icon showed up.
Try getting rid of your android.intent.category.BROWSABLE and <data android:scheme="com.android.ApplicationName"> temporarily, and see if your icon shows up.
Also, on an unrelated matter, I recommend that your uses-* elements be the first children of manifest, not the last. There have been rumors of problems with the XML parsing done by the Android Market, where it wants to see those before any elements.
Had this same issue and found out that one caveat is that this correct intent on the main activity tag:
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
has to be in its own intent filter. you may have other items in the main activity's intent filters, and if so, separate the rest out in to a separate intent filter tag right below it. leave the MAIN and LAUNCHER together in its own.
Alot of the answers to this question on SO seem to miss that point.
Hope it helps!
Well it is happening as you are giving two categories name to your launching activity. You launching activity should have only one category name in its Intent filter. But if you also need the Browsable activity then your Launching Activity may have 2 Intent Filters as show below.
You just replace your EntrySplash Activity code with the below code in you Manifest.xml file.
<activity android:name=".EntrySplash"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<category android:name="android.intent.category.BROWSABLE"></category>
<data android:scheme="com.android.ApplicationName"></data>
</intent-filter>
</activity>
This will sure work for you...
This problem still exists in SDK v2.2. A few more suggestions in addition to the ones above if you want to publish to your phone from Eclipse. Try these if it's still not working and you don't feel like manually publishing. Remove all blank lines in the manifest. And make sure this line just has only icon and label properties in it:
<application android:icon="#drawable/icon" android:label="#string/app_name">
Apparently I found out that it works if I manually install the application using command line adb. So, in case you updated your ADT plugin and you experience problems, just install things manually...
I find that sometimes my assets don't update in the app when I add them to my projects.
There are two ways you can fix this problem:
Clean and rebuild the project.
Uninstall the app on your phone and install it from scratch using ADT.
Simple as that!
Just to add confirmation to CommonsWare's answer, I just came across this exact bug for a project targeting 2.3.3+. I had to Delete the following:
<data android:scheme="com.android.ApplicationName"></data>
Then I had to Clean the project. I think that having to use adb to install every time is a sign of something wrong with the Manifest, and will come back to bite you later (once in the Market specificially).

Categories

Resources