camera costume image overlay in android -


i trying overlay live camera view costume image , i've saw this.but quite frankly new in android developing so. please me. here java code:

package com.beginner.cameraimage;  import java.io.ioexception;  import android.app.activity; import android.graphics.pixelformat; import android.hardware.camera; import android.os.bundle; import android.view.layoutinflater; import android.view.menu; import android.view.menuitem; import android.view.surfaceholder; import android.view.surfaceview;   public abstract class mainactivity extends activity implements surfaceholder.callback {     camera camera;     surfaceview surfaceview;     surfaceholder surfaceholder;     boolean previewing = false;     layoutinflater controlinflater = null;      @override     protected void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.activity_main);         getwindow().setformat(pixelformat.unknown);         surfaceview=(surfaceview)findviewbyid(r.id.camerapreview);         surfaceholder = surfaceview.getholder();         surfaceholder.addcallback(this);          //i don't know part         /*controlinflater = layoutinflater.from(getbasecontext());         view viewcontrol = controlinflater.inflate(r.layout.control, null);         @suppresswarnings("deprecation")         layoutparams layoutparamscontrol = new layoutparams(layoutparams.fill_parent,         layoutparams.fill_parent);         this.addcontentview(viewcontrol, layoutparamscontrol);*/     }     public void surfacechanged(surfaceholder holder, int format,                                 int width, int height) {         if(previewing) {              camera.stoppreview();              previewing = false;         }         if(camera != null) {             try {                 camera.setpreviewdisplay(surfaceholder);                 camera.startpreview();                 previewing = true;             } catch (ioexception e) {                 e.printstacktrace();             }         }     }     public void surfacecreated(surfaceholder holder) {         camera = camera.open();     }     public void surfacedestroyed(surfaceholder holder) {         camera.stoppreview();         camera.release();         camera = null;         previewing = false;     }      @override     public boolean oncreateoptionsmenu(menu menu) {         // inflate menu; adds items action bar if present.         getmenuinflater().inflate(r.menu.main, menu);         return true;     }      @override     public boolean onoptionsitemselected(menuitem item) {         // handle action bar item clicks here. action bar         // automatically handle clicks on home/up button, long         // specify parent activity in androidmanifest.xml.         int id = item.getitemid();         if (id == r.id.action_settings) {             return true;         }         return super.onoptionsitemselected(item);     }    } 

but crashes , says project stopped unfortunately , think there xml code in manifest.xml didn't entered or there library don't have.

thanks


Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

qt - How to embed QML toolbar and menubar into QMainWindow -