ActivityNotFoundException, image capturing?

前端 未结 2 974
我寻月下人不归
我寻月下人不归 2021-01-16 22:00

I have released an App which user can take photo in it.I do this to capturing photo:

File file = new File( _path );
Uri outputFileUri = Uri.fromFile( file );         


        
2条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-16 22:33

    Check if your

    1.Tablet has camera (if your using tablet). 2. A phone has camera 3. No SD card installed.

    Add the below to manifest.

       
    

    Will prevent apps being downloaded from google play. http://developer.android.com/google/play/filters.html

    Also Check http://developer.android.com/guide/topics/manifest/uses-feature-element.html

    To check if your device has camera.

    public class MainActivity extends Activity {
    
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        //setContentView(R.layout.main);
    
        Context context = this;
        PackageManager packageManager = context.getPackageManager();
    
        // if device support camera?
        if (packageManager.hasSystemFeature(PackageManager.FEATURE_CAMERA)) {
            //yes
            Log.i("camera", "This device has camera!");
        }else{
            //no
            Log.i("camera", "This device has no camera!");
        }
    
    
    }
    }
    

提交回复
热议问题