Back-porting from Android 2.0 to Android 1.5

by AJ » Tue, 08 Dec 2009 07:06:23 GMT

Sponsored Links
 I have read the website and archives on backporting (building on SDK
2.0 to run on SDK 1.5) and it seems consensus is to change the minimum
SDK version required in the manifest (from 5 back to 3) and check for
any private API calls. I've done that, but I have two remaining
concerns. [Note: I wrote/built this app on 2.0 with emulators without
access to an Android 1.5 device.]

1) drawable verses the new drawable-* ... if I don't have an icon in
drawable.png will my application be icon-less in 1.5? Do I need to
copy one of the new icons in there? If so, which one?

2) search ... how does the "SEARCH" activity get raised for an
application on SDK 1.5 devices (which don't appear to have a hardware
search button.) Do I need to add a menu option and raise SEARCH as a
sub-activity? [Note: I am 100% confused by search button on all
android versions 'cos what I read says SDK 2.0 copes with virtual
buttons, yet those devices (in emulator) seem to have hardware ones.
What am I missing?]

Thanks in advance for help with these. Please let me know if there are
any more issues I am missing.


Back-porting from Android 2.0 to Android 1.5

by Dianne Hackborn » Tue, 08 Dec 2009 07:26:30 GMT


If you want to run on pre-1.6 platforms, I would suggest putting your medium
density bitmaps in drawable/* instead of drawable-mdpi/*.  1.6 and later
will assume that these are medium density.

Whether or not there is a search button is really a device thing, and not a
platform version thing.  For example, the G1 has a search key on its hard
keyboard, and you can assume there will be devices running 2.0 and later
that don't have a search key.  If search is important for your app, you will
want to have another mechanism to get to it -- often a menu item.

Dianne Hackborn
Android framework engineer

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.


Sponsored Links

Back-porting from Android 2.0 to Android 1.5

by theSmith » Wed, 09 Dec 2009 00:20:59 GMT

 Should we just create our own search activity or is there one
available in 1.5?  As far as I know the global search feature is only

When creating our own activity, how would we capture the search key
(hard) being pressed on a device?



Back-porting from Android 2.0 to Android 1.5

by AJ » Thu, 10 Dec 2009 17:10:34 GMT

 n Dec 7, 4:25pm, Dianne Hackborn <> wrote:
Thank you.

Thanks, again, that helped a lot. I've added a menu option (although
I'd love to know how to hide that if I could detect a hardware

My remaining problem is the search suggestion provider code (which I
took from a 2.0 sample) will compile on SDK 1.5 (I've built a SDK
project to ensure little is hidden by backwards compatibility.)
Anyway, things seem good unless I actually return search suggestions
via a

* The columns we'll include in our search suggestions. There are
others that could be used
* to further customize the suggestions, see the docs in {...@link
SearchManager} for the details
* on additional columns that are supported.
private static final String[] COLUMNS = {
"_id", // must include this column

The generation is here:

MatrixCursor cursor = new MatrixCursor(COLUMNS, 0);
for (String ingredient : matching_ingredients) {
cursor.addRow(new String[] {
ingredient, // _id
ingredient, // text1
ingredient // intent_data (included when
on item)

I've tried reading SearchManager documentation, but cannot seem to
track down what columns it is expecting (or not expecting) for SDK 1.5
that causes it to try to get a long when I don't have one.

Unless I comment that out, I get:

12-08 12:02:21.263: ERROR/AndroidRuntime(808):
java.lang.NumberFormatException: Achee
12-08 12:02:21.263: ERROR/AndroidRuntime(808): at
12-08 12:02:21.263: ERROR/AndroidRuntime(808): at
12-08 12:02:21.263: ERROR/AndroidRuntime(808): at
12-08 12:02:21.263: ERROR/AndroidRuntime(808): at
12-08 12:02:21.263: ERROR/AndroidRuntime(808): at
12-08 12:02:21.263: ERROR/AndroidRuntime(808): at
12-08 12:02:21.263: ERROR/AndroidRuntime(808): at
12-08 12:02:21.263: ERROR/AndroidRuntime(808): at
12-08 12:02:21.263: ERROR/AndroidRuntime(808): at
12-08 12:02:21.263: ERROR/AndroidRuntime(808): at
12-08 12:02:21.263: ERROR/AndroidRuntime(808): at
12-08 12:02:21.263: ERROR/AndroidRuntime(808): at
12-08 12:02:21.263: ERROR/AndroidRuntime(808): at
12-08 12:02:21.263: ERROR/AndroidRuntime(808): at
12-08 12:02:21.263: ERROR/AndroidRuntime(808): at
java.lang.reflect.Method.invokeNative(Native Method)
12-08 12:02:21.263: ERROR/AndroidRuntime

Back-porting from Android 2.0 to Android 1.5

by theSmith » Wed, 16 Dec 2009 14:20:14 GMT


My mistake, since I started developing when 1.6 was released I thought
the search manager was the new QSB from 1.6


My app is crashing too because of the QSR terms in the searchable.xml
The problem then becomes how can you access them from 1.6+ without
them being seen in 1.5?

On Dec 8, 2:13pm, AJ <> wrote:


Other Threads

1. aaptexec doesn't support the "apkbasename" attribute

Hi all,
I am trying to build a 2.3.1 project with ANT and getting this error.
Does anyone know what is causing this? I have synced all packages in
AVD Manager as well.



2. Using google-api-java client


I don't know how you are getting those vm errors, but I would guess
you are doing something very wrong.  Getting Android and OAuth playing
nicely is not what I would think of as a good beginner exercise.

If you really want to go that route I would start off with an example
a little closer to what you want to achieve.  Study this Android
example that uses OAuth to access Picasa for example:


3. Issue with AppWidget Reinstall and Services

4. View Animation

5. How to get the best double buffering?

6. How to receive WAP push programatically

7. Stagefright or OpenCORE for Gingerbread ?