• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Camera X, LifecycleOwner ... "Cannot be cast to..."

So I'm working with Camerax, new to Android development, and I'm attempting to write an application that takes an image on a specific event, not button related, without having to pull up the camera application. I have it all working, but my MainActivity is overloaded. So to clean up the MainActivity.java file I decided to offload different aspects to other files. Such as normal OOP concept.

So I created a CameraFuncs.java file. Which I setup a constructor that I passed an object of the MainActivity class so I can access all the UI objects.

Java:
public class CameraFuncs
{
    MainActivity main;

    public CameraFuncs(MainActivity mainActivity)
    {
        main = mainActivity;
  ...
  ...
  ...
     }
}

my orientation listener works just fine. I have access to UI objects. Everything seems to be working just fine. Execpt when I attempt to bindtolifecycle(). It throws an error.

Java:
Camera camera = cameraProvider.bindToLifecycle((LifecycleOwner) this, cameraSelector,
                main.imageCapture);

I get the following error

upload_2020-8-12_10-41-32.png


I'm not really understanding whats going on with bind to lifecycle. Can something clarify whats happening here, point me in the right direction?

Apps Secret camera, fails to save or I can't find files

Based on help from @Thagorsson, I was able to make changes to my Manifest file to allow access to external storage.

I was able to update my permissions to allow legacy access.

Because in Android Q they have disabled direct file access, they have added a work around to allow legacy support. This is, and as others have mentioned, only a temporary fix for the issue. You will need to follow the new format for saving files going forward with Android R. In my situation, I am only developing a proof of concept and will not need to worry about future versions of Android, at this time.

To make the temporary fix, do the following

set up your manifest file similar to this.

Code:
android:requestLegacyExternalStorage="true">
inside your <application bracket on the manifest file. Should look similar to this

    <?xml version="1.0" encoding="utf-8"?>
...
   package="com.example.camerax">

...

   <application
       ...
       android:requestLegacyExternalStorage="true">
       <activity android:name=".MainActivity">
           <intent-filter>
               ...
           </intent-filter>
       </activity>
   </application>
remember this is not a long term fix, and will not work when a device is updated to Android R

Help Export playlists from Google play to my PC or other player

Is there anyway to export my playlists from google play to another player or to a format that can be imported such as m3u ? None of the music in my playlists is purchased music. its all stuff I own that I ripped from a CD or downloaded MP4s from other places. Sme of them are quite large and would take a great deal of time to rebuild from scratch...

Galaxy S7 shut off then was stuck on boot screen

I wonder if some kind of update got pushed out that bricked it? It find it odd that the exact same thing happened to both of us within a day of each other. It went from working fine, to useless without me even touching it.

I have Asurion insurance on it, but turns out that's pretty much a scam. They want a $149 deductible to replace it with a used phone. I can buy used S7s all day long for $150 or less.

Can you give me an advice? Which phone has better battery life and camera than s10 lite?

"Washed out" is an unusual accusation to throw at Samsung, who usually value "crowd pleasing" over "accurate" in their colour reproduction in my experience.

To be honest though a comparison video is a lousy way of assessing camera quality. Video is lower quality than still, so a reproduction of an photo in a video review can never show the full quality of the image. And if it's a video of a screen showing the photos that reduces quality further and adds 2 other distortions to the colour (the colour calibration of the screen and the colour profile of the video camera itself). So if you want to judge the quality of a camera you need to look at the actual pictures it takes, not someone's video of them. This gives 2 options: read some reviews (text & images, not video) which include full-resolution images or find a photo-sharing site which allows you to select pictures by the device they were taken with. Judging based on a video review is making a decision based on poor quality data.

Samsung often use different processors, sometimes different image sensors, in "the same" camera in different regions, both of which can affect image quality. But I've only found one processor variant for the S10 Lite so maybe you don't have to worry about that particular complication. Sadly my favourite site for phone camera reviews only does a handful of phone reviews per year, so the S10 Lite isn't included there.

One thing to remember with all reviews, still or video, is that they are made with the firmware of the time (usually the initial release). Manufacturers do sometimes improve image quality with firmware updates, but it's very rare that reviews revisit the device to update their review.

Tabs

I keep seeming to have more and more open tabs on my Pixel (in Chrome). Any time I go to a new web site it seems to open a new tab instead of just using the one already there. So I may have 60 tabs open. I can close them but wondering whether there is some way to prevent this from happening?

Help bootloop

It was certainly a mistake: with a custom recovery this would be easy to fix, but without...

I can't help wondering whether the problem was caused by trying to fastboot flash a custom ROM zip (i.e. something that was intended to be flashed using a custom recovery)? But that's only speculation.

Best bet would be to find the official firmware for your phone and the tool/procedure to flash that. That probably requires fastboot mode, but you did imply (if I read you right) that you could access fastboot mode.

beginning with Android Studio and NDK issues

Here's the 'start from scratch' Android development course fron Google: https://developer.android.com/kotlin/androidbasics
I'm going through it now. You'll notice some differences between the latest Android Studio and what the course says, it's just that they used a slightly older version of Android Studio when the developed the course. Just be prepared to experiment and explore and you'll be fine.

Disable all Notifications exept vibration on huawei p30

Hello mikedt

This is not only for twitter.Its for all aps.
I used twitter as an example

Iknow that this is possible in iOS

I was wondering if its possible in android?

FWIW I do have a Huawei phone, a Mate 10, however the only things I've done with app notifications depending on the particular apps, is completely disable, or "gentle" which is on screen only, or "full" which is vibrate and sound. Of course I can't tell much iOS, as the last iPhone I had was in 2007.

Filter

Back
Top Bottom