I've implemented search functionality as explained in http://developer.android.com/guide/topics/search/search-dialog.html. This works fine on Android 2.3.5 with the hardware search button. Now I wonder how I could integrate a software search button. I added a button in the ActionBar but now I wonder how you can show a dialog for inputting the query as with the dialog showing up after pressing the hardware button.
In your onOptionsItemSelected method, check if the user pressed your search button.
If so, call the method onSearchRequested() in your Activity, and your custom search implementation should pop up.
Related
I am developing an android application and want to create an instruction mechanism for every page, directing users to click a specific button.
How can I create such dialogs indicating, highlighting a button that has to be clicked, also the button should be highlighted and background is darkened to focus a user's attention.
I created a simple alert dialog, but it's not what I am looking for
I want to develop a custom launcher android for Samsung Tablet where user can only exit the launcher with a passcode input.
Currently I face problem in recent app button. If user click recent app button, and then click the recent app, then click backpressed, device will go to TouchWiz launcher even I already set my launcher as a default launcher. Also, I disable the notification bar so user can't access it. However, when it go to TouchWiz via backpressed at recent app, the notification also disable, it should be able when in TouchWiz launcher.
My proposed solution is to detect when user click recent app and forbid any action that can cause the changes of current view.
You can check onWindowFocusChanged method. You Activity will get a callback on this method when you click recent apps or press back button from it. When you click on recent apps hasFocus will be false and when you press back it will be true.
documentation
I can't detect the recent app clicked. So I use onPause() to detect if my app is on foreground or background. If is in onPause() then my app is on background, if so, I do startActivity(myLauncher) so other app won't launched.
My Problem is that in some cases the overflow menu dosent work on some phones. First i thought it is the android version and designed 2 different menu xml.
But a Samsung Mini S4 with 4.2.2 doesnt show the overflow and Samsung S5 with 4.2.2 shows the overflow menu.
It seem maybe something to be with the hardware buttons, i dont figure it out.
Can anyone help me how to detect when the menu overflow is shown?
I use following: Com.android.support:appcompat-v7:21.0.3
Thanks Malte
Yes, it is the hardware menu button. So on devices that have the hardware menu button, the overflow menu will not display since the user can use the hardware button (it reduces redundancy). However, IMO it also reduces usability since most users do not think to hit that button (at the least, they do not in my apps).
So you can detect the hardware button: Android: Programmatically detect if device has hardware menu button
And then display a menu item that looks like the "***" menu button and have it activate the menu if you like.
Okay. What I have so far is an Android app with a Google map on which I've placed a bunch of icons that, when clicked on, create a popup with some text on it. Is there any way to place a button on that popup? If this is not possible, is there some way to make a button appear when an icon on Google Maps is selected?
In case you're wondering, the code I'm using now looks like this.
itemizedOverlay.addOverlay(new OverlayItem(point, title, text));
//actually a whole bunch of OverlayItems, each with their own location and text
//but this is the general shape of it.
mapOverlays.add(itemizedOverlay);
Edit:
There are different kinds of popups used with different versions (check yourself in the emulator versions) of the GoogleMaps app. The first popup simple displays the title of the location (Android 2.3.3).
The second popup shows the title and arrow indicator. (Android 4.0.3)
Interesting enough: I noticed that both popups are clickable and start another activity that shows details about the location.
The mapviewballon project https://github.com/jgilfelt/android-mapviewballoons/ allows you to use your own custom layout for these popup.
I did not test with buttons on it but I do not see why I would not work.
The example projects shows the following types of popup balloons.
Here is another project that creates a custom popup balloon. The project can be downloaded at the end of the article.
I am currently working on a calculator application for android. I am finding it difficult to conveniently take a screen shot of the app. So i have put my calculator on pause so I can write a simple screen shot app. It runs in the notification bar and when you click the notification the notification bar slides away and a few seconds later a snapshot is taken. This works perfectly. Now I would like to add functionality to take snapshots even for full screen apps. I have seen apps that put a sliding drawer on the screen onto of whatever app is running. That is there is always a button on the screen no matter what you are doing that when you click/drag it that sliding drawer came out. How did they do that? It should be a simple process to use a button instead of a drawer and when it's clicked hide it, snapshot and unhide it.
So my question bsically is
How can i put a usable button on the screen that stays above whatever app is running, even the homescreen
I realize I'm not answering your question directly, but if you simply want to get a screen capture of your application running, I would use ddms in your android tools directory. It has a menu option for getting a screen grab. I use it frequently.
Just go to Device > Screen Capture
More details here :
http://developer.android.com/guide/developing/debugging/ddms.html