Hi All!

Im developing a camera application however having the same error on
emulator or android 2.2 hardware, application force to shut down ..

Will be very appreciate for any kind help..

This is my Activity Class :

package com.AndroidAR;



import android.app.Activity;
import android.os.Bundle;
import android.widget.FrameLayout;

public class AndroidAR extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {

              super.onCreate(savedInstanceState);
              CustomCameraView cv = new CustomCameraView(
                 this.getApplicationContext());
              FrameLayout rl = new
FrameLayout(this.getApplicationContext());
              setContentView(rl);
              rl.addView(cv);

}}



And this is CustomCameraView  with Surfaceview

package com.AndroidAR;

import java.io.IOException;

import android.content.Context;
import android.graphics.PixelFormat;
import android.hardware.Camera;
import android.hardware.Camera.Parameters;
import android.view.SurfaceHolder;
import android.view.SurfaceView;


public class CustomCameraView extends SurfaceView
{
   Camera camera;
   SurfaceHolder previewHolder;
   public CustomCameraView(Context context)
   {
      super(context);
      previewHolder = this.getHolder();
      previewHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
      previewHolder.addCallback(surfaceHolderListener);
   }
    SurfaceHolder.Callback surfaceHolderListener = new
SurfaceHolder.Callback() {
          public void surfaceCreated(SurfaceHolder holder) {
                camera=Camera.open();
             try {
                camera.setPreviewDisplay(previewHolder);
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }}

       public void surfaceChanged(SurfaceHolder holder, int format,
int width,
             int height)
       {
          Parameters params = camera.getParameters();
          int w = 0;
          int h =0;
        params.setPreviewSize(w, h);
          params.setPictureFormat(PixelFormat.JPEG);
                  camera.setParameters(params);
                  camera.startPreview();
       }

       public void surfaceDestroyed(SurfaceHolder arg0)
       {
          camera.stopPreview();
          camera.release();
       }
     };}


Plus the manifest.xml:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android";
package="com.example.android"
      android:versionCode="8"
      android:versionName="2.2">
      <uses-permission android:name="android.permission.CAMERA"></uses-
permission>
     <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=".AndroidAR"
android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category
android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
 </manifest>



Error on debug is :

01-21 01:42:12.763: DEBUG/AndroidRuntime(1728): >>>>>>>>>>>>>>
AndroidRuntime START <<<<<<<<<<<<<<
01-21 01:42:12.763: DEBUG/AndroidRuntime(1728): CheckJNI is OFF
01-21 01:42:12.763: DEBUG/dalvikvm(1728): creating instr width table
01-21 01:42:12.793: DEBUG/AndroidRuntime(1728): --- registering native
functions ---
01-21 01:42:13.003: DEBUG/AndroidRuntime(1728): Shutting down VM
01-21 01:42:13.003: DEBUG/dalvikvm(1728): Debugger has detached;
object registry had 1 entries
01-21 01:42:13.013: INFO/AndroidRuntime(1728): NOTE: attach of thread
'Binder Thread #3' failed
01-21 01:42:13.163: DEBUG/AndroidRuntime(1737): >>>>>>>>>>>>>>
AndroidRuntime START <<<<<<<<<<<<<<
01-21 01:42:13.163: DEBUG/AndroidRuntime(1737): CheckJNI is OFF
01-21 01:42:13.163: DEBUG/dalvikvm(1737): creating instr width table
01-21 01:42:13.204: DEBUG/AndroidRuntime(1737): --- registering native
functions ---
01-21 01:42:13.423: INFO/ActivityManager(92): Starting activity:
Intent { act=android.intent.action.MAIN
cat=[android.intent.category.LAUNCHER] flg=0x10000000
cmp=android.photo/.AndroidPhoto }
01-21 01:42:13.423: DEBUG/SurfaceFlinger(92):
Layer::setBuffers(this=0x4b4318), pid=92, w=1, h=1
01-21 01:42:13.433: DEBUG/SurfaceFlinger(92):
Layer::setBuffers(this=0x4b4318), pid=92, w=1, h=1
01-21 01:42:13.443: DEBUG/SurfaceFlinger(92):
Layer::requestBuffer(this=0x4b4318), index=0, pid=92, w=480, h=800
success
01-21 01:42:13.443: DEBUG/AndroidRuntime(1737): Shutting down VM
01-21 01:42:13.453: DEBUG/dalvikvm(1737): Debugger has detached;
object registry had 1 entries
01-21 01:42:13.453: DEBUG/dalvikvm(1737): Compiler shutdown in
progress - discarding request
01-21 01:42:13.453: DEBUG/dalvikvm(1737): Compiler shutdown in
progress - discarding request
01-21 01:42:13.453: DEBUG/dalvikvm(1737): Compiler shutdown in
progress - discarding request
01-21 01:42:13.453: DEBUG/dalvikvm(1737): Compiler shutdown in
progress - discarding request
01-21 01:42:13.453: DEBUG/dalvikvm(1737): Compiler shutdown in
progress - discarding request
01-21 01:42:13.464: INFO/ActivityManager(92): Start proc android.photo
for activity android.photo/.AndroidPhoto: pid=1745 uid=10080
gids={1006, 1015}
01-21 01:42:13.473: INFO/AndroidRuntime(1737): NOTE: attach of thread
'Binder Thread #3' failed
01-21 01:42:13.523: DEBUG/dalvikvm(1745): Debugger has detached;
object registry had 1 entries
01-21 01:42:13.563: DEBUG/AndroidRuntime(1745): Shutting down VM
01-21 01:42:13.563: WARN/dalvikvm(1745): threadid=1: thread exiting
with uncaught exception (group=0x400259f8)
01-21 01:42:13.563: ERROR/AndroidRuntime(1745): FATAL EXCEPTION: main
01-21 01:42:13.563: ERROR/AndroidRuntime(1745):
java.lang.RuntimeException: Unable to instantiate activity
ComponentInfo{android.photo/android.photo.AndroidPhoto}:
java.lang.ClassNotFoundException: android.photo.AndroidPhoto in loader
dalvik.system.PathClassLoader[/data/app/android.photo-2.apk]
01-21 01:42:13.563: ERROR/AndroidRuntime(1745):     at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
2709)
01-21 01:42:13.563: ERROR/AndroidRuntime(1745):     at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:
2803)
01-21 01:42:13.563: ERROR/AndroidRuntime(1745):     at
android.app.ActivityThread.access$2300(ActivityThread.java:135)
01-21 01:42:13.563: ERROR/AndroidRuntime(1745):     at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:2136)
01-21 01:42:13.563: ERROR/AndroidRuntime(1745):     at
android.os.Handler.dispatchMessage(Handler.java:99)
01-21 01:42:13.563: ERROR/AndroidRuntime(1745):     at
android.os.Looper.loop(Looper.java:144)
01-21 01:42:13.563: ERROR/AndroidRuntime(1745):     at
android.app.ActivityThread.main(ActivityThread.java:4937)
01-21 01:42:13.563: ERROR/AndroidRuntime(1745):     at
java.lang.reflect.Method.invokeNative(Native Method)
01-21 01:42:13.563: ERROR/AndroidRuntime(1745):     at
java.lang.reflect.Method.invoke(Method.java:521)
01-21 01:42:13.563: ERROR/AndroidRuntime(1745):     at
com.android.internal.os.ZygoteInit
$MethodAndArgsCaller.run(ZygoteInit.java:868)
01-21 01:42:13.563: ERROR/AndroidRuntime(1745):     at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
01-21 01:42:13.563: ERROR/AndroidRuntime(1745):     at
dalvik.system.NativeStart.main(Native Method)
01-21 01:42:13.563: ERROR/AndroidRuntime(1745): Caused by:
java.lang.ClassNotFoundException: android.photo.AndroidPhoto in loader
dalvik.system.PathClassLoader[/data/app/android.photo-2.apk]
01-21 01:42:13.563: ERROR/AndroidRuntime(1745):     at
dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
01-21 01:42:13.563: ERROR/AndroidRuntime(1745):     at
java.lang.ClassLoader.loadClass(ClassLoader.java:573)
01-21 01:42:13.563: ERROR/AndroidRuntime(1745):     at
java.lang.ClassLoader.loadClass(ClassLoader.java:532)
01-21 01:42:13.563: ERROR/AndroidRuntime(1745):     at
android.app.Instrumentation.newActivity(Instrumentation.java:1036)
01-21 01:42:13.563: ERROR/AndroidRuntime(1745):     at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
2701)
01-21 01:42:13.563: ERROR/AndroidRuntime(1745):     ... 11 more
01-21 01:42:13.563: WARN/ActivityManager(92):   Force finishing
activity android.photo/.AndroidPhoto
01-21 01:42:13.593: DEBUG/SurfaceFlinger(92):
Layer::setBuffers(this=0x305ea8), pid=92, w=1, h=1
01-21 01:42:13.593: DEBUG/SurfaceFlinger(92):
Layer::setBuffers(this=0x305ea8), pid=92, w=1, h=1
01-21 01:42:13.633: DEBUG/SurfaceFlinger(92):
Layer::requestBuffer(this=0x305ea8), index=0, pid=92, w=480, h=386
success
01-21 01:42:14.073: WARN/ActivityManager(92): Activity pause timeout
for HistoryRecord{46665cd8 android.photo/.AndroidPhoto}
01-21 01:42:14.113: DEBUG/Gmail(323): MailProvider.query:
content://gmail-ls/conversations/[email protected](label:^i,
null)
01-21 01:42:14.134: DEBUG/SurfaceFlinger(92):
Layer::setBuffers(this=0x4757f8), pid=323, w=480, h=800
01-21 01:42:14.134: DEBUG/SurfaceFlinger(92):
Layer::setBuffers(this=0x4757f8), pid=323, w=480, h=800
01-21 01:42:14.134: WARN/Cursor(323): Close cursor
com.google.android.gm.provider.MailEngine$ConversationCursor@463dc408
on null twice or more
01-21 01:42:14.163: DEBUG/GoogleLoginService(223): onBind: Intent
{ act=android.accounts.AccountAuthenticator
cmp=com.google.android.gsf/.loginservice.GoogleLoginService }
01-21 01:42:14.203: DEBUG/SurfaceFlinger(92):
Layer::requestBuffer(this=0x4757f8), index=0, pid=323, w=480, h=800
success
01-21 01:42:14.233: DEBUG/Gmail(323): SETTING ACCOUNT,
USER:[email protected]
01-21 01:42:14.596: DEBUG/SurfaceFlinger(92):
Layer::requestBuffer(this=0x305ea8), index=1, pid=92, w=480, h=386
success
01-21 01:42:14.798: DEBUG/SurfaceFlinger(92):
Layer::requestBuffer(this=0x305ea8), index=0, pid=92, w=480, h=386
success
01-21 01:42:14.823: DEBUG/SurfaceFlinger(92):
Layer::requestBuffer(this=0x305ea8), index=1, pid=92, w=480, h=386
success
01-21 01:42:15.324: DEBUG/SurfaceFlinger(92):
Layer::requestBuffer(this=0x4757f8), index=1, pid=323, w=480, h=800
success
01-21 01:42:19.383: DEBUG/Gmail(323): Validating Notification: mapSize:
0 getAttention:false
01-21 01:42:19.383: DEBUG/Gmail(323):
clearNewUnreadMailForNotificationLabelIfNeeded. Count: 0, label: -5/
^^unseen-^i
01-21 01:42:19.383: DEBUG/Gmail(323):
clearNewUnreadMailForNotificationLabelIfNeeded. Count: 0, label: -6/
^^unseen-^^vmi
01-21 01:42:19.393: WARN/InputManagerService(92): Window already
focused, ignoring focus gain of:
com.android.internal.view.IInputMethodClient$Stub$Proxy@4643c8b0
01-21 01:42:19.403: INFO/Process(1745): Sending signal. PID: 1745 SIG:
9
01-21 01:42:19.403: INFO/ActivityManager(92): Process android.photo
(pid 1745) has died.
01-21 01:42:21.688: VERBOSE/AlarmManager(92): Alarm triggering:
Alarm{46677f20 type 2 android}
01-21 01:42:21.733: VERBOSE/AlarmManager(92): Adding Alarm{465e1740
type 2 android} Jan 01 03:25:43 pm
01-21 01:42:24.235: WARN/ActivityManager(92): Activity destroy timeout
for HistoryRecord{46665cd8 android.photo/.AndroidPhoto}
01-21 01:42:33.364: VERBOSE/AlarmManager(92): Alarm triggering:
Alarm{468f9bd0 type 2 com.google.android.location}
01-21 01:42:33.384: DEBUG/WifiService(92): acquireWifiLockLocked:
WifiLock{NetworkLocationProvider type=2
binder=android.os.Binder@46521668}
01-21 01:42:33.393: DEBUG/WifiService(92): enable and start wifi due
to updateWifiState
01-21 01:42:33.434: VERBOSE/AlarmManager(92): Adding Alarm{467024e0
type 2 com.google.android.location} Jan 01 04:18:35 am
01-21 01:42:34.384: INFO/wpa_supplicant(918): CTRL-EVENT-SCAN-RESULTS
Ready
01-21 01:42:34.384: DEBUG/LocationMasfClient(92):
getNetworkLocation(): Returning cache location with accuracy 1610.0
01-21 01:42:38.395: VERBOSE/AlarmManager(92): Alarm triggering:
Alarm{467024e0 type 2 com.google.android.location}
01-21 01:42:38.414: VERBOSE/AlarmManager(92): Adding Alarm{467dfb08
type 2 com.google.android.location} Jan 01 04:19:30 am
01-21 01:42:38.414: DEBUG/WifiService(92): releaseWifiLockLocked:
WifiLock{NetworkLocationProvider type=2
binder=android.os.Binder@46521668}
01-21 01:42:38.414: DEBUG/WifiService(92): enable and start wifi due
to updateWifiState
01-21 01:42:43.483: DEBUG/dalvikvm(986): GC_EXPLICIT freed 3546
objects / 323400 bytes in 73ms


thanks

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to