Android | Titanium Development

All posts in Android

Density Specific Resources for Appcelerator Titanium in the real world

I’ve put on Github a quick example of how Density Specific Resources are used on Android in Appcelerator Titanium. I did this because I wanted to understand how big my images needed to be for the ‘top’ Android devices on my current project. I did the Android version originally when my client didn’t have an Android phone to test on. I just used 1x images in the default Android/images folder. Now, he has a S3 and think the graphics are ‘blurry’. I use ‘dips’ for the layout and fonts, so that works really well between devices. It is just the images I need to improve.

Here is the summary:
res-xhdpi (Samsung Galaxy Nexus, Samsung Galaxy S3 – 720×1280) 2x the size of dps. Use the same @2x images for iPhone. i.e. 100dp = 200px.
res-hdpi (Samsung Galaxy S, Samsung Galaxy S2, HTC Desire HD, HTC Incredible S – 480×800) – 1.5x size of dps. i.e. 100dp = 150px.
res-mdpi (HTC Desire 2.5) – Same as iPhone images i.e. 100dp = 100px
res-ldpi (people who need a new phone) – .75x size of dps. i.e. 100dp = 75px

I’ve also thrown in some sample splash screen sizes for reference.

All the apps I have developed are Portrait only, so I dont worry about ‘land’ folders. The only other screen resolution that I saw in my stats was the HTC Sensation 4G at 540×930 (3.34% of users) It should use hdpi, the screen will just be 360dp wide instead of 320dp.

Other things I found out:
There is a sporadic bug in building for the Android device. Make sure you do a clean before you deploy to your device as sometimes deploying to the Emulator removes all drawables from the build directory. If you don’t see the images on your device, check your build/android/res/drawable-xxx directories and make sure the files are there.

In the future, I may create a script to generate the correct image files from a @2x image using ImageMagick, much like Bob Sims did with Splash Screens. I also want to get the icons figured out correctly. I’ll post my findings on that later.

Date posted: October 3, 2012

4 comments - Latest by:
  • jeff See http://developer.appcelerator.com/question/125317/calculate-apps-density-pixel-width--height-using-titaniumplatformdisplaycapsdpi
  • Olga Hi Jeff, Thank you for the reply! Do you know if there is any way to get the device width in ...
Top

Appcelerator Titanium: App Crashes on Nexus S running Android 2.3.6

I got my first Android phone today and quick started installing Appcelerator Titanium apps on it. Unfortunately, every one of them crashed when I opened them on the device! I would have to do a ‘force close’. The Kitchen Sink was the first, then a default project with a clean app.js.

About 1 hour of Google fu got me no closer to a solution when I stumbled upon this post on the Q&A. Sure enough, I turned off analytics in tiapp.xml on the apps and they all installed and worked! I’m not sure if the problem is specific to the Nexus S or Android 2.3.6, but I hope this will help someone our there!

Date posted: October 11, 2011

0 Comments
Top

Appcelerator Titanium Kitchen Sink Android Emulator FAIL: INSTALL_FAILED_OLDER_SDK

I was attempting to get the Kitchen Sink running in the Android Emulator and kept getting the error INSTALL_FAILED_OLDER_SDK. What the? From reading the Q&A, I knew that I need to be running on Android 2.1, but every virtual machine I created was 1.6? It turns out, I was looking in the wrong place to change it.

I kept opening the ‘configure…’ link in TiApp.xml and updating the Default Android SDK. This was the wrong place.

After banging my head against the wall for a while (and cleaning the project, restarting, etc.) I finally found where I should be looking:  Run Configurations

Once I found this, you can see where to set the options:

Run it, and you are good to go!

I hope that helps, and this post gets some SEO love to help people who are searching.

Date posted: September 20, 2011

2 comments - Latest by:
Top
Page 1 of 1