Git Product home page Git Product logo

Comments (18)

anantprsd5 avatar anantprsd5 commented on July 16, 2024 1

@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.

dynamitechetan avatar dynamitechetan commented on July 16, 2024

on my phone its working perfectly
Any logs?

from phimpme-android.

anantprsd5 avatar anantprsd5 commented on July 16, 2024
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.

anantprsd5 avatar anantprsd5 commented on July 16, 2024

@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.

pa1pal avatar pa1pal commented on July 16, 2024

@anantprsd5 it's not crashing in mine. But if this in your case. So you can fix it.

from phimpme-android.

abishekvashok avatar abishekvashok commented on July 16, 2024

I am not too getting a crash! Can you check your apk version. @anantprsd5

from phimpme-android.

anantprsd5 avatar anantprsd5 commented on July 16, 2024

@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.

Narutuffy avatar Narutuffy commented on July 16, 2024

@anantprsd5 It is not just your phone, I am facing the same problem with my phone too.

from phimpme-android.

anantprsd5 avatar anantprsd5 commented on July 16, 2024

@Narutuffy Yeah. I am working on it.

from phimpme-android.

abishekvashok avatar abishekvashok commented on July 16, 2024

I am using MUI, what all are you all using, who is your manufacturer @anantprsd5 @Narutuffy

from phimpme-android.

anantprsd5 avatar anantprsd5 commented on July 16, 2024

@Abhi2424shek I am using le2 with EUI.

from phimpme-android.

Narutuffy avatar Narutuffy commented on July 16, 2024

I'm using Moto G Gen1, near stock-android. Android version 5.1

from phimpme-android.

Narutuffy avatar Narutuffy commented on July 16, 2024

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.

dynamitechetan avatar dynamitechetan commented on July 16, 2024
	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.

anantprsd5 avatar anantprsd5 commented on July 16, 2024

@dynamitechetan Yeah, its working fine with the above code.

from phimpme-android.

dynamitechetan avatar dynamitechetan commented on July 16, 2024

Can I send a PR?

from phimpme-android.

anantprsd5 avatar anantprsd5 commented on July 16, 2024

@dynamitechetan Sure. Thanks. :)

from phimpme-android.

dynamitechetan avatar dynamitechetan commented on July 16, 2024

okay.

from phimpme-android.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.