Google Android Log is a weblog featuring stories, links and articles related to Google's Android Project, the open source mobile phone platform based on the Linux operating system and developed by the Open Handset Alliance.

Updated daily.

Google Android - The Android Log

Our Sponsors

July 2008
M T W T F S S
« Jun    
 123456
78910111213
14151617181920
21222324252627
28293031  

Product Reviews

We offer unbiased, honest and upfront reviews for your products. You will also gain major exposure to the Google Android development community as well as the general mobile phone development community. For more information on where to send your products for review, email us at reviews@theandroidlog.com

Email Subscriptions

Enter your email address:

Delivered by FeedBurner

Google Android - The Android Log

Graphical Native C Programs on Android

November 14th, 2007 by Head Robot

Qtopia, Maemo or OpenMoko run on Android?

Update: Keep in mind that this is totally against the reason for Android’s existence as a cross-vendor development environment.

gaz was one of many to respond to the thread on writing C/C++ Android Apps

“You know guys that doing this will prevent your application in being an Android application, yes?

If you tie up your app to a certain CPU, it mean that XYZ manufacturer producing an Android device with a MIPS CPU (or whatever other CPU) will not be able to run your app.

If you want to be really Android (and not Android/ARM) compatible, you better stick with Java and let the JIT to do its own job.”

TomCooksey wrote in the Android Developer’s Google Group today;

I’ve just realized there’s a standard Linux framebuffer device: /dev/
graphics/fb0. You can write to it in the usual way. This means that
phones supporting the Android platform may be able to run other GUI
phone stacks such as Qtopia, Maemo or OpenMoko - Should anyone feel
the need! :-)

Here’s a quick program to demonstrate this by flashing the screen
every second (I know, ultra-high tech stuff this!). If you want to try
it out, you’ll need to get yourself a cross compiler, compile the
following program, copy it to the android emulator & run it (Search
this group for instructions). For some reason it can take a while
before the screen starts flashing… dunno why. :-p

Note: This is _not_ using the Android surface manager - that’s going
to take a lot more work (my hat goes off to the first person to do
it!)

———————————————————-

#include <stdio.h>
#include <sys/mman.h>
#include <unistd.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
#define PIXEL_COUNT (320*240)
unsigned short* fb = NULL;
int main(int argc, char** argv)
{
   int fb_fd;
   do {
      fb_fd = open("/dev/graphics/fb0", O_RDWR);
      if (fb_fd == -1)
      {
         printf("Error opening framebuffer: %s\n", strerror(errno));
         break;
      }
      fb = (unsigned short*) mmap(0, PIXEL_COUNT*sizeof(unsigned
short), PROT_WRITE, MAP_SHARED, fb_fd, 0);
      if (fb == MAP_FAILED)
      {
         printf("Error mmap'ing the framebuffer: %s\n",
strerror(errno));
         break;
      }
      do {
         memset(fb, 0, PIXEL_COUNT*sizeof(unsigned short));
         sleep(1);
         memset(fb, 0xFF, PIXEL_COUNT*sizeof(unsigned short));
         sleep(1);
      } while (1);
   } while (0);
   return 0;
}

Technorati Tags: , , , , , , , ,