Archive for the SWT Category

Madness started at 9 p.m. – Android .. TADAAAA !

Posted in Android, Google, java, SWT, Uncategorized with tags , , , , , , on July 5, 2011 by javaforweb

Midnight madness ……  started at 9 p.m. to install Android and launch a sample application !

It all started with installing pandora on my android and as usual itching started…

Quickly installed mamoth size Android SDK… let me check the size….   2.39 GB with plugins…

After that installed ADT on eclipse and associated sdk with the project…   fetched a sample application JetBoy in to workspace…

There was a lil time consumption in adding AVD to project

Finally got success after adding third part Add-ons

Got help from

http://developer.android.com/guide/developing/devices/managing-avds.html

And launched JetBoy.java

It is a game app….  Lost badly 🙂

Now I am happy… this weekend ends in a good way….  its 12:43 a.m. and a curious mind is fed aptly ! its a good start and in coming days postmortem of Android SDK will start !

Happy to see console

[2011-07-04 23:47:24 - com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper] Unable to read C:\AndroidManifest.xml: java.io.FileNotFoundException: C:\AndroidManifest.xml (The system cannot find the file specified)
[2011-07-04 23:47:24 - com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper] Unable to read C:\AndroidManifest.xml: java.io.FileNotFoundException: C:\AndroidManifest.xml (The system cannot find the file specified)
[2011-07-04 23:52:11 - JetBoy] ------------------------------
[2011-07-04 23:52:11 - JetBoy] Android Launch!
[2011-07-04 23:52:11 - JetBoy] adb is running normally.
[2011-07-04 23:52:11 - JetBoy] Performing com.example.android.jetboy.JetBoy activity launch
[2011-07-04 23:52:11 - JetBoy] Failed to find an AVD compatible with target 'Android 1.5'.
[2011-07-04 23:53:13 - JetBoy] Still no compatible AVDs with target 'Android 1.5': Aborting launch.
[2011-07-04 23:53:13 - JetBoy] Performing com.example.android.jetboy.JetBoy activity launch
[2011-07-04 23:53:39 - JetBoy] Launch canceled!
[2011-07-04 23:58:20 - JetBoy] ------------------------------
[2011-07-04 23:58:20 - JetBoy] Android Launch!
[2011-07-04 23:58:20 - JetBoy] adb is running normally.
[2011-07-04 23:58:20 - JetBoy] Performing com.example.android.jetboy.JetBoy activity launch
[2011-07-04 23:58:20 - JetBoy] Failed to find an AVD compatible with target 'Android 1.5'.
[2011-07-04 23:58:42 - JetBoy] Still no compatible AVDs with target 'Android 1.5': Aborting launch.
[2011-07-04 23:58:42 - JetBoy] Performing com.example.android.jetboy.JetBoy activity launch
[2011-07-04 23:58:53 - JetBoy] Launch canceled!
[2011-07-04 23:59:39 - JetBoy] ------------------------------
[2011-07-04 23:59:39 - JetBoy] Android Launch!
[2011-07-04 23:59:39 - JetBoy] adb is running normally.
[2011-07-04 23:59:39 - JetBoy] Performing com.example.android.jetboy.JetBoy activity launch
[2011-07-05 00:00:42 - JetBoy] Launch canceled!
[2011-07-05 00:12:37 - JetBoy] ------------------------------
[2011-07-05 00:12:37 - JetBoy] Android Launch!
[2011-07-05 00:12:37 - JetBoy] adb is running normally.
[2011-07-05 00:12:37 - JetBoy] Performing com.example.android.jetboy.JetBoy activity launch
[2011-07-05 00:12:37 - JetBoy] Failed to find an AVD compatible with target 'Android 1.5'.
[2011-07-05 00:14:22 - SDK Manager] Created AVD 'FirstTest' based on Google APIs (Google Inc.), ARM (armeabi) processor,
[2011-07-05 00:14:22 - SDK Manager] with the following hardware config:
[2011-07-05 00:14:22 - SDK Manager] hw.sdCard=yes
[2011-07-05 00:14:22 - SDK Manager] hw.lcd.density=240
[2011-07-05 00:14:22 - SDK Manager] vm.heapSize=24
[2011-07-05 00:17:11 - JetBoy] Still no compatible AVDs with target 'Android 1.5': Aborting launch.
[2011-07-05 00:17:11 - JetBoy] Performing com.example.android.jetboy.JetBoy activity launch
[2011-07-05 00:17:14 - JetBoy] Launch canceled!
[2011-07-05 00:17:29 - JetBoy] ------------------------------
[2011-07-05 00:17:29 - JetBoy] Android Launch!
[2011-07-05 00:17:29 - JetBoy] adb is running normally.
[2011-07-05 00:17:29 - JetBoy] Performing com.example.android.jetboy.JetBoy activity launch
[2011-07-05 00:17:29 - JetBoy] Automatic Target Mode: launching new emulator with compatible AVD 'FirstTest'
[2011-07-05 00:17:29 - JetBoy] Launching a new emulator with Virtual Device 'FirstTest'
[2011-07-05 00:17:35 - JetBoy] New emulator found: emulator-5554
[2011-07-05 00:17:35 - JetBoy] Waiting for HOME ('android.process.acore') to be launched...
[2011-07-05 00:19:14 - JetBoy] HOME is up on device 'emulator-5554'
[2011-07-05 00:19:14 - JetBoy] Uploading JetBoy.apk onto device 'emulator-5554'
[2011-07-05 00:19:16 - JetBoy] Installing JetBoy.apk...
[2011-07-05 00:20:25 - JetBoy] Success!
[2011-07-05 00:20:25 - JetBoy] Starting activity com.example.android.jetboy.JetBoy on device emulator-5554
[2011-07-05 00:20:30 - JetBoy] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.example.android.jetboy/.JetBoy }
Few useful links to start with :-
http://www.talkandroid.com/android-sdk-install-guide/
other tabs I closed :(
Have to sleep now.. Tomorrow have to get back to my Manual Testing task !
And the Song I listen to all this time is
Walk Away - Five Fingers
Just walk away make it easy on yourself, 
Just walk away please release me from this hell, 
Just walk away there's just nothing left to feel, 
Just walk away pretend that none of this is real !
Advertisements

SWT : Software Widget Toolkit for Eclipse

Posted in SWT with tags on April 27, 2008 by javaforweb
SWT is a windowing toolkit initially developed by IBM that many feel has the ability to contend with Swing, core Java’s main windowing toolkit contender.
Starting a Swing application project is as easy as it gets from a configuration perspective, simply because Swing is included with Java. SWT, however, has two additional hurdles: it is an external API and it includes native code.

This tip discusses setting up an Eclipse project that can use the SWT libraries so you can run and debug SWT code inside of your Eclipse environment. I am specifically focusing on Windows because that is my current setup, but the rules for setting up your environment should be similar irrespective of the platform.

In addition, the general steps for configuring SWT with your application should apply in any development environment, I simply use Eclipse in this example.

To set up an SWT application you essentially need two things. You need the SWT Jar to be in the classpath, and you need the SWT dll to be in the library path. You can get these two items in one of two places.

First, they come shipped with your Eclipse installation. You can find them in the plugins directory. For the JAR, simply look into [Eclipse Home]/plugins/org.eclipse.swt_ – where version number is your Eclipse installation’s version (e.g. 3.1.0). For the DLL (on Windows), simply look into [Eclipse Home]/plugins/org.eclipse.swt.win32_ .

Second, they are also available on the Eclipse website for download. Rather than provide a link that will quickly become outdated however, I will describe how to get there. Simply start at http://www.eclipse.org/downloads/index.php

, choose a mirror, choose an Eclipse version you would like the SWT build for, and then scroll down the Eclipse version download page to find the SWT Binaries and Sources downloads.
Once you have these two resources, it is simply a matter of creating an Eclipse project, and referring to these resources as neccessary.

Creating a Java project is relatively simple in Eclipse, and I won’t go into the process in detail here. If you are interested, the tips for that, along with a lot of other Java development features can be found in ‘Help -> Tips and Tricks -> Eclipse Java Development Tools’.

Assuming you have a Java project for your SWT application, the first step is to refer to the SWT jar. I personally like to copy all neccessary resources in to my project (e.g. a ‘lib’ folder), and then refer to them as neccessary. This ensures that each project has the correct dependencies associated with it. Once again, I don’t plan to go into detail here regarding the association of JAR files with an Eclipse project – the Eclipse ‘Help’ documentation should be helpful if you aren’t familiar. Here is an example setup.

http://www.coffee-bytes.com/images/entries/javalobby/swt_app/classpath.gif

The SWT Jar is handled in the same way as any other external JAR, so more than likely the advice up to this point has been ‘run of the mill’ for many Eclipse users. The DLL file, on the other hand, is unusual for most developers. So, how do we set it up?

From the SWT download page:


To run a standalone SWT application, add the swt jar(s) to the classpath and add the directory/folder for the SWT JNI library to the java.library.path. For example, if you extract the download below to C:\SWT you would launch the HelloWorld application with the following command:
java -classpath C:\SWT\swt.jar;C:\MyApp\helloworld.jar -Djava.library.path=C:\SWT
HelloWorld

 

By handling the JAR file we’ve handled the ‘-classpath’ part of the configuration above, but how do we configure a library path in Eclipse? It turns out this is simply part of the Eclipse runtime configuration for our application. For reference, a runtime configuration is the ‘Run’ menu entry for starting our project. Once again I point you to the ‘Help’ documentation if you aren’t familiar with runtime configurations.
Assuming we create our new ‘main method’ class, and call it ‘HelloWorld’, we can then set up a runtime configuration with this special line in the VM Arguments field:

http://www.coffee-bytes.com/images/entries/javalobby/swt_app/runtimeConfig.gif

Note the use of ‘project_loc’ – this allows us to make the VM argument relative to our project. This certainly isn’t a neccessary step (we could have easily placed ‘c:\SWT’ in this location as well), but it can take great strides in making your project setup more portable to future changes. Also note that by doing this I have been able to bundle the DLL and JAR in the same general location. This is especially important because each SWT Jar has a unique SWT DLL associated with it – they can’t be interchanged. Having the two bundled in a portable location in the project ensures that they won’t get out of sync.

Now it is just a matter of placing some SWT test code in our ‘HelloWorld’ class. From the SWT Component Resources page (http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/platform-swt-home/dev.html),

here is the complete Java code for SWT ‘Hello World’, adapted to meet our class name:
 

import org.eclipse.swt.widgets.*;   public class HelloWorld {   public static void main (String [] args) { Display display = new Display (); Shell shell = new Shell(display); shell.open (); while (!shell.isDisposed ()) { if (!display.readAndDispatch ()) display.sleep (); } display.dispose (); } }

 java Tutorials by Ashutosh Sharma, pls Visit:

http://sharma.ashutosh84.googlepages.com