Android开发原理(今天看到的)

980阅读 0评论2011-02-01 0xC1988
分类:

在Android 在NDK r5使用C/C++进行开发。(以前,Android 对C/C++开发的支持仅限于用C/C++开发动态链接库,然后在Java中以JNI的形式来调用)现在,你可以用纯C/C++开发了(参看下面的程序代码)。还有一段完整的代码示例在这里(墙,还有XML的manifest,又见XML)。看来,Google终于明白为什么使用Android的手机(如:Moto, 三星、索爱和HTC)的触摸体验远远不及object C搞出来的iPhone。 

void android_main(struct android_app* state) {

    // Make sure glue isn't stripped.

    app_dummy();

    // loop waiting for stuff to do.

    while (1) {

        // Read all pending events.

        int ident;

        int events;

        struct android_poll_source* source;

       // Read events and draw a frame of animation.

        if ((ident = ALooper_pollAll(0, NULL, &events,

                (void**)&source)) >= 0) {

            // Process this event.

            if (source != NULL) {

                source->process(state, source);

            }

        }

        // draw a frame of animation

        bringTheAwesome();

    }

}

 

上一篇:没有了
下一篇:Android架构详解 不错,推荐下