views:

119

answers:

0

Hi All,

Without using Wikitude, I'm trying to find out how to overlay POIs over Camera. I have seen a few code samples that overlays POIs over MapView. How to do the same for Camera?

Any clue/example code would be very much appreciated.


To achieve my goal, can I add MapView on top of Camera Preview? If so how is it done? My MapView and Camera PreView can been seen when they run separately.

If I try to add MapView on top Camera Preview I can see only the later.

Here is my code:


public void onCreate(Bundle savedInstanceState) {  

    super.onCreate(savedInstanceState);  
    cv = new CustomCameraView( this.getApplicationContext());  
    setContentView(R.layout.main);  
    LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT,
                                    LinearLayout.LayoutParams.WRAP_CONTENT);  
    RelativeLayout lx = (RelativeLayout)findViewById(R.id.mainlayout);  
    lx.addView(cv, layoutParams);  
    mapView = (MapView) findViewById(R.id.mapview);  

    mapOverlays = mapView.getOverlays();  
    drawable1 = this.getResources().getDrawable(R.drawable.greensignal);  
    itemizedOverlay = new MyItemizedOverlay(drawable1);  
    GeoPoint point1 = new GeoPoint(37558203,-122288367);  
    OverlayItem overlayitem1 = new OverlayItem(point1, "", "");  
    itemizedOverlay.addOverlay(overlayitem1);  
    mapOverlays.add(itemizedOverlay);  

}

And my layout file main.xml:

<?xml version="1.0" encoding="utf-8"?>  

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"  
android:id="@+id/mainlayout"  
android:orientation="vertical"  
android:background = "#00000001"  
android:layout_width="fill_parent"  
android:layout_height="fill_parent" >  

<com.google.android.maps.MapView
    android:id="@+id/mapview"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:clickable="true"
    android:apiKey="My Own API Key etc."
/>
    <TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello"
/>
</RelativeLayout>

Thanking you all in advance.

-raich.