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 465825
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T23:25:00+00:00 2026-05-12T23:25:00+00:00

In my previous question I asked if System.currentTimeMillis() was buggy in Droid, and the

  • 0

In my previous question I asked if System.currentTimeMillis() was buggy in Droid, and the answer was no.

I assume the problem I’m having is somewhere else. While I wait for my Droid lone-user to report if a test app works on his phone, I would like to post some relevant code here.

Please keep in mind that I removed everything in the code I thought would be irrelevant (posting the code leading to the first suspicious line in the log). I might have removed the code where the problem is, but I doubt it. It smells like a layout, not code, problem. I say this because (see last line, where the log is) the surface is 0.

Best regards, Ari.

MANIFEST

<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
<application android:icon="@drawable/icon" android:label="@string/app_name">
    <activity android:name=".BeMeBB" android:label="@string/app_name"
        android:screenOrientation="landscape">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity android:name="BeMeBBPref" android:label="@string/app_name">
    </activity>
</application>
<uses-sdk android:minSdkVersion="3" android:targetSdkVersion="5" />
<supports-screens>
</supports-screens>

LAYOUT

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:paddingTop="0pt" android:orientation="vertical"
    android:layout_width="fill_parent" android:layout_height="fill_parent"
    android:gravity="bottom" android:background="#00000001">

    <android.view.SurfaceView android:id="@+id/preview_LAND"
        android:layout_width="fill_parent" android:layout_height="fill_parent"
        android:keepScreenOn="true" android:layout_margin="0pt">
    </android.view.SurfaceView>

    <LinearLayout android:orientation="vertical"
        android:layout_width="fill_parent" android:layout_height="fill_parent"
        android:layout_weight="1">

        <TextView android:id="@+id/ACCELERATION_LINE" android:text="0  2  4  6  8  10 12 14 16 18 20  "
            android:layout_width="wrap_content" android:layout_height="wrap_content"
            android:typeface="monospace" android:layout_weight="0"
            android:textSize="20dp" android:textStyle="bold" android:textColor="@color/white"
            android:layout_gravity="center_horizontal" android:paddingTop="0dp"
            android:paddingLeft="0dp" android:background="#66000000" />

        <TextView android:id="@+id/ACCELERATION" android:text="@string/Accelerometers"
            android:layout_width="wrap_content" android:layout_height="wrap_content"
            android:typeface="monospace" android:textStyle="bold"
            android:layout_weight="0" android:textSize="20dp" android:textColor="@color/white"
            android:layout_gravity="center_horizontal|top" android:paddingLeft="0dp"
            android:background="#66000000" />

        <LinearLayout android:orientation="horizontal"
            android:layout_width="fill_parent" android:layout_height="wrap_content"
            android:gravity="bottom" android:layout_weight="1">

            <Button android:id="@+id/SAVE_LAND" android:text="@string/Save"
                android:layout_width="wrap_content" android:gravity="left|bottom"
                android:layout_height="wrap_content" android:layout_weight="0"
                android:textSize="26dp" android:textColor="@color/black"
                android:padding="20dp" />
        </LinearLayout>
    </LinearLayout>
</RelativeLayout>

CODE

public class BeMeBB extends Activity implements OnClickListener, android.content.DialogInterface.OnClickListener, SensorEventListener {
    private SurfaceView preview=null;
    private SurfaceHolder previewHolder=null;

    SurfaceHolder.Callback surfaceCallback = new SurfaceHolder.Callback() {
        public void surfaceCreated(SurfaceHolder holder) {
            DoRecording();      
        }   
    }; // End SurfaceHolder.Callback surfaceCallback

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.main_land);
        preview=(SurfaceView)findViewById(R.id.preview_LAND);
        previewHolder=preview.getHolder();
        previewHolder.addCallback(surfaceCallback);
        previewHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
    } // End OnCreate

    private void DoRecording() {
        m_worker.setSurfaceHolder(previewHolder);
    } // End DoRecording
} // End class

IN ANOTHER CLASS

public void setSurfaceHolder(SurfaceHolder previewHolder) { 
    m_previewHolder = previewHolder;
    m_surface = m_previewHolder.getSurface();   
    Log.d("BeMeBB", "BeMeBBWorker m_surface="  + m_surface);
} //End  setSurfaceHolder

AND THE RESULT IN LOG (SURFACE IS NOT VALID):

11-19 17:58:13.171 D/BeMeBB  ( 1404): BeMeBBService m_surface=Surface(native-token=0)
  • 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-12T23:25:01+00:00Added an answer on May 12, 2026 at 11:25 pm

    Now it’s confirmed, my lone Droid user sent back the 2 log files from:

    1. A test app using MediaRecorder.setPreviewDisplay (Surface sv). It REQUIRES use of getSurface, which crashes in API 5 on Droid phone.

    2. A test app using Camera.setPreviewDisplay(SurfaceHolder sh). It REQUIRES use of MediaRecorder.setCamera for preview, but setCamera is apparently broken “Known limitation – locked camera” in API 3.

    So: I Cannot have a previewed media recorder that works on 1.5 and 2.0. So my only option is, (confirmed MediaRecorder.setCamera is not broken in Android2.0 – they added an unlock) is to have two separate versions , one for API 3 and one for API 5.

    Thank you commonsware for pointing me in the right direction. I will change the status to “answered” once I try again with deviceanywhere, just to be safe.

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

Sidebar

Related Questions

In a previous question I asked, the suggested answer was for me to partition
From the previous question I asked, I am still having the same question. I
Again problem with understanding Java. When I asked previous question about Hello world in
Well in a previous question I asked the same thing, but the answer that
This is a separate problem lingering from a previous question I asked here on
I have a bit of a problem here. Based on my previous question asked
In my previous question I asked about the problem with encoding and open pragma
this is a follow up to a previous question i asked. i am having
So in a previous question I asked about implementing a generic interface with a
In a previous question I asked about how to group XML elements logically, and

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.