android-camera

Android WebView Save State

谁说我不能喝 提交于 2019-12-20 03:55:22
问题 I have an app with a WebView. There is a page with Upload Photo button so I use the openFileChooser. Sometimes I have a problem when the camera is chosen. The activity restarts and the webview is back on the beginning. How I can save the state of the activity? Please give an example (I saw that a good example of this would be useful). 回答1: You can save the Webview in Android Cache : Use WebView Setting : webView.getSettings().setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK); This will help

Bitmap - Out of memory exception

纵饮孤独 提交于 2019-12-20 03:53:24
问题 When I try to get image from camera or gallery, I get error. Here is a part of logcat: 06-27 05:51:47.297: E/dalvikvm-heap(438): Out of memory on a 35295376-byte allocation. 06-27 05:51:47.312: E/dalvikvm(438): Out of memory: Heap Size=108067KB, Allocated=71442KB, Limit=131072KB 06-27 05:51:47.312: E/dalvikvm(438): Extra info: Footprint=108067KB, Allowed Footprint=108067KB, Trimmed=56296KB 06-27 05:51:47.312: E/PowerManagerService(438): Excessive delay when setting lcd brightness: mLcdLight

Camera2 API - Android

試著忘記壹切 提交于 2019-12-20 01:55:18
问题 I am trying to use new camera api provided by android as camera2. But CameraManager manager = (CameraManager) getActivity().getSystemService(Context.CAMERA_SERVICE); showing error. Does any one have worked on this api. Have been searching for results for could not find any thing yet. 回答1: Binod, That will only works if your platform support API level 21 - that is the one come after Android L release. For a detailed explanation of how camera 2 API works, you may want to take a look at this

Unable to use the flashlight in Galaxy Nexus

给你一囗甜甜゛ 提交于 2019-12-20 00:49:20
问题 I have to following code and I just want to open the flashlight in my Galaxy Nexus(4.0.2) and it failed to do so. public class welcome extends Activity { //MediaPlayer player; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.welcome); Camera cam = Camera.open(); Parameters p = cam.getParameters(); p.setFlashMode(Parameters.FLASH_MODE_TORCH); cam.setParameters(p); cam

com.android.camera.action.CROP alternative?

倖福魔咒の 提交于 2019-12-19 17:48:16
问题 It seems com.android.camera.action.CROP isn't reliable, since it's an internal API and is not available on every device. However, I find this library quite practical. It works great on my Galaxy Nexus. Should I really be thinking on implementing my own solution? Am I taking too much a risk by using com.android.camera.action.CROP ? Moreover, in some devices, it opens up google + crop photo which crashes later. Finally, are there any open libraries out there I could use that would accomplish

Samsung Galaxy S5 Camera Torch not working

孤街醉人 提交于 2019-12-19 11:08:46
问题 We have an app that works with all our supported Android phones "except Samsung Galaxy S5" . Our app uses the camera to take pictures at close range. We need torch mode ON the entire time we are focusing to take the picture. We check for supported parameters and set the values if supported. The params get set but the event either never gets fired or the camera is ignoring my settings. I tested using OpenCamera and their app is able to turn the torch on yet I cannot find the difference between

Using the camera in Background Android

江枫思渺然 提交于 2019-12-19 10:11:37
问题 I'm trying to get the picture into service from Camera. @Override public void onCreate() { super.onCreate(); //android.os.Debug.waitForDebugger(); myCamera=Camera.open(); SurfaceView dummy=new SurfaceView(getApplicationContext()); try { if(myCamera!=null) { myCamera.setPreviewDisplay(dummy.getHolder()); myCamera.setPreviewCallback(this); Log.i(TAG,"myCamera is not null"); } getFrames(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); Log.e(TAG,

Android: return button not work when camera mode is open

巧了我就是萌 提交于 2019-12-19 09:49:26
问题 in my application one photo button is there. when I click on that button application open in camera mode and after capturing photo it will return on the layout and show that capture photo on this layout.But when the application is in camera mode and that time when I press return button then application stop working and it show : The application "AppName" (XXX) has stopped unexpectedly [Force Close] on the LogCat it show following error : java.lang.RuntimeException: Failure delivering result

Android: Image taken by custom camera is too dark

久未见 提交于 2019-12-19 09:07:34
问题 In my app I must take photo with custom activity. I implement all functionality and can save my photos, but in some devices they are too dark. I have this code, but it doesn't help me Parameters params = mCamera.getParameters(); if (params.getSupportedWhiteBalance().contains( Parameters.WHITE_BALANCE_AUTO)) { params.setWhiteBalance(Parameters.WHITE_BALANCE_AUTO); Log.d(TAG, "white balance auto"); } if (params.getSupportedFlashModes().contains( Parameters.FLASH_MODE_AUTO)) { params

CameraSource .setAutoFocusEnabled(true) returns: Camera auto focus is not supported on this device although device supports auto focus

雨燕双飞 提交于 2019-12-19 04:13:22
问题 Below is my barcode scanner activity, everything works fine except for the setAutoFocusEnabled(true). It returns a message on runtime that says my device does not support auto focus although the Samsung Tab E T561 is an auto focus enabled device. import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.util.Log; import android.util.SparseArray; import android.view.SurfaceHolder; import android.view.SurfaceView; import android.view.View; import android.widget