Create a full screen MultiSelectListPreferece - android

I would like to create a preference screen that is full screen. The screen will contain a multiselect list. It will also be dynamic, i.e. the list on the screen is not static and I would like to have a refresh button. I am going to try and model it after the bluetooth preference screen in android settings (this is not multiselect so mine would have check boxes).
Basically there is some search function that will find list items and populate the list.
Can you create a preference screen (full screen) with a list preference?
or
Can you full screen a ListPreferenceDialog? Problem I see here is that even if I full screen the dialog I would still need to get a bottom action bar for the refresh button.

PreferenceActivity extends ListActivity. So, you can use the underlying ListView and bind a ListAdapter with whatever data you want. But if you want to do things like the Bluetooth settings, take a look at the source. Basically they're calling PreferenceGroup.addPreference each time a new Bluetooth device is found.

Related

Change activity content dynamically based on users option click in android

I have implemented below tree structure options in navigation, whenever user selects any option, I want activity content to change. Now the main challenge here is Activity content could be too big and It can include many types of fields like links, images, normal text. My purpose here is whenever user selects any option, activity will show that option related information. Now for the first option, it can have multiple images to show, text and links, second option click may not have links but it can have images, information text. Its more like XML structure will change dynamically based on user choice.
Navigation view with activity
I am new in android and I want efficient method to implement such functionality.
Below are the methods which I can think of
For each option click show new activity : I can't implement this because I would have to implement this navigation option code in each activity which is too complicated for me (if anyone has any better idea to implement this approach then please let me know)
Change XML content of activity dynamically : Can I do something like for each content I will write XML pages/file and change it dynamically, I would like to know how to implement this method.

Preference Fragment doesn't open in new Preference screen

I've been trying to show preference fragment data in a separate preference screen. Tried alot of things but no success. Currently, the data is being displayed on the right half of the screen, while header preferences are visible on the left side:
I want to show the data on full screen:
Thanks in advance!
This guide explains the way to implement what you want.
Basically, you should only have a single PreferenceFragment per PreferenceActivity screen (this toggles a single-pane view); create & call another PreferenceActivity when you want to show another group of preferences.

Best control to be used as dropdown list in android

I have an activity which one of its components is a EditText. The goal of it is the following: when user clicks/taps on it, another activity is called to select some items (categories). I have implemented it using an activity that extends listactivity and using a custom adapter to paint custom rows for items.
All is ok, but I guess if using a EditText is the best option. The problem using this kind of control is that when user clicks/taps on it, the virtual keyboard appears and I do not want it to appear. If I use a TextView instead, virtual keyboard does not appear, but it is not clear for user that he have to click/tap on it to select a category (as the underscore line is not shown here as when using EditText).
So what android widget is the best to use in this scenario?
You can always use expandable list view there are many examples online that could help u to create it much more flexible than a spinner and it looks elegant and easy to use, it also show the user directly what is used for by just giving it a look and u can always customize it and play with its look and functionality.
Sounds like you are looking for a Spinner? That way you wouldn't have to load up a separate Activity to make the category selection. Otherwise, why not just use a Button? It's obviously clickable, that's for sure!

Preference with in-line options

I've created a PReference Screen which lets the user manage a series of elements marked by himself as "favorites". I create a Preference category then fill it up with options dynamically, taking them from a sqlite database. This is a screencap:
And this is a screen mockup of what I want to achieve:
That is, I want for every preference item to add an in-line remove option that allows users to directly remove favorites.
The problem is I don't know how to do this, and I've seen no similar examples. Is it even possible?
Android provides an easy means to implement preferences screen, but standard android ListPreference does not provide an easy way to display an image for each item if the list. To add the images to the Android ListPreference, we need to use a custom xml attribute
Here is some example that may help you
http://www.cmwmobile.com/index.php?option=com_content&view=article&id=4&Itemid=12
How to add icons to Preference
To delete prefrence from prefrence screen you you can refer this Link : How to determine which preference item from custom layout button click

Android Preference Screen to look like device admin

i want to achieve the theme of the device admin in my preference screen, see image below to show what I mean.
http://i.stack.imgur.com/TZHnF.png
i have followed the example in sdk but ended up with something like this
http://i48.tinypic.com/b4xkl0.png
how can i achieve the first image?
EDIT: I found out it is actually a device default theme
I think to get the first view, you need to use MasterDetail View.
Left fragment is a List View (Categories) and the right view a Detailed view is again ListView with category detail items.
Check the MasterDetailView example at http://developer.android.com/training/basics/fragments/fragment-ui.html.
I am not sure the Preferences API supports this directly.

Categories

Resources