How to add a custom marker in Android systrace? - android

I am using systrace to dig into the performance issue in my app, I am wondering if there's a way to add a tag / marker when certain event happens in the systrace result? The specific event I am looking for is input event, but it's hard to tell from systrace which input event is which. I am on Android 4.2.2
Cheers,
Johnny

You can, using android.os.Trace, but the feature wasn't added until Android 4.3 (API 18). You can find an example here.

Related

OnHoverListener is not working on an android emulator?

I'm trying to add mouse/touchpad support to my app and that includes hover support. As per the android guidelines, which say:
Developers can make their app layouts feel polished and easier to use by handling hover events. This is especially true for custom views. The two most common examples of this are:
Indicating to users if an element has interactive behavior, such as being clickable or editable, by changing the mouse pointer icon.
Adding visual feedback to items in a large list or grid when the pointer is hovering over them
yourView.setOnHoverListener { view, _ ->
addVisualHighlighting(true)
view.pointerIcon =
PointerIcon.getSystemIcon(view.context,
PointerIcon.TYPE_HAND)
false // listener did not consume the event.
}
This is not working e.g. the pointer icon is not changing and a debug/print line is NOT being called, at least not on an emulator. I am unable to test on a real device so could this be a limitation of the android emulator or am I wrongly implementing this listener? Would it run correctly on the Windows 11 subsystem for android?
Well, I tried running my app on android x86 in VirtualBox and everything worked! Looks like the android studio emulator doesn't capture mouse pointers. I'm only wondering if this will work on the Windows 11 subsystem.

Stylus pen input not working on Unity android

I have a problem that I cannot input using the Stylus pen in Unity Android.
When the Stylus pen touches the screen, the first OnPressDown event is called, but then OnPressUp is not called, and all pen inputs are not operated afterwards.
OnClick of Unity's UGUI Button is not being called either.
Pens that work normally in other Android apps, but the above problem occurs in Android apps built by Unity.
The pen is made in China, but the exact model is unknown.
Is there anything in doubt?
Please understand that the sentence may be awkward using a translator.
I solved myself
The handling of pen input is included in the Input System Package supported in Unity 2019 or higher, so the problem was solved by installing the package.

Android TSP Hovering

Is there any way (or any API) that we can use to check if TSP Hovering is supported by android devices?
There are listeners added in android API 14 i.e. View.OnHoverListener. But this does not show if Finger Hover is supported.
Here is link which describes Samsung doesn't provide any such API.
I want generalized solution using Android APIs.
Does anyone have any idea about this or any hack ?

Android multi-touch feature (up to 6 touches)

I want to know if it is possible to make an android application that features up to 6 touches simultaneously with the multi-touch option (not just two). Please can u help me to find some relevant literature. I've found some answers here on stackoverflow, but i am afraid that that's not enough.
I would appreciate every help. Thank you all in advance.
Devices that support "jazzhands" will handle up to 10 simultaneous touches. Your app can require jazzhands support via the following manifest element:
<uses-feature android:name="android.hardware.touchscreen.multitouch.jazzhand" />
Not all devices will support this -- for example, the Kindle Fire only supports two simultaneous touches IIRC.
There is no software difference between 2 or 6 touches (except for the permission), it is hardware related and if you can't use more of 2 fingers then you should try on another device.
Anyway, if you want good multitouch litterature, have a look here:
Making sense of multitouch (android-developers.blogspot.fr)

Android 4.0 compatibility issues with Canvas.clipPath

Recently my application received quite a lot comments that "it's not working" on Android Ice Cream Sandwich with CM9. I'm not able to reproduce the error on the emulator running Android 4.0 and thanks to the way android market works there's no way I can't contact those people to ask about the details.
Luckily, one crash error report caught my eye. I'm using Canvas.clipPath to draw rounded corners... and looks like some phones are throwing UnsupportedOperationException when trying to use that function. Quick look at Google reveals that it seems to be a problem when using hardware acceleration in Android 4.0 - so that's the potential reason of received comments.
The question is - what's going on? Weren't applications hardware accelerated in previous android versions? Why such common function isn't supported? What's the workaround?
Example usage of Canvas.clipPath can be found in my other post. Check the accepted answer here: Android rounded corners in ListView
Thanks in advance
In ICS, hardware acceleration was turned on by default. Until 4.0, the default was that hardware acceleration was off.
Hardware acceleration does not support clipPath (and a few other operations, see more here http://android-developers.blogspot.com/2011/03/android-30-hardware-acceleration.html)
I am facing the same issue. As a quick fix I will turn off acceleration for the entire application, and later I will rewrite the code not to use clipPath
You can turn off hardware acceleration only on the specific view that is causing problems. Check out my answer here: https://stackoverflow.com/a/14054331/596708

Categories

Resources