Skip to main content

Featured

Android studio “SDK tools directory is missing”

Following 2 possible solutions will resolve this problem :  Solution1 : To fix the problem, it was required that I list the path to my corporate PAC file by using  Configure -> "Appearance and Behavior" -> System Settings -> HTTP Proxy . I selected "Automatic proxy configuration url:" Delete your  ~/.Android*  folders (losing all of your settings :/). Run Android Studio. It will show you a welcome wizard where it tries to download the SDK again (and fails due to my rubbish internet). Click the X on the wizard window. That will enable you to get to the normal welcome dialog. Go to Settings->Project Defaults->Project Structure and change the Android SDK location to the correct one. Solution 2 : To fix the problem, it was required that I list the path to my corporate PAC file by using  Configure -> "Appearance and Behavior" -> System Settings -> HTTP Proxy . I selected "Automatic proxy configuration url:&quo

Code to check Camera exists or not in Android Device


PackageManager pm = this.getPackageManager();

        if (pm.hasSystemFeature(PackageManager.FEATURE_CAMERA)) {
            System.out.println("---------has camera------");
                    }else{
            System.out.println("---------has no camera------");
                    }


-------------------------------------------------------

//It would be safer to use the constant PackageManager.FEATURE_CAMERA_FRONT
        //but since it is not defined for Android 2.2, I substituted the literal value
        frontCam = pm.hasSystemFeature("android.hardware.camera.front");
        System.out.println("frontCam"+frontCam);
        rearCam = pm.hasSystemFeature(PackageManager.FEATURE_CAMERA);
        System.out.println("rearCam"+rearCam);
        if(frontCam || rearCam){
            camera.setVisibility(View.VISIBLE);
        }else{
            camera.setVisibility(View.GONE);
        }

Comments