Comments (18)
@dynamitechetan If we comment all the code above requestLayout() then we have to remove the line which is setting the parameters and if we remove that it is working fine. I don't understand one thing is that with the present code also the size.width gives a value of 1920 and with the above code also the cs.width returns same value of 1920. So why is it crashing with the present code.
from phimpme-android.
on my phone its working perfectly
Any logs?
from phimpme-android.
E/AndroidRuntime: FATAL EXCEPTION: main
Process: vn.mbm.phimp.me, PID: 12855
java.lang.RuntimeException: setParameters failed
at android.hardware.Camera.native_setParameters(Native Method)
at android.hardware.Camera.setParameters(Camera.java:2173)
at vn.mbm.phimp.me.Preview.switchCamera(Camera2.java:597)
at vn.mbm.phimp.me.Camera2$4.onClick(Camera2.java:221)
at android.view.View.performClick(View.java:5226)
at android.view.View$PerformClick.run(View.java:21350)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5582)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616
from phimpme-android.
@Abhi2424shek @pa1pal Can you please check if the app is crashing on camera switch in your device because for me its crashing but for @dynamitechetan its working perfectly. If the crash is there, I will start working on it.
from phimpme-android.
@anantprsd5 it's not crashing in mine. But if this in your case. So you can fix it.
from phimpme-android.
I am not too getting a crash! Can you check your apk version. @anantprsd5
from phimpme-android.
@Abhi2424shek I'm using version 1.5, the latest codes from the development branch. The problem is with my phone only I guess. I checked with another phones, It's working fine in them.
from phimpme-android.
@anantprsd5 It is not just your phone, I am facing the same problem with my phone too.
from phimpme-android.
@Narutuffy Yeah. I am working on it.
from phimpme-android.
I am using MUI, what all are you all using, who is your manufacturer @anantprsd5 @Narutuffy
from phimpme-android.
@Abhi2424shek I am using le2 with EUI.
from phimpme-android.
I'm using Moto G Gen1, near stock-android. Android version 5.1
from phimpme-android.
The problem is there when you try to switch the camera twice. Here's the log (same as @anantprsd5 's log). Will try to fix it.
03-04 23:39:28.128 13755-13755/vn.mbm.phimp.me E/AndroidRuntime: FATAL EXCEPTION: main
Process: vn.mbm.phimp.me, PID: 13755
java.lang.RuntimeException: setParameters failed
at android.hardware.Camera.native_setParameters(Native Method)
at android.hardware.Camera.setParameters(Camera.java:2015)
at vn.mbm.phimp.me.Preview.switchCamera(Camera2.java:597)
at vn.mbm.phimp.me.Camera2$4.onClick(Camera2.java:237)
at android.view.View.performClick(View.java:4785)
at android.view.View$PerformClick.run(View.java:19884)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5343)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:905)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:700)
from phimpme-android.
for (Camera.Size size : parameters.getSupportedPictureSizes()) {
if (1600 <= size.width & size.width <= 1920) {
parameters.setPreviewSize(size.width, size.height);
parameters.setPictureSize(size.width, size.height);
break;
}
}
Comment the above and replace it with code below. Then test the same issue.
List<Camera.Size> sizes = parameters.getSupportedPreviewSizes();
Camera.Size cs = sizes.get(0);
parameters.setPreviewSize(cs.width, cs.height);
parameters.setPictureSize(cs.width, cs.height);
from phimpme-android.
@dynamitechetan Yeah, its working fine with the above code.
from phimpme-android.
Can I send a PR?
from phimpme-android.
@dynamitechetan Sure. Thanks. :)
from phimpme-android.
okay.
from phimpme-android.
Related Issues (20)
- Update uCrop to 2.x HOT 4
- Error Showing when we go for gradle project sync in the android studio aap dependicy HOT 2
- Problem in scrolling accounts/elements in "Accounts" tab in small screen mobile phones HOT 5
- Account Activity's RecyclerView.OnItemTouchListener not working HOT 3
- Error while building the project: Grade Sync Failed HOT 3
- Request: Option to disable splash screen HOT 7
- Crash HOT 7
- Error while building the project: Evaluating the project
- Not work on poco f1 HOT 3
- Share image to other platforms feature not working HOT 1
- Theme is not Working HOT 1
- There is no Filter Option HOT 1
- Failed to Build Project HOT 1
- Black screen when clicking the edit button on any picture HOT 2
- Use image processing features as if it were a library? HOT 2
- Failed to build HOT 1
- Google Play version does not open HOT 1
- Code quality image got not found and app site not found
- Some readme issues
- found a bug HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from phimpme-android.