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

  • SEARCH
  • Home
  • 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 6184681
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T01:34:41+00:00 2026-05-24T01:34:41+00:00

Phone: HTC Incredible 2 with Gingerbread 2.3.3 In my code, I am doing: cam

  • 0

Phone: HTC Incredible 2 with Gingerbread 2.3.3

In my code, I am doing:

cam = Camera.open(0);
SurfaceHolder surfaceHolder = getSurfaceHolder();
try
{
    cam.setPreviewDisplay(surfaceHolder);
    cam.startPreview();
}
catch (IOException e)
{
    e.printStackTrace();
}

In the constructor of an Engine

I also have:

@Override
public void onDestroy()
{
    super.onDestroy();
    if (cam != null)
    {
        cam.stopPreview();
        cam.setPreviewCallback(null);
        cam.release();
        cam = null;
    }
}

and

@Override
public void onSurfaceDestroyed(SurfaceHolder holder)
{
    super.onSurfaceDestroyed(holder);
    if (cam != null)
    {
        cam.stopPreview();
        cam.setPreviewCallback(null);
        cam.release();
        cam = null;
    }
}

My manifest:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.android.google.apis" android:versionCode="1"
    android:versionName="1.0">

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

    <uses-feature android:name="android.software.live_wallpaper" />

    <application android:icon="@drawable/icon" android:label="@string/app_name">
        <service android:label="@string/label"
            android:name="com.me.app.main.AppName"
            android:permission="android.permission.BIND_WALLPAPER">
            <intent-filter>
                <action android:name="android.service.wallpaper.WallpaperService" />
            </intent-filter>
            <meta-data android:name="android.service.wallpaper"
                android:resource="@xml/app" />
        </service>
        <activity
            android:name="com.me.app.main.AppName"
            android:label="@string/app_name">
            android:exported="true">
        </activity>

    </application>
</manifest>
  • 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-05-24T01:34:42+00:00Added an answer on May 24, 2026 at 1:34 am

    I figured it out. Turns out the Camera.open() call has to be made in the Activity, not in the Engine.

    Still not sure why this is the case. I would appreciate if someone can explain this phenomenon to me.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If I run the following code on my HTC magic phone I get a
I recently try twitter app on Android-based phone ( HTC HD Desire , I
On just one phone I am testing on (HTC Incredible, Android 2.2, Software 3.21.605.1),
My android app was launching fine to both my HTC phone and my Android
Tomorrow I am buying an HTC magic phone on the Rogers network. Since it
I want to know the branch of the phone,such as Samsung,htc,moto,iphone,etc I just want
i have HTC hero phone with operating system 1.5 i want to upgrade it
I'm testing a program on an HTC desire phone. There's a special button on
when the user have to set the alarm time on his phone (HTC for
On my HTC phone the RemoteView for notifications looks like the image below... I'd

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.