The accelerometer on different devices is somehow causing my app to crash - java

This is a frustrating problem, because I can't easily debug my app for every different form factor. Two people have emailed me and said that 'the app crashes on tilt'. I've had one of the users with problems email me the output from the logcat when they run my app.
Here is the output. I'm a bit new to Android development, so this is very cryptic to me and I'm not sure what it relates to in my actual code.
If it's helpful I can post any of my classes, or any information that would be useful.
EDIT: I could be wrong but my guess is that the output referring to the accelerometer starts around line 432 on the pastebin.

They might be using tablets on which the default screen orientation is landscape and the origin is what would appear to be in the top-right corner of a phone.

Related

How to reset the app icon badge number for messages/notifications back to zero for ALL APPs on Android

There appears to be a bug (or strange feature) with the number of notifications displayed on the app icon badge on Android: the number display doesn't reset to 0 and increment from there with new messages after all of the messages/notifications have been viewed. This is a problem apparently experienced by a Very Large number of Android users. If possible, want to create an app that can clear this number for All Other Apps, not just for the app that I have created.
Here is an example of what I'm talking about.
A moment ago I had no unread messages in WhatsApp, Slack, or gmail. I had also swiped away the visible notifications for each app on the notification screen. Each app icon displayed no little red notification badge. Then, I received a single message on WhatsApp. The app icon then showed the red dot with the number 36 in it, indicating 36 messages. That number hasn't been at zero or one in months, basically since I bought the device and installed WhatsApp. This essentially means that the number displayed is worse than useless, it's simply wrong or misleading at best if it corresponds to some remaining number of somethings that I'm not aware of. The same basic behavior pattern seems to happen with Slack, gmail, and other apps.
There are posts regarding how to reset the badge icon number for one's own app, eg:
How to reset the Badge app icon number?
There are also many posts of users asking how to reset the number without programming, using system functionality, eg:
https://forums.androidcentral.com/ask-question/926172-incorrect-unread-text-message-count-galaxy-s9-app-badge-icon-has-wrong-number.html#:~:text=Try%20going%20to%20Settings%3EApps,and%20see%20if%20that%20helps.&text=Go%20to%20the%20message%20settings,solve%20the%20message%20count%20issue
https://forums.androidcentral.com/samsung-galaxy-note-8/879508-google-email-notifications-numbers-wrong-cant-fix.html
It seems to me that it would be helpful to many people to have an app that the user could give adequate permissions to so that the app could reset the badge icon counter back to 0 for all other apps, so that thereafter, for each of the other apps, if the user got a message/notification, they would see a '1' on the icon badge, rather than some other larger number.
Is it possible for an app to do this? If it isn't possible to reset all apps at once, is it possible to do it for one app other than the app that is doing the resetting, or to do it for a list of individual apps?
What is the required code?
Also, is it possible to do this in some way through the OS, without requiring specialized code? I tried the methods that people have posted but didn't find one that worked without substantially disrupting the device (eg wiping the home screen).

Nexus camera intent controls crashing issue

I would like to build a simple camera intent to take a short video, however on the Nexus 6p after the user records the video they are presented with 3 controls, the large blue centre control works as intended by dismissing the camera, however the two smaller controls to the left and right crash the camera and don't give any debug messages to help figure out a possible fix, is there a way to hide or disable these controls as they are not needed for my specifications? I have attached two screenshots below illustrating the issue, any help would go a long way thanks.

Initial lag when starting Android App

I'm working on a chess type app for the Android platform (using Eclipse and standard Java / XML connection). This isn't for school or anything, just a personal project after learning some of the fundamentals to "get my feet wet."
Anyway, my question isn't due to a direct problem, more to what I've viewing when I open the emulator and what I see in the logcat.
Generally, when I hit run for any app, the emulator takes its standard time loading it, but when it does, the main activity loads right away. However, for this app, I'm experiencing a lag after the app loads, and when I quickly glance over to the logcat, it shows a TON of orange messages being generated...and then it displays my board (the app atm is just displaying a board).
Here is the HUGE logcat activity (sorry about the pastebin, but I'm new to this site and was having difficulty formatting this properly): http://pastebin.com/skc8SXqN
And here are my xml and java files: http://pastebin.com/8ByBQ0TA
My question is...is there any obvious reason for why the ~5 second lag occurs between the app loading and the board showing up? The incredibly large logcat output is all directed to the imageview...so am I doing something heinously inefficient there?
The problem is that you should be supplying a drawable for the squareView.setImageResource() whereas you are supplying R.id.square_background which does not seem to correspond to a drawable resource.
Because here i seee you are referencing huge number of images in your project its normal for android emulator to slowdown your loading time of app.you can run it on device it will faster than the emulator..and put your image resources in drawable folder and reference them properly.
As you stated, it was in the general vicinity of the way I was handling the image array...namely, I didn't need it at all.
The getCount() method, if I set it returning a total number of squares I wanted, would simply cause create the square X times without using an image array.
Changed that and voila, no lag.
this is resolved entirely!

how does android understand which home screen is being viewed by the user?

I wanted to understand how does the Android OS figure out which home screen the user is viewing currently and render the appropriate icons and widgets on that screen based on the user's left or right swipe on the touch screen of the device.
The OS must save a state of the screen and IDs or something relative to the objects placed on the screen to retrieve the state each time the screen becomes visible.
From my research I understand that Android OS treats all the 7-8 homescreens on devices as one single host.
Also my question might seem vague, but the reason why I am asking is because it seems reasonable that app widgets on android devices, update not only when the phone is awake but also only when the app widget itself is visible. I know that Google has declined the enhancement request by many others but I don't think that is good enough. Link here.
That is the reason why I am trying to give it a shot to understand and implement it for my app with whatever Android knows about the state of the home screens.
Any help or insight is much appreciated. Also the experts out there let me know if you think this can be even implemented for one off apps at all?
Well, as the link you posted clearly states, there's no way to know.
Also, if you consider the fact that "Home" is just an application like all the others, it makes even less sense to have a unified API for that. A lot of people use Launcher Pro or similar applications, which would probably not implement it.

Manual calibration of android cameras

I have almost finished writing a color detector app for Android.
However I am having a problem with very close shots. Both my NexusOne and Desire are unable to properly auto-focus at such lengths. I have tried pretty much all the parameters to no avail. Is it possible to let the user focus the lens?
I tried implementing the zoom trick ( move phone back and zoom and then auto focus ) and while it works on the native camera app I am unable to get it working with my app.
All advice appreciated. :)
Basically u cannot focus item which are close by(Macro mode) using Nexus One or Desire or for that matter most phones. I am yet to find any phone which does though, but I am not discounting that there may be some phones :-)

Categories