Hi everyone,

i create my own class which extends camera class
(android.hardware.camera).
i want to check if application can use my own class instead of
android.hardware.camera when i run ApiDemos.
i write one function to be override and a new function in my own
class. Those codes i modify are:

A.the MyCamera.java in android\frameworks\base\core\java\android
\hardware :

>>>>>>>>

package android.hardware;
import android.hardware.Camera;


public class MyCamera extends Camera{
   int test1;
   int test2;

    public MyCamera(){
     test1 = 0;
    }

    // Override the function in android.hardware.Camera //
    public int getJpegQuality() {
           test1 = 8;
           return test1;
        }


    public int mytest() {
     test2 = 9;
     return test2;
    }
}

>>>>>>>>

B. The CameraPreview.java in android_sdk\samples\android-8\ApiDemos\src
\com\example\android\apis\graphics:

>>>>>>>>

package com.example.android.apis.graphics;

import android.app.Activity;

import android.content.Context;
import android.hardware.Camera;
import android.hardware.Camera.Size;
import android.os.Bundle;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.Window;
import android.hardware.MyCamera;
import java.io.IOException;
import java.util.List;


public class CameraPreview extends Activity {
    private Preview mPreview;

    @Override
 protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        // Hide the window title.
        requestWindowFeature(Window.FEATURE_NO_TITLE);

        MyCamera mycamera = new MyCamera();
        int tmp1 = 0;
        int tmp2 = 0 ;
        tmp1  = mycamera.mytest();
        tmp2 = mycamera.getJpegQuality();

        // Create our Preview view and set it as the content of our
activity.
        mPreview = new Preview(this);
        setContentView(mPreview);
    }
    .....
    .....
>>>>>>>>

i also add MyCamera class infomation in android.jar(extract
MyCamera.java
from android\out\target\common\obj\JAVA_LIBRARIES
\android_stubs_current_intermediates\javalib.jar
and add it in android_sdk\platforms\android-8\android.jar)
and when i use eclipse to debug my code, i get
"ERROR/dalvikvm(266): Could not find class
'android.hardware.MyCamera',
referenced from method
com.example.android.apis.graphics.CameraPreview.onCreate"

Please give me any suggestion.

Thanks a lot.

Steven

-- 
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