android.os.BinderProxy cannot be cast to android.app.servertransaction.ClientTransaction - android

In Poco X3 phone found a black out screen after changing language from settings.
steps to produce
From Dashboard to goes to detail screen
Go to Device settings , update language
back to app
back press navigate to dashboard
black out screen for few seconds. How to fix this issue !!!!
android studio logs
java.lang.ClassCastException: android.os.BinderProxy cannot be cast to android.app.servertransaction.ClientTransaction
at android.app.ActivityInjector.checkAccessControl(ActivityInjector.java:24)
at android.app.Activity.onResume(Activity.java:1995)
at androidx.fragment.app.n.onResume(FragmentActivity.java:2)
at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1457)
at android.app.Activity.performResume(Activity.java:8264)
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:4509)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:4551)

Related

Activity recreate issue in Android Nougat Only?

I have developed small project, in which there are three fragments added in a single activity.
I am getting an issue in Nougat only i.e.
Start the application and go from fragment 1 -> fragment 2 and in fragment 2 there is a single button on this button click open external browser and when press back button, activity reload again and start from fragment 1.
In below versions from Nougat it is working perfectly, it back on fragment 2 but in Nougat (Samsung Galaxy s8+) it activity reloads and starts from fragment 1.
so please help me to resolve this issue.
thanks
First check your code in onResume where if you are reloading the ViewPager or setting the currentItem.
Other Reason can be Don't keep activities activated. Can you check in the Developer tools to see if Don't keep activities is on?
You can check it from Device settings Like this:
Settings -> Developer Options -> Don't keep activities

Assigned shortcut to Android Studio doesn't work

I wanted to close active tab by shortcut in Android studio. I found CTRL+F4 does the job from here. Although it closed active tab, keyboard functionality disabled in a way that I couldn't type anything in editor (modify my classes).
So, I decided to change its shortcut. I assigned CTRL+W to close active tab and CTRL+SHIFT+W to reopen closed tab as you see in following screenshot. CTRL+SHIFT+W does its job properly while when I press CTRL+W nothing happens (active tab doesn't close).
My OS is Ubuntu.
Close Active Tab closes the active tool window. You need to find "Close" under "Main menu" -> "Window" -> "Editor Tabs". Change this to "Ctrl + W" and it should work.

Android End to End testing with calabash

I am new to using calabash for android, which is a end to end testing framework for android. Iam trying to test a feature where on pressing a button in my app I am taken back to the android home screen. Could someone help me with the test for this scenario? Here is what I have till now
Feature: Return to Home Screen
Scenario: As a user
When I press the "GO" button
Then I should see "HomeActivity" screen appear
I am stuck at the second line. I have tried several alternatives like trying to use the id (Don't think I got the correct id. Does the android home activity have a predefined id?) or different names to test if the home activity appears.
I've created a new action to do exactly that on my github branch
For TabActivities it returns the tag of the current tab.
For other Activities it returns the class name.
actual_activity = performAction('get_activity_name')['bonusInformation']
raise Exception "Expected #{expected_activity} activity but was #{actual_activity}" unless actual_activity == expected_activity

How to return to the same activity instance after resuming it?

The problem is somewhat odd and after having trying to figure it out for about a day now, I am posting it here.
I have an application where an activity A(main activity) launches other activities(B,C or D).
The issue here happens when activity A has started Activity B and 'home' button is pressed.
Case 1 - When I test my application in debug mode on my device (HTC Desire) after pressing the 'home' button, I again click the application icon, it returns to the same activity (activity B), which is what is should do. No issues here.
Case 2 - When I export the signed package, and then install the application on the same device, then if I click the application icon after pressing the 'home' button, then a new instance of activity A (main activity) is launched ON TOP of activity B. I got to know this because when I press 'back' from that activity, it returns to activity B and pressing 'back' again shown activity A.
The behavior ceases to exist if the application is quit in the same order it was started, that is, if I press 'back' from activity B, then 'back' from activity A (exit).
After this everything runs fine.
I have tested it many times with different settings but I can't seem to figure out why the behavior is like this.
Any help is appreciated.
I think giving Activity A the 'single top' flag in your manifest should fix this.
Regarding Case 1:
When launching your intent from Activity A to start Activity B, add the flag FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET
This will ensure that when you go home and launch the the app again, Activity A will be shown.
Regarding Case 2:
I'm not exactly sure how this would occur. It seems like it thinks you have two versions of the app, the signed one and the unsigned one but keeps them both in the same task stack. You may want to consider using singleTask or singleInstance for your Activity if you only want one instance. See the doc on tasks and back stack for more details.
I would agree with Noel regarding the likely cause of Case 2. Without task reparenting or it being set to a launchmode preventing multiple instances of an activity, there is a chance that launching it from Home isn't deemed the same stack as launching it from Eclipse (assuming this to be the case).
In my talent calculator app I have the whole application set allowTaskReparenting=true to ensure nothing is left in other stacks (primarily email as it can email launch urls). I then have my main activity set to launchMode="singleTask" as I only ever want one instance of this to exist no matter what launches it or with whatever intent.
My only other activity is for loading and saving and that has noHistory="true" to make sure it is removed and never returned to. That basically means it only exists while you're in it, and can never return to it.
clearTaskOnLaunch="true" will also ensure only the main Activity remains in the stack when it's launched from Home, but this isn't always the case if you have other ways to get into your activity. If it's only ever launched from Home then set this.
Hope that all helps.
Do you start you application manually or using Eclipse or another IDE? When starting from Intellij IDEA I had exactly the same problems. Then I stopped and ran it manually and behaviour was as expected.

Weird Home button behavior

I'm experiencing kind of strange behavior of my application after hard Home button is pressed.
When you press Home, everything is OK - my app goes to the background, showing Home screen. But if you try to choose my app in the main menu or in the list of last tasks it behaves like it was not started before and does not show the last activity you were on - it just starts from scratch, namely, shows the splash screen and starts next corresponding activities. Moreover, old activities of this app remain on the activities stack, and previous instance of the app is not terminated - so if you press Back for a few times you'll just run into those activities which were undoubtedly started during the previous session of work with my app. Splash screen activity is filtered by "android.intent.action.MAIN" filter and "android.intent.category.LAUNCHER" category.
The strange thing is that all of that happens despite the fact that I do not intercept any Back key hits, or override any onPause or onResume methods. What's happening contradicts with my understanding of Android app lifecycle - I was sure that when you hit Home an app just goes to the background, and when you choose it in the menu later - it just unwinds and does not start anew. (Of course, unless stuff like that is stated in the app manifest or corresponding methods are overridden or something else).
I also checked it for some other lifecycle events - such as changing orientation or flipping hard keyboard out - and none of those led to such strange results. It appears that the problem occurs when you try to start the app from main menu or menu of last applications.
I hope you will be able to help me. Any advice on what to pay attention to or where to search for solution would be really great.
Regards, Alex
You need to set android:launchMode="singleTask" in your LAUNCHER activity in your manifest file.
For more info on the launchMode attribute see here
Note that:
The default mode is "standard".
and:
Every
time there's new intent for a
"standard" activity, a new instance of
the class is created to respond to
that intent.

Categories

Resources