Android:启动相机应用程序现在崩溃应用程序

时间:2012-10-19 15:04:56

标签: java android camera

工作正常,我不太确定我改变了什么让它停止工作。当我加载相机它工作正常,它返回到它失败的页面。我已经尝试删除照片返回部分发生的事情,看看是否会让它翻倒,但它确实无法正常工作。

这是我的错误:

10-19 16:01:43.455: W/IInputConnectionWrapper(5309): getSelectedText on inactive InputConnection
10-19 16:01:43.455: E/Asset Sub Group(5309): 1
10-19 16:01:43.480: W/IInputConnectionWrapper(5309): setComposingText on inactive InputConnection
10-19 16:01:43.480: W/IInputConnectionWrapper(5309): finishComposingText on inactive InputConnection
10-19 16:01:47.045: W/IInputConnectionWrapper(5309): getSelectedText on inactive InputConnection
10-19 16:01:47.055: W/IInputConnectionWrapper(5309): getTextBeforeCursor on inactive InputConnection
10-19 16:01:47.055: W/IInputConnectionWrapper(5309): getTextAfterCursor on inactive InputConnection
10-19 16:01:47.300: W/IInputConnectionWrapper(5309): showStatusIcon on inactive InputConnection
10-19 16:01:52.315: W/dalvikvm(5309): threadid=1: thread exiting with uncaught exception (group=0x40c721f8)
10-19 16:01:52.320: E/AndroidRuntime(5309): FATAL EXCEPTION: main
10-19 16:01:52.320: E/AndroidRuntime(5309): android.app.SuperNotCalledException: Activity {com.directenquiries.assessment.tool/com.directenquiries.assessment.tool.AddAsset} did not call through to super.onStop()
10-19 16:01:52.320: E/AndroidRuntime(5309):     at android.app.Activity.performStop(Activity.java:4673)
10-19 16:01:52.320: E/AndroidRuntime(5309):     at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:3088)
10-19 16:01:52.320: E/AndroidRuntime(5309):     at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:3147)
10-19 16:01:52.320: E/AndroidRuntime(5309):     at android.app.ActivityThread.access$1200(ActivityThread.java:128)
10-19 16:01:52.320: E/AndroidRuntime(5309):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1194)
10-19 16:01:52.320: E/AndroidRuntime(5309):     at android.os.Handler.dispatchMessage(Handler.java:99)
10-19 16:01:52.320: E/AndroidRuntime(5309):     at android.os.Looper.loop(Looper.java:137)
10-19 16:01:52.320: E/AndroidRuntime(5309):     at android.app.ActivityThread.main(ActivityThread.java:4517)
10-19 16:01:52.320: E/AndroidRuntime(5309):     at java.lang.reflect.Method.invokeNative(Native Method)
10-19 16:01:52.320: E/AndroidRuntime(5309):     at java.lang.reflect.Method.invoke(Method.java:511)
10-19 16:01:52.320: E/AndroidRuntime(5309):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:993)
10-19 16:01:52.320: E/AndroidRuntime(5309):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:760)
10-19 16:01:52.320: E/AndroidRuntime(5309):     at dalvik.system.NativeStart.main(Native Method)

继承我的代码:

public void startCamera() 
    {
        File photo = null;
        Intent intent = new Intent("android.media.action.IMAGE_CAPTURE");
        timestamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());

        if (android.os.Environment.getExternalStorageState().equals(android.os.Environment.MEDIA_MOUNTED)) 
               {
                   photo = new File(Global.Pictures + timestamp +".png");

               } 
        else 
               {
                   photo = new File(getCacheDir(), FOLDER_NAME+File.separator+timestamp+".png");
               }    
        if (photo != null) 
               {
                   intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(photo));
                   selectedImageUri = Uri.fromFile(photo);
                   startActivityForResult(intent, CAPTURE_IMAGE_CALLBACK);
               }

    }

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    // TODO Auto-generated method stub
    super.onActivityResult(requestCode, resultCode, data);
    if (requestCode == 1){

    if(resultCode == RESULT_OK) {

      String PhotoDescription = DBFunctions.GetObjectName(StationObjectID);
      String PhotoDate = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date()); 

 }

    if(resultCode == RESULT_CANCELED) {

       Context context = getApplicationContext();
        CharSequence text = "Photo Capture Cancelled";
        int duration = Toast.LENGTH_SHORT;

        Toast toast = Toast.makeText(context, text, duration);
        toast.show();

    }

任何帮助将不胜感激

汤姆

2 个答案:

答案 0 :(得分:1)

例外是SuperNotCalledException

您错过了super.onStop()来电。

  

活动{com.directenquiries.assessment.tool / com.directenquiries.assessment.tool.AddAsset}未调用super.onStop()

答案 1 :(得分:1)

在例外情况中:android.app.SuperNotCalledException: Activity {com.directenquiries.assessment.tool/com.directenquiries.assessment.tool.AddAsset} did not call through to super.onStop()

你有一个onStop()方法吗?在那里你必须调用super.onStop()。