Tech blog

Solving problems

About
Contact

Archive for the ‘Java’ tag

Thoughts on android mobile development

leave a comment

Intro
We like the taste of MVC in ASP .NET and have some practical experiences in coding Java applets, J2ME and Silverlight applications.

Lately our team decided to build a simple application for Android phone to try the platform. Story begins with an idea and motivation, installing and setting Eclipse + Android SDK, and like always, a sketch, todo list, etc.

Issues

  • For each property in layout xml the “android:” namespace is needed. Of course it can be replace with “a” but it still annoying to write it every time. Example <LinearLayout android:id=”@+id/pnlSomething” />   There is more advanced graphical xml standard – SVG
  • oops, I tried (miss-clicked) to run android as classic Java application but it returns an error (like build error),
    next time I try running as android application this error wont go away even if the code is fine
    solution: delete error from the error list and it should work fine :)
  • sometimes I run a debug and don’t notice the tiny icon in the far right bottom corner of eclipse
    that shows the application is launching and it’s stuck… and I try to launch it again, and again
    and applications are trying to launch parallel… solution: close eclipse and start again
  • connection refused on localhost? is this a joke? is only google.com allowed?
    firefox opens it normally, firewall is off, same on IIS and apache, permissions are set in manifest.xml
    reason: ‘localhost’ means the internal loopback of device (emulator) not the PC,
    solution: use your LAN IP
    //solution: edit hosts and set something like 127.0.0.1   pc-localhost //does not work
    http://groups.google.com/group/android-developers/browse_thread/thread/801645febf0523ea/9e779925e9570828
  • when a crash occurs it is just a crash, without detailed message or tip, developer should guess the error
    * and, BTW, emulator shows wrong time on windows (7:04 PM while the real time is 21:04 on GMT+1 timezone
    or 5:07 PM when the time is 19:07)
  • Record breaker among IDEs: 1.131 GB of RAM taken by Eclipse
  • A lot of features: social media, web, google maps, sqlite, bluetooth,
  • gestures, camera, speech recognition, 3D, processing…
  • s it easy to learn? theory yes, it is logical and quite simple, well documented;
    but dealing with basic practical issues is a pain

What really annoys us is that when we write layout in xml and we are confidant with it schema is right, works in theory, draws a preview but just don’t work in emulator Eclipse won’t tell what is the problem it just says “Source Not Found.”

Comparison: C# vs Java

A good programming language uses less code and effort to complete a task. What makes Silverlight (C#) coding easier and Android (Java) coding harder? Advantages of C# over Java or what is missing in Java:

  • lambda expression and Linq make handling data, arrays, xml easy
  • properties
  • partial types when dealing with large files
  • preprocessor directives (#if, #region) to bring visual focus on the particular part of code that is being developed and hide the other code
  • verbatim string, like @”C:\Program Files\android\sdk.exe” without escape characters
  • nullable types, like int? that can be -n…0, 1, 2…n or null
  • ‘yield’ keyword
  • ‘??’ operator
  • enumerations that are avoided in Android (Android uses constants, requires documentation to locate a constant)

* comparing to Silverlight you need to write more code in a more complex way for same features (ie. async, binding,
db, events)

* nullable types, like int? that can be -n…0, 1, 2…n or null
VN:F [1.9.3_1094]
Rating: 0.0/5 (0 votes cast)
VN:F [1.9.3_1094]
Rating: 0 (from 0 votes)

Written by developer

June 28th, 2010 at 2:04 pm

JAR and JAD installation problems: Compulsory attributes missing

leave a comment

If you have something like this in your JAD file

MIDlet-Description: Your application
MIDlet-Icon: /res/p1/icon.png
MIDlet-Jar-Size: 273904
MIDlet-Jar-URL: http://someurl.com/application.jar
MIDlet-Name: AppName
MIDlet-Vendor: VendorName
MIDlet-Version: 0.9.33
MicroEdition-Configuration: CLDC-1.1
MicroEdition-Profile: MIDP-2.0

Be careful and check if you have some empty lines in your JAD file because this is causing this error!
Just delete empty lines.

VN:F [1.9.3_1094]
Rating: 0.0/5 (0 votes cast)
VN:F [1.9.3_1094]
Rating: 0 (from 0 votes)