Im looking for a way to create android window which will contain a button, the window should be small, but i want it to contain no parent activity.
So, if the launcher is opened and the app is launched, the back will be the launcher, and still usable.. (so transparent activity is not good)..
I saw dialog and popupWindow are options, can it be done with any of them? Any other API?
Thanks.
StandOut is a third-party library that lets you create floating windows and its fairly easy to create them. There are few examples on the GitHub page so you should check them out
Related
I'm looking to have a window pop up at the very start of my android app with two options on it.
I have two functional buttons already in my app and I'd like the user to pick one of the two buttons before they get in to the app.
Lets say the screen pops up at launch and I'd like it to say "Please choose either 'button1' or 'button2'"
I've found a few solutions but none that I can actually get working...think that might be might novice status though.
Thanks for any help.
You should create a splash screen (many tutorials can be found on this, here is an example). After having this activity, you can create a Dialog with 2 buttons (example here).
You can set a positive and negative button on the dialog to do this, and also use a callback for the click behavior (example here).
I made an image viewer MyImageViewer, and I had to build a filemanager for it, called MyFileManager, as a class. I open MyFileManager from MyImageViewer through Intents perfectly.
It turns out that now I like MyFileManager more than the actual file manager that came with my Android (that is tooooo slow and tooooo limited). So I want to add a second launcher button to the Home Screen for MyFileManager class, besides the one I already have for MyImageViewer.
Is there an easy way to do this, besides using widgets? In general widgets keep 'listening' to triggers, and hence consume battery and resources. I just want a simple button to launch my MyFileManager.
If widgets are the only solution, do you have a link/code to implement a very lightweight widget to do what I want? Or is this lightweight enough: http://www.javacodegeeks.com/2013/05/modal-dialog-popup-from-android-widget-example.html
Thanks!!
L.
I'm developing an app that includes reviews of items and due to my design, I want to only show all the reviews in a popup window like in Google Play Store:
What should I use to create that white panel that appears over the current window and contains the necessary information? This should be simple but I'm a newbie and I can't seem to figure out what this "widget" is. Please help me if you are familiar with this so I can use this cool design pattern. Thanks.
It seems you want to display a layout as a popup in another activity.
If you want to do this using an Activity instead of a Dialog, you can do this by setting the activity's theme to android:theme="#android:style/Theme.Dialog" in the manifest - this will make the activity appear like a dialog (floating on top of whatever was underneath it).
A better way to do it would be using a DialogFragment. You can display information in the form of a popup and it will have its own lifecycle. That will be much better than displaying an activity like a dialog
Ram kiran's answer is a good one and one which I like to give also. But just so you have another option to look at you can consider PopupWindow
As stated in the docs, it is
A popup window that can be used to display an arbitrary view. The popup window is a floating container that appears on top of the current activity.
I've used this and it works out nicely in some situations. It really depends on what your exact needs are as to which will work best for you.
I want to create a pop-up window (with black transparent background around it) that would appear above the application activity screen (by clicking on a button). This pop-up would contain a video player, a list of videos to be played and some other elements.
This pop-up has to be a fragment since I need to re-use it from other app fragments.
So my question is : what is the best way to achieve that? I personally see 2 options :
1) adding the pop-up as a fragment on the layout and to show + activate it whenever I need. But in that case, how can I put a black transparent background around it that would fill the whole screen?
2) using DialogFragment but it seems that this class is not very well-designed for this kind of stuff.
What do you think?
Thanks in advance.
DialogFragments are the suggested way to launch Dialog views from within a Fragment, so this is the solution I would suggest for you.
You can do pretty much anything you need within the DialogFragment. You will be in full control of the UI using this method.
Here is a SO discussion of the same point, with good info: Android DialogFragment vs Dialog
This is a bit difficult to explain, so I'll try to give a simple example to what I'd want to implement.
A. When the menu button is pressed in the Market app there are some kind of tabs on the buttom, how can I implement this ?
B.now press the settings (after you press the menu button in the Market app),
Is there a way to create this kind of a layout or I have to start from scratch (I would really appreciate code example for this if there is no 'easy' way to do this).
What you are referring to here is not a layout. This is the standard way of creating menues in Android applications.
Have a look at the following topic in the Android developer guide: http://developer.android.com/guide/topics/ui/menus.html
And regarding your second question: for settings/preferences, you can use a PreferenceScreen/PreferenceActivity. This is shown pretty well here: http://www.javacodegeeks.com/2011/01/android-quick-preferences-tutorial.html
If, by tabs you mean the buttons that pop up after clicking menu, you will have create your own options menu.
http://developer.android.com/guide/topics/ui/menus.html
EDIT: For B, check out the PreferenceScreen/PreferenceActivity, as mention in an answer to this post. Just updating here with link for convinience.
http://developer.android.com/reference/android/preference/PreferenceScreen.html
http://developer.android.com/reference/android/preference/PreferenceActivity.html