The Eclipse platform provides an installation and update mechanism called p2. This update mechanism allow to install new Eclipse functionality and to update existing. Eclipse p2 can be integrated into Eclipse RCP applications.
The update and installation of functionality with p2 is based on Eclipse Features Feature simply describe a list of plugins and other features.
Create a Eclipse RCP project "de.vogella.rcp.p2.base" based on the "Eclipse RCP with a view" template. Create a feature project "de.vogella.rcp.p2.base.feature" which includes the plugin "de.vogella.rcp.p2.base".
Add a product configuration called "p2base.product" to your "de.vogella.rcp.p2.base" plugin. Select that this product will be based on "features".
2.2. Adding the p2 UI
The pre-defined p2 UI can be found in the feature "org.eclipse.equinox.p2.user.ui". Add this feature to your product. You also need to make the p2 UI visible in your application. Create a new menu in your application and add the pre-defined commands "org.eclipse.equinox.p2.ui.sdk.update", "org.eclipse.equinox.p2.ui.sdk.install" and "org.eclipse.ui.window.preferences" to the menu. If you start your application you should already seen the menu entries but p2 does not work in an application which is started from the workbench you need to export your product.
Export your product via the "Eclipse Product export wizard" on the overview tab of p2base.product. Make sure to select the "Generate metadata repository" flag on the export dialog.
2.3. Create category
In your feature project create file File -> New -> Other -> "Category Definition" a new category for your feature.
Press "New Category" and create a category, e.g. with the name "vogella.de". Add your feature to this category.
2.4. Export your feature
Export your feature via File -> Export -> "Deployable features". Deploy it to a local directory on your machine. Make sure you select on the Option tab your "category.xml". Also make sure to select "Generate metadata repository".
2.5. Test
Try if this feature can be installed into your Eclipse IDE. See Using the Eclipse Update Manager for information on how to use the Eclipse update manager. Use the update manager and point to your local directory. Restart the IDE after installation. You should have a new command after the installation.
After a restart of your Eclipse IDE you should have an additional menu entry.
Using the Eclipse Update Manager revert this installation.
Using the "Hello RCP" template create a Eclipse RCP application in plugin "de.vogella.p2.app". Create a feature "de.vogella.p2.app.feature" which includes plugin "de.vogella.p2.app" and "org.eclipse.rcp".
In the plugin "de.vogella.p2.app" create a new product configuration "app.product". The product should be feature based. Export your product and make sure you can start it. Please see Eclipse RCP for details.
Add the feature "org.eclipse.equinox.p2.user.ui" to your product. Adjust your runtime configuration and run your product again. You should see now difference.
The p2 commands attach themself to the menu with the ID "help". Create a menu with the id "help" and re-run your application. See Eclipse Commands Tutorial if you need information on how to define a menu.
If you select the menu you will get an error message.
Export your product then you should be able to open the update manager.
Use the update manager to install your "de.vogella.p2.add.command.feature" feature.
With a distributed version control system you basically do not have a central code repository but everyone has its own branch. To can clone a branch and you always get the full history of the whole branch on your system. You commit into your own branch and you can push your changes to other repositories and other people can pull from you.
The main advantages of distributed version control systems are
Speed: As the whole repository is offline available you can much faster search and compare
Commits: Everyone can commit to his own branch
Another popular distributed version control systems is Git .
1.2. Mercurial
Mercurial is a distributed version control system. Mercurial is used by Oracle for the OpenJDK development and offered as a option by Google in Google hosting.
Mercurial is written in Python. Mercurial has a command-line interface. Eclipse provides also a plugin to use Mercurial.
Eclipse creates a lot of metadata with regards to the current status of the Eclipse workbench. Also Eclipse creates compiled version in the directory bin. This data should not be placed in the mercurial repository. Create the file ".hgignore" in the same directory as the hg project.
# switch to regexp syntax. syntax: regexp ^\.metadata ^de.vogella.mercurial.firstproject/bin$
3.3. Create Java Project
Start Eclipse and use the new directory as workspace. Create a new Java project "de.vogella.mercurial.firstproject". Create the following Java class.
If you have checked out the Mercurial project from another site you can push your changes to the repository.
hg push
Check the history via:
hg log
3.5. Making changes
Rename your Java class to "TestNewName" and create a new class "Test2".
package de.vogella.mercurial.firstproject;
public class Test2 {
/** * @param args */ public static void main(String[] args) { System.out.println("Hello Mercurial"); System.out.println("This is a new class"); }
}
Add the the new files to Mercurial.
hg commit -A -m 'Commit with automatic addremove'
A rename in Java removes the old file. Mercurial will report these files as missing (hg status). You can use the following command to automatically add the new files and remove the deleted.
Add the the new files to Mercurial.
hg addremove
You can now commit. The -A flag in the commit command would also automatically add and remove new files.
hg add .
3.6. See changes
To see the changes use the status command. diff we show the differences.
To create a new repository via the plugin, select a project, right-mouse click ->Team… – Share Project… – Mercurial. Select Team -> Add to add resources to the repository.
You can also import an existing repository to be able to push changes to this repository. Choose File-> Import -> Mercurial -> Clone repository using Mercurial to checkout an project.
Subversion is a centralized version control system, e.g. the whole history of a project is stored on a server. Subversion libraries and executables are written in the programming language C. Alternatives to centralized version control system are distributed version control systems, for example Git .
Eclipse Subversive is a plugin for Eclipse to use subversion (svn). To use subversion from Eclipse you need the Eclipse plugins which extends Eclipse with the subversion functionality and you need connectors which allows to connect from Java to subversion. Unfortunately the Eclipse UI plugins and the connectors are in different update sites due to license reasons with the connectors.
You have the choise between two svn connectors SVNKit and JavaHL. The differences between the connectors is described in Subversive Connectors . The versions of the connectors correspond to the svn version.
Table 1. SVNKit
Connector
svn version
SVNKit 1.2.X
For SVN 1.5
SVNKit 1.3.X
For SVN 1.6
Table 2. JavaHL
Connector
svn version
JavaHL 1.5.4 Win32 Binaries and Native JavaHL 1.5 For SVN 1.5
For SVN 1.5
JavaHL 1.6.X Win32 Binaries and Native JavaHL 1.6 For SVN 1.6
Use the Eclipse update manager to install "Subversive SVN Team Provider" from the Helios Update site. Restart your Eclipse. After the restart Eclipse will start the Connector Discovery which allows you to install the connectors. Use SVNKit as a connector if you are behind a proxy.
Subversive ignores certain resources per default. Which resources are ignored can be configured via Windows -> Preferences -> Team -> Ignored Resources. You can add resource patterns like "bin", "build" so that these are also ignored.
Git is a distributed version control system written in C. JGit is a library which implements Git in Java. EGit is an Eclipse Team provider for Git (using JGit) and makes Git available in the Eclipse IDE . This tutorial describes the usage of EGit. For an introduction into Git based on the command line please see Git Tutorial .
The following section explains how to create a repository for one project and shows how to checkout an exiting projects from a remote repository.
4.1. Put a new project under version control
Create a project "de.vogella.git.first". Create the following class.
package de.vogella.git.first;
public class GitTest {
/** * @param args */ public static void main(String[] args) { System.out.println("Git is fun"); } }
Right click your project, select Team -> Share -> Git. Select the proposed line and press "Create repository". Press finish.
You have created a local Git repository. The git repository is in this case directly stored in the project in a ".git" folder.
Create the file ".gitignore" in your project with the following content. All files / directories which apply to the pattern described in this file will be ignored by git. In this example all files in the "bin" directory will be ignored.
bin
4.2. Clone existing project
EGit allows to clone an existing project. We will use an Eclipse plugin as example. To learn more about accessing standard Eclipse coding please see Eclipse Source Code Guide .
Select File -> Import -> Git -> Git Repository. Press clone and maintain the git repository "git://dev.eclipse.org/org.eclipse.jface/org.eclipse.jface.snippets.git". You only have to paste the URL to the first line of the dialog, the rest will be filled out automatically.
After pressing next the system will allow you to import the existing branches. You should select at least "master".
The next dialog allow you to specify where the project should be copied to and which branch should be initially selected.
You get an additional import dialog.
You have checked to the project and can use the team Git operation on your project.
4.3. Repository view
EGit has a "Git repository"" view which allow you to browse your repositories, checkout projects and manage your branches.
Once you have placed a project under version control you can start using team operations on your project. The team operations are available via right mouse click on your project. You can:
Select "Team" -> "Add", on the project node to add all files to version control.
Select "Team" -> "Commit", to commit your changes to the local Git repository.
Select "Team" -> "Branch" to create and to switch between branches.
Select "Team" -> "Push" to push your change to a remote Git repository (see the GitHub chapter).
"Team" -> "Tag" allows you to create and manage tags.
5.2. Merge
EGit supports currently fast-forward merge. Fast-forward merge allows to add the changes of one branch into another if this branch has not been changed. Select "Team" -> "Merge" to perform this operation.
5.3. View the resource history
Select a resource and select Show in (Alt+Shift+W) -> History to see the commit history of this resource.
To put several plugins into the same git repository you should create them in a subfolder under your workspace and then create via EGit a repository for this subfolder.
To test this create two new Java projects "de.vogella.egit.multi.java1" and "de.vogella.egit.multi.java2". Do not use the default location (which would be the workspace) but in a subfolder "gitmulti".
Create a few classes, as git is not able to save empty folders. Now select both projects, right click on them, select Team-> Share-> Git.
Done. Both projects are now in the same git repository.
Github is a popular hosting provider for Git projects and if you repository is public to everyone Github hosting is free. To use GitHub create an account on the Github Website . During the sign-up you will be asked to provide a "passphase". This "passphase" is later needed to push to Github from your local repository.
7.2. Create Repository in Github
Create a new repository on Github, e.g. "de.vogella.git.github".
After creation of your new repository Github tells you what to do if you would inport via the command line. As we are going to use EGit we can ignore this information.
7.3. Push project to Github
Create a new project "de.vogella.git.github" and put it under version control. Right-mouse click on your project and select "Team" -> "Push". A dialog pops up. Maintain the following data. Adjust the hightlighted line so that you are using your user and your project name.
In the world of application development many may found that earlier prototyping can help a lot. "Show your ideas at the beginning and be sure that you will get proper feedback from the customer, collect it and build great software" this is a simple rule that helps a lot in my day-to-day activities. I know several kinds of the prototypes but the most difficult is always a GUI.
What the customer expects? How to place various elements on screen? What is required and what is optional? How to organize dialogs? How to show customer the GUI without implementing it? We try to solve today all that questions in our public effort - Android GUI Prototyping Stencil for Visio.
User interface become more sophisticated and tolerant at the same time to the user input but it does not make life easier to the developer. We are code warriors, we not always design skilled persons, however we know how to recognize professional work among others.
Our stencil is a good professional help for everyone who want to develop something innovative on Google Android Platform. By using it for making own applications professional and user friendly. By using it you help customers to understand what they will get at the end of the development at the initial stage of the project. Be sure their feedback will save your time significantly.
Screenshots
Android Original
Stencil Prototype
Terms of use
Please, specify in all documents produced with help of our stencil reference to us; it can be a simple phrase, like: "UI was designed with help of ArtfulBits Android GUI Prototyping Stencil" somewhere in the document or simple reference in about box of the final application. Thanks.
If you have a fix or have suggestion that will help all of us, please don't hesitate to send a note to our android team. We will be happy to update stencil ASAP :)
Installation and Usage
Using of this stencil require Microsoft Visio 2003 or higher;
Download the stencil archive from our web site;
Unpack the archive and place files from it into folder on your choice;
Start Visio and select required type of diagram (Windows XP User Interface is preferable);
File --> Shapes --> Open stencil…
Select previously downloaded stencil in the dialog for open. Press OK.
You are now ready for GUI prototyping!
Usage notes
Instead of images/icons for the buttons we use Wingdings font symbols. We found them fitting very nice for prototyping. Also, we will appreciate any help in finding more fonts like Wingdings for community. Send us a message with the link to the font and we will update this page with it!
To edit complex controls, like: image buttons, context menus, tab controls use double click;
Looks like Calibri is a default font for Android UI, but Arial & Arial Narrow fonts also make weather on several screens;
Frames sizes are in inches, but they are accurate - we use DPI metric for transforming inches to pixels;
We intentionally don't want to make elements 100% the same as Android has. Two reasons:
Do not allow to produce fake screens for community - our prototypes must be recognizable between others;
This is prototyping!!! The prototye will not be the same as the final UI screen;
Roadmap
Version 1.2: in 2 weeks - estimation: 27/10/2008; more controls will be added, fixes to the found issues during those 2 weeks; increased usability; will make style and feel more accurate;
Version 1.1: in few days – estimation: 17/10/2008; more controls and sample will be added;
Controls: List view, progress bar, auto complete, checked text view, digital clock, date picker, chronometer, grid view, map view, Media controller, multi auto complete, rating bar, scroll view, seek bar, time picker, Two line List items, Web view, zoom controls.
13/10/2008: Version 1.0: initial set of controls and element for Android GUI design. Into archive attached sample Visio document with several default screens from Android phone.
Supported controls: 4 different resolutions and orientation frames, application header, battery status & 3G tools, white & black background, labels, checkbox, radio button, button, image button, ON/OFF toggle button, Pickers (Month, Date, Year), star button, editor box, password editor box, directory mark, analog clock, phone editor, tab control, combo box, Image gallery, context menu with black & white themes, calculator pad with black & white themes, Dialup controls, Dialog window, Date picker dialog.
I have to create splash screen activity. This code is basic code for splash screen.
This are simple step for splash screen. I hope you enjoyed this code.
If you create splashscreen activity then must be devices target name android 1.6 or 1.8 or 2.1 or more then. otherwise this project cany be run in your devices.
1 ==> First Step
Create one android project. Name This android project is android. And go to res/layout/main.xml file.
3. Deploy toolcains and kernel source and enter in the kernel source tree.
$ mkdir -p android $ cd android $ tar xjvf ../arm-2007q3-51-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2 $ tar xzvf ../linux-2.6.23-android-m3-rc20.tar.gz $ cd kernel
4. Get the config.gz from the running emulator by the following way.
$ adb pull /proc/config.gz .
5. Decommpress the config.gz and rename it as .config
T-Mobile has released an online emulator of the G1 for all of you who either missed the pre-order or simply can’t decide if it’s for you. Give it a spin and tell us what you think.
A new version of Google Maps for mobile phones brings the search giant’s ground-level Street View technology to handsets everywhere… except the iPhone.
It’s a move that’s being seen by some as the first blow in the battle between the iPhone and mobiles running Google Android, such as the HTC Dream.
While any phone running Java, and BlackBerry handsets with colour screens can get in on the act, the iPhone is left lacking.
Google’s download site even displays a message to visitors using an iPhone saying “Sorry, Google Maps does not work on your Apple iPhone.”
Installing Google Android SDK 1.0 On Ubuntu 8.04 Desktop
Version 1.0 Author: Falko Timme Last edited 09/24/2008
This guide explains how you can install the Google Android SDK 1.0 on an Ubuntu 8.04 desktop. With this stable release of the Android SDK, you can now develop applications for Android smartphones (like T-Mobile's G1) and offer them on the Android Market.
I do not issue any guarantee that this will work for you!
Before we can install the Android SDK, we must install Java and Eclipse (version 3.3 or 3.4 - I'm using 3.4 codename "Ganymede" here).
First, we open a terminal (Applications > Accessories > Terminal):
To install Java, we type
sudo apt-get install sun-java6-bin
(If you are on a x86_64 system, you also must install ia32-libs:
sudo apt-get install ia32-libs
)
You will be asked to accept the Java license during the installation:
The Android SDK 1.0 requires Eclipse 3.3 or 3.4. Ufortunately, the Ubuntu 8.04 repositories only have a package for Eclipse 3.2 - therefore we must install Eclipse manually.
Open a browser and go to http://www.eclipse.org/downloads/. Select one of the Java, Java EE, or RCP versions of Eclipse. I've chosen the Eclipse IDE for Java EE Developers for Linux 32bit (select Linux 64bit if you're on an x86_64 system):
Download the file to your hard drive, e.g. the desktop (/home/falko/Desktop):
To install Eclipse, we must open a terminal again. Go to the directory where you've saved the Eclipse file and uncompress it:
cd /home/falko/Desktop/ tar xvfz eclipse-jee-ganymede-linux-gtk.tar.gz
This creates a directory called eclipse.
Afterwards, you can delete the Eclipse archive file:
rm -f eclipse-jee-ganymede-linux-gtk.tar.gz
My eclipse directory is now located on my desktop (/home/falko/Desktop) - I don't want it there, so I move it to my home directory (you can leave it where it is or move it to whatever directory you prefer):
mv eclipse ~
Inside the eclipse directory, there is an executable called eclipse - that's the file we must run when we want to start Eclipse. Obviously, we don't want to do this from the command line, so we create a launcher for it.
Right-click on Applications and select Edit Menus:
Select Programming (or whatever category you want the launcher to be located in) and click on New Item:
Type in the name of the application (e.g. Eclipse) and the full path to the eclipse executable (/home/falko/eclipse/eclipse in my case) and click on OK:
Then leave the menu editor:
Now we can use the launcher to start Eclipse (Applications > Programming > Eclipse):
Eclipse is starting up...
... and asking for a workspace (you can accept the default one):
... and save it to your hard disk (e.g. on the desktop):
Now open a terminal again and go to the directory where you've saved the Android SDK and unzip it:
cd /home/falko/Desktop/ unzip android-sdk-linux_x86-1.0_r1.zip
We don't need the zip file anymore, so we can delete it:
rm -f android-sdk-linux_x86-1.0_r1.zip
We now have a directory called android-sdk-linux_x86-1.0_r1. In my case it's on my desktop - I don't want it there, so I move it to my home directory (you can as well leave it where it is):
mv android-sdk-linux_x86-1.0_r1/ ~
The android-sdk-linux_x86-1.0_r1 directory contains a subdirectory called tools (/home/falko/android-sdk-linux_x86-1.0_r1/tools in my case). We must now open ~/.bashrc and add the following line to it so that android-sdk-linux_x86-1.0_r1/tools is in our PATH:
Next, we must install the Android Eclipse plugin. In Eclipse, go to Help > Software Updates...:
Go to the Available Software tab and click on Add Site...:
The Add Site window opens. Fill in https://dl-ssl.google.com/android/eclipse/ and click on OK:
Back on the Available Software tab, select Developer Tools (this should automatically check Android Development Tools and Android Editors) and click on Install...:
In the Install window, make sure that both Android Development Tools and Android Editors are checked, and click on Next >:
Click on Finish next:
The plugins are now being installed:
Eclipse must be restarted for the changes to take effect, so when you are asked if you want to restart Eclipse after the installation, you should select Yes:
After Eclipse has started again, we must update our Eclipse preferences to point to the Android SDK directory. Go to Window > Preferences:
If you see this message, click on OK and forget it:
Click on Browse...
... and select the Android SDK directory (/home/falko/android-sdk-linux_x86-1.0_r1 in my case):
Back in the Preferences window, click on Apply and then OK:
That's it, you can now use the Android SDK to create your own Android applications.
This example is taken from http://code.google.com/android/intro/hello-android.html. It's a good test if your Android SDK is working as expected. We will create a small application that displays Hello, Android on an Android phone.
First, we create a new project (File > New > Project...):
Select Android Project and click on Next >:
Fill out the project details as follows:
Afterwards, you should see this window (navigate to HelloAndroid > src > com.android.hello > HelloAndroid.java > HelloAndroid > onCreate(Bundle) to see the source code in the source code window). Click on the Maximize icon in the upper right corner of the source code window to maximize it:
You should then see the source code in a bigger window. Modify the code so that it looks as follows:
public class HelloAndroid extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); TextView tv = new TextView(this); tv.setText("Hello, Android"); setContentView(tv); } }
Save the file. To run the code, go to Run > Run Configurations...:
Highlight Android Application and click on the icon in the upper left corner that looks like a white sheet of paper:
The following window should come up. Fill it out as shown, click on Apply...
... and then on Run:
When you do this for the first time, the following message appears. Click on Proceed to continue:
Finally, the Android emulator comes up. It can take a while until the Android phone has started up (so please be patient), but afterwards you should see Hello, Android in the display:
Congratulations, everything is working as expected!