I would like to create effects like lock/unlock screen of android. I have attached the screenshot here as well. In lock screen we have 2 buttons but in my case I am having 3 buttons and the middle button must be draggable.
The middle button can be drag to left/right.
I know I have to create custom view for this to work but I don't have any idea about how to drag button left/right with nice effect(animations) which normally any android phone have.
I need guidance on this, so can anyone suggest me how to approach for this.
Basically i wish to move/slide button left and right and based on that want to take some action.
I have tried making a lockscreen application myself and i almost made it, but here are the facts you will have to face at the end
You will not be able to disable home or menu button.
you will need user permission (not the one you get while installing the application, the menu pops up every time you press the home button unless the user decides to make your application default home screen, if that does happen you have successfully made a lock screen) if you decide to make a home screen application too.
the lock screen doesn't go very well with passwords
But if it helps, here's what i did:
You need to create a service that keeps a check on the screen being off and on.
if the screen is off, you do nothing. when the screen if ON you start the activity and wait for the user to do the thing you want the user to make him unlock the screen. and when he does that you finish() the activity.
While doing that you need to setup a method that can listen to check the incoming calls you can do that by extending PhoneStateListener and also disable the back button.
Good Luck and if you are able to make any further progress do let me know.
Maybe this project could help you GlowPadView. I've used it succesfully in one project. Hope it's what you're looking for.
Related
Working on a mobile game at the moment and was having difficulty getting the back button on android devices to function as I want it to.
Here's the scenario: You click down on the back button, realize you don't actually want to go back so you swipe up (while still pressed) onto the game screen, thus negating the back button being pushed.
I'm using InputProcessor and i have keyDown and keyUp. The problem is, i'm not sure how to use these two together so that when i swipe off the back button it doesn't go back.
I have been able to get the back button to do the other functionality i want (such as not exiting the app and going between screens and such), just stuck on this one scenario.
Any help is much appreciated.
Edit: This functionality can be seen in the facebook mobile app. If you click on the back button swipe off of it to the mainscreen, the app doesn't exit.
I don't know exactly the Syntax for Mobile development but I figure your best course of action is to create a Boolean willExit, and instantiate it as true, and in the KeyUp() function put and if (willExit) statement. Now you can have it run through the block KeyUp() without doing anything if willExit = false. From there you just set willExit to false whenever the condition is met, such as in your case when Swiping.
Simply in the KeyDown use the switch statement to see if the it is the back button or not.
If it is the back button, check if the screen is touched.
As simple as that.
BTW sorry for not providing code snippets.
I am new in this forum and checked different threads here but did not found something similar to what I want to do...
Some Apps like MP3-Players or e.g. Spotify-App add some buttons when the lock screen is active (android nativ lock screen with PIN). In this case the displayed Date will dissapear to give more place to these "new" controls.
I have tried this without succes with a simple widget app by including android:widgetCategory="keyguard|home_screen" in the appwidget-provider xml information. The app widget is correctly operating on home screen but I see no widget when my screen locks.
So I think this uses other mechanism, may be an activity that hides the date and display controls on the lock screen.
Did anyone try something like this and can give me some tipp?
Thank you in advance!
Notes:
I dont want to implement a lock screen app, I would like to display a button and text on my lock screen like some common and existent apps do.
Used Android Version >= 4.2.2
Is there a way to know if some user is clicked on the Home Screen of Android device. Something like homeScreen.onclicklistener
I tried to create a widgets and to listen for clicks, but this is not possible task, because there is no way to create widgets programmatically(auto adding), or maybe I don't know how to do it. I know this way is wrong but I had to tried.
Thanks in advance.
Screenshot from the Home Screen.
I am going to code a walkthrough tutorial for my app.
I wish the user will follow the step of the tutorial. So I want to force the user to click on a specific button but not other parts of the app.
My app has many UI components and some of them are added programmatically so disabling them one by one is not practical.
One immediate solution is that I make a transparent Activity to cover the original Activity.
But I don't know how should I detect the touch event through the overlay Activity to operate the original Activity.
Or are there any better way to make a walkthrough tutorial on android apps without much affects to the original code? Tutorial is an adhoc feature and I dont want these adhoc features to ruin my coding with a lot of if-statement on every Activity.
Thank you.
Activity won't work. Only the one at the top of the stack can process infos.
Simply add a semi-opaque view above the screen using a relativelayout
Then simply monitor the ontouch event of this view. If the touch is in the accepted zone of the tutorial, then let it bubble up to underneath control. If if is outside the accepted zone consume the event.
Button btn = new Button(getActivity());
btn.setText("Next");
// Adding button to bottom
lv.addFooterView(btn);
Please don't delete it because its a duplicate. I am an android developer with little experience. I have an app with 2 screens. The first has a bunch of options in a TableLayout each selected using a RadioButton.
What I want to do is, when I select one option and click a Button which appears below, the View should switch to the next screen showing some related data and when a Button is clicked I want it to come back to the same screen but then the rest of the options should be available to me so as to repeat the same process with another one of the options selected.
In short I want to be able to maintain the state of the first screen. I can't seem to be able to decide between using ViewSwitcher, ViewFlipper, or multiple Activities or using a single Activity which is what I am doing right now. But as my app gets bigger its very difficult to handle it. Please suggest the best way to do this. I am confused and desperately in need of help because my job depends on it. Thanks in advance
Use 2 activities. Launch the 2nd activity when the user clicks the button. When the user clicks the "back" button (or some other button you offer him) the 2nd activity finishes and the first activity (which was underneath it) is shown.
Note: You've not given us much information, so I can't guarantee that this is the best solution. From what you've said this is the solution I would recommend though. As they say in advertising "Your mileage may vary" ;-)