• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

App for accessing Camera

 
Ranch Hand
Posts: 117
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was trying to access camera in my application
but I am getting this error

 java.lang.NullPointerException: surfaceTexture must not be null
at android.view.TextureView.setSurfaceTexture(TextureView.java:737)
       at com.example.viewpagerexample.viewmodel.CameraVM$startCamera$1.onUpdated(CameraVM.kt:47)
       at androidx.camera.core.Preview.updateOutput(Preview.java:387)
       at androidx.camera.core.Preview$1.onTextureChanged(Preview.java:62)
       at androidx.camera.core.CheckedSurfaceTexture.resetSurfaceTexture(CheckedSurfaceTexture.java:98)
       at androidx.camera.core.Preview.onSuggestedResolutionUpdated(Preview.java:315)
       at androidx.camera.core.UseCase.updateSuggestedResolution(UseCase.java:375)
       at androidx.camera.core.CameraX.calculateSuggestedResolutions(CameraX.java:458)
       at androidx.camera.core.CameraX.bindToLifecycle(CameraX.java:144)
       at com.example.viewpagerexample.viewmodel.CameraVM.startCamera(CameraVM.kt:82)
       at com.example.viewpagerexample.viewmodel.CameraVM.access$startCamera(CameraVM.kt:17)
       at com.example.viewpagerexample.viewmodel.CameraVM$openCamera$1.run(CameraVM.kt:29)
       at android.os.Handler.handleCallback(Handler.java:869)
       at android.os.Handler.dispatchMessage(Handler.java:101)
       at android.os.Looper.loop(Looper.java:206)
       at android.app.ActivityThread.main(ActivityThread.java:6784)
       at java.lang.reflect.Method.invoke(Native Method)
       at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:852)



Here is my CameraVM

 
Master Rancher
Posts: 451
6
IntelliJ IDE Spring Fedora
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Looks like you are trying to set the surface texture to a null value.  The real question you want to ask is where is your surface texture supposed to be coming from and why isn't it coming.
 
priyanshi bhardwaj
Ranch Hand
Posts: 117
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Al Hobbs wrote:Looks like you are trying to set the surface texture to a null value.  The real question you want to ask is where is your surface texture supposed to be coming from and why isn't it coming.


Yaah I also think so .So any answer for the same ?
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!