Since 6 months ago we have evaluated the possibility to implement a new AR interface (based in our project ARviewer) using phoneGap. phoneGap is a mobile framework based in HTML5/JS that allow execute the same source code HTML5 in differents mobile platforms (iphone, android, blackberry). It seem a good way to create portable source code. Since 3 years ago I work in this project with Raúl Román, a crack coder!!

Currently using phoneGap is not possible obtain the stream camera in the webView widget. So, this part of the source code must be developed in the native platform. We find another problem. We could not put the webview transparent so it would look the camera in the background, and paint objects on top with HTML. In this case, we asked for this to David A. Lareo (Bcultura) and Julio Rabadán (Somms.net) and gave us some very interesting clues about this problem.

The solution is implemented in the source code that you can see below. It’s necessary that our main view (R.layout.main) is the main view, for this we do ‘setContentView’ and later we add the main view of ‘DroidGap’ using ‘addview’ and ‘getParent’. Once we have our view mixed with phonegap main view, we set the backgroundColor transparent.

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        super.init();
        super.loadUrl("file:///android_asset/www/index.html");

        setContentView(R.layout.main);
        RelativeLayout view = (RelativeLayout)
                              findViewById(R.id.main_container);

        // appView is the WebView object
        View html = (View)appView.getParent();
        html.setBackgroundColor(Color.TRANSPARENT);
        view.addView (html,
                      new LayoutParams(LayoutParams.FILL_PARENT,
                      LayoutParams.FILL_PARENT));

        appView.setBackgroundColor(Color.TRANSPARENT);
    }

Currently, we have started this project so I will post the full source code in this blog

facebooktwittergoogle_pluslinkedinmailby feather

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Posts

android

Video Surveillance HD: Raspberrypi + PiCam + Android

The video-surveillance field is active many years ago, but there is only products that show image and little else. It’s need to add intelligence to surveillance tasks. We are committed to create technology to care for people and avoid dangerous situations. For this Read more…

android

Show your RTSP video in Android with VLC

If you have developed an Android app with video streaming, I’m sure you notice that Android use a pre-load of video buffer that fills in 10 seconds. This delay is hardcode in the source code. Read more…

android

Android SDK 64bit and Debian amd64

As you know, it’s possible download the Android SDK for 32 and 64 bits architecture.  If you choose 64bit architecture you notice that some binaries are compiled to 32bit architecture 1 2 3 vega:$/android/sdk/platform-tools$ file Read more…