Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8666193
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T17:40:03+00:00 2026-06-12T17:40:03+00:00

I am working on android camera app,I want green screen chroma key effect to

  • 0

I am working on android camera app,I want green screen chroma key effect to captured image. I have used http://code.google.com/p/chroma-key-project/downloads/list this chroma key project with my code.

I am using tablet which having front camera instead of back camera..I have also used permission for front camera

 <uses-permission android:name="android.permission.CAMERA" />

    <uses-feature android:name="android.hardware.camera" />
    <uses-feature android:name="android.hardware.camera.front" />

still it shows an error null pointer exception from preview.java page to this line . camera.setPreviewDisplay(holder); // <9> why?

Check the preview.java page from the given link in chroma key project.please suggest.

this type of error I am getting.

10-11 15:37:36.131: W/dalvikvm(11339): threadid=1: thread exiting with uncaught exception (group=0x409ee1f8)
10-11 15:37:36.141: E/AndroidRuntime(11339): FATAL EXCEPTION: main
10-11 15:37:36.141: E/AndroidRuntime(11339): java.lang.UnsupportedOperationException
10-11 15:37:36.141: E/AndroidRuntime(11339): at java.lang.Thread.stop(Thread.java:1076)
10-11 15:37:36.141: E/AndroidRuntime(11339): at java.lang.Thread.stop(Thread.java:1063)
10-11 15:37:36.141: E/AndroidRuntime(11339): at com.Activity.new2you4kids.MainClass.startCamera(MainClass.java:179)
10-11 15:37:36.141: E/AndroidRuntime(11339): at com.Activity.new2you4kids.MainClass$1.handleMessage(MainClass.java:61)
10-11 15:37:36.141: E/AndroidRuntime(11339): at android.os.Handler.dispatchMessage(Handler.java:99)
10-11 15:37:36.141: E/AndroidRuntime(11339): at android.os.Looper.loop(Looper.java:137)
10-11 15:37:36.141: E/AndroidRuntime(11339): at android.app.ActivityThread.main(ActivityThread.java:4424)
10-11 15:37:36.141: E/AndroidRuntime(11339): at java.lang.reflect.Method.invokeNative(Native Method)
10-11 15:37:36.141: E/AndroidRuntime(11339): at java.lang.reflect.Method.invoke(Method.java:511)
10-11 15:37:36.141: E/AndroidRuntime(11339): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
10-11 15:37:36.141: E/AndroidRuntime(11339): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
10-11 15:37:36.141: E/AndroidRuntime(11339): at dalvik.system.NativeStart.main(Native Method)

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T17:40:04+00:00Added an answer on June 12, 2026 at 5:40 pm

    Camera.open() tries to open the default back camera i think, so it returns null because there is no camera on the back.

    what if you try the function Camera.open(int) to open the front camera?

    Like this:

    int getFrontCameraId() {
        CameraInfo ci = new CameraInfo();
        for (int i = 0 ; i < Camera.getNumberOfCameras(); i++) {
            Camera.getCameraInfo(i, ci);
            if (ci.facing == CameraInfo.CAMERA_FACING_FRONT) return i;
        }
        return -1; // No front-facing camera found
    }
    

    And get it like this:

    int index = getFrontCameraId();
    if (index == -1) error();
    Camera c = Camera.open(index);
    

    From: How to detect if there is front camera and if there is how to reach and use front camera?

    Edit: the code you are using is very old and has all kinds of old functions, the crash you are having is caused by an old thread function (stop) i think.

    Code from the link:

      public void startCamera() {
            setContentView(R.layout.camview);
            fGameView = null;
            fGameThread.stop();
            fGameThread=null;
    

    according to the developers site:

    stop()
    This method is deprecated. because stopping a thread in this manner is unsafe and can leave your application and the VM in an unpredictable state.

    See:

    java.lang.UnsupportedOperationException when my splash screen starts

    http://developer.android.com/reference/java/lang/Thread.html#stop()

    Edit two:

    Change the onCreateOptionsMenu code to this, you should not use the myMenu variable.

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        super.onCreateOptionsMenu(menu);
        menu.add(0, MENU_START, 0, R.string.menu_start);
        menu.add(0, MENU_SEND, 0, R.string.menu_send);
        return true;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on android camera app,I want green screen chroma key effect to
I am working on an android app. i want to enable camera in it.
I'm working on a little Android app to stream some camera footage (as a
I am currently working on android project where I want to have a text
I am new in android and working on the camera application. In this app
I have been working on an app which includes using the devices camera. After
I have a simple app I coded for android that I want to go
I'm new in android and working on an app that captures photo by camera
I am working on an Android app that I want to run on all
I am working on an Android app that uses the phone's camera and I'm

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.