Once you’ve created a virtual device or attached a device for debugging you’re ready to create your first project. Within eclipse select file, new, Android application project.
The application name can be any string. Keep it short because it’s going to appear as a label on the device itself to identify your app. If you make this string too long it’ll be truncated automatically. The project name can be the same as the application name but it can’t include any spaces or special characters. The project name is only used by eclipse and it won’t affect the app itself.
The package name is very important. It’s a globally unique identifier for your app and to make it globally unique most developers use their website address their domain name in Reverse domain notation. For example for my personal applications I might use a package name that starts with com.junaidshahid nobody else in the world is going to use that package name because I own the domain JunaidShahid.com for this course will use a generic package name of org.example just like com.example which this defaulted to this is a reserved domain that’s only used globally for training examples. These apps won’t be submitted to the Google Play Store or other applications distribution channels they’re only for training so this is a good package name to use but for your apps use your domain.
Next we’ll set the SDKs, the minimum required SDK represent the earliest version of Android that you’re going to support with your app. It defaults to android 2.2 but that version of the operating system has a very small market share. These days so the earliest person that I recommend supporting is Android 2.3 or gingerbread. As of the time of this tutorial gingerbread still had about twenty six percent of the global device market.
If you want to make your life a little easier though change the minimum required SDK to API 14 android 4.0 or ice cream sandwich. By only supporting four point oh and up to eliminate a lot of extra coding and testing that you’d otherwise need to do and you’ll still have a majority of the market available to you.
The target SDK represents your primary operating system target. The last version of jelly bean was really the most common new version of the operating system on real devices. It’s up to you which target SDK to support but typically I set this to the latest version of android. So i’ll set it to kit Kat I’ll accept the default theme but you can also experiment with the other built-in themes of polo dark and polo life and I’ll click Next.
On this screen I’ll leave all the options at their defaults including create custom launcher icon and then I click Next.
I’ll be taken to a screen, where I configure the launcher icon. The launcher icon is a graphic that visually identifies the app to the user on the device. The default is a picture of Andy the Android but you’ll want to customize to some extent and this screen makes it easy to do that.
You can either choose clipart by selecting clipart and then click and choose or you can create a text based icon I’ll use clipart, select that and click and then I’ll select one of these graphics you can choose anything you like this is going to be a simple hello application so I’ll select just a picture of a head and I get this graphic as my launcher icon.
Now you can customize it, you can indicate how much additional padding you want, that resizes the graph. I’ll leave it at the default of 0% and you can indicate whether you want to wrap the graphic in a square or a circle.
I’ll select a circle and you can change the colors I’ll click on the foreground color button and then I’ll choose a color. If you have trouble getting to the color selected dialogue try double clicking on these buttons and you can also affect the background color. If you prefer once again set the padding now that I have a safe around the icon and I’ll click Next.
On this screen, you indicate what your initial application looks like. The applications appearance is controlled by something called an activity, and for our first app will use the default of a blank activity, you could also select full screen activity or master detail flow but those will create a lot more code than we want to look at right now so I’ll select blank activity and click next.
Now accept the defaults on this screen and click finish and that creates my application.
Now to start the application, and see how it will look on the device make sure that you’ve opened a Java file. One will open automatically for you called mainactivity.java then go to the menu and select run and click run again.
The first time you run any project you’ll be asked what kind of launch configuration you want to use choose this one run as Android application and click OK.
Depending on your system configuration, your app might automatically launch and that could happen if you only have one virtual device, or one actual device, attached to your computer. But if you have more than one option you might be prompted to choose the device, I’m going
to choose my AVD for nexus for my virtual device so I’ll click that and click ok.
Now the AVD Nexus with prompt and you will observed that, the android application is already installed and running on the device. You can close it and re run from the home of android device where you will get the Icon of the application.
Subscribe the channel to get latest updates on tutorials, and keep visiting the blog for latest tutorials. 🙂