Android: Camera App Crushed because camera being accessed too many times - android

I have a camera app that takes pictures when user clicks a button. Every time when user clicks the button I will disable the button and then enable the button after the picture has been saved to the phone.
This enable and disable stuff is done to prevent user striking the button crazily and destroy the app. However, it seems like it is not working as I expected. Any suggestion why this is happening? I am guessing multiple threads are trying to enable and disable the button at the same time, but I am not 100% sure.

It turns out that it was a concurrency problem. And I solved this by using ReaderWriterLockSlim to enable and disable the button which have solved problem (I was developing in Monodroid).

Related

How to temporarily disable screen in Android?

I'm developing a simple phoning application for Android, but I'm having trouble implementing an important functionality.
When I make a call in an Android's default phone app, if I place the phone next to my ear, the screen goes black and it gets temporarily disabled so the user don't accidentally press the virtual buttons.
I already know how to use the proximity sensor, but how can I temporarily disable the screen?
You might want to have a look at these answers
Turn off screen programmatically when face is close the screen on Android
android: turn off screen when close to face
Android: How to turn screen on and off programmatically?

App Inventor App apk file reloads screen every second

I created an app in AI2. Its still building but i wanted to check out its speed and efficiency in the apk file format so i build the app but the home screen reloads every second and i am just able to see something and it loads and again. I checked my code there is no timers there was a while loop which I have deleted. I can't figure out what is the problem.
There are the following possibilities
"something" in the Home_screen.Initialize event might trigger the reload, to find out if this is the problem, just disable all blocks in the Home_screen.Initialize event
A clock component in screen Home_screen or Screen1 might be the issue. Just check how the Clock.Timer event looks like and if you disable the clock again after calling it
As you mentioned in the comments, #2 was the issue and you forgot to disable the clock component in Screen1
It might be because of a clock trigger in the previous screen. When you change your screen disable the clock and enable the next screen.

Launcher or an App for Restricted Access which one is better?

Hi I am planning to create an android app which is similar to the
Samsung Kids Mode- parental control
If you can see the link I gave, it is obvious that the app overrides the Home button when inside the app... I wanted to create a similar app for friends mode and stranger mode and should not come out of the app when home button is pressed... is it possible without root access?? My ultimate aim is to not come out of the app without entering a password, So if it is just an app after android 4.0 it just comes to the home screen when home button is pressed, So If I create a custom launcher and make it default even after pressing home button it will be inside the app if I am right, but is there any way I can do the same without a launcher
Also to avoid the phone number suggestions which happens when we dial parts of numbers in the dialler, should the phone be rooted to so it or is it possible without that?
Thanks in advance to everyone for taking time to read this, hoping a positive solution

Is it possible to disable home button temporarily for other apps on rooted device?

Is it possible to disable home button temporarily for other apps on a rooted device?
I am making a program that controls other programs. I have full root access.
Is there a way I can disable the home button so that other apps can't use it if they
aren't allowed? Implementing a home screen doesn't work because I want to disable
the button for other programs as well.
I suppose maybe I could just restart the program
that pressed home to get back again but that is kind of an ugly solution.
I found this:
http://www.droidforums.net/forum/android-hacks-help/23552-disable-search-button.html
It works, but I would prefer not to save to a file all the time (flash wearing). Also it seems to only be working on bootup. Or is there a way to reload the configuration?
I found a workaround:
Make a home screen activity that intercept your HOME press and then just call finish() in onCreate(). This code can launch another "launcher" at will, or do nothing as you please.

is there a way to detect the physical button press on a Droid X?

I realize the Camera button on the Droid X is not a standard feature across all phones, so, I'm curious how to attach a callback to it. I have a camera application that I wrote and I want the user to be able to snap the picture by pressing that button, but currently it doesn't work that way, so, I'm wondering how to attach my callback to it.

Categories

Resources