Android: make spinner item unselectable - android

I am writing an android application that has a spinner being populated with a string array with 5 items. Under certain conditions I would like several of these items to be un-selectable or disabled (greyed out and un-clickable). I found this article on google groups:
http://groups.google.com/group/android-developers/browse_thread/thread/f6951f3340a6075a
this article explains how to create a PatchedSpinner class to accomplish this, but it does not explain how to use the class after it has been created. I am struggling with how I can create a spinner widget using this class. I would really appreciate any help on how to use this class, or any assistance on how I should go about accomplishing this task.

http://groups.google.com/group/android-developers/browse_thread/thread/f6951f3340a6075a?pli=1
Not sure about the greyed out thing but these guys seemed to have found how to disable the spinner or at least being able to select the items.

Related

How to create collapse able Menu items in Android?

I am designing an Android Application, in which I want to add a filter to filter the choices that are displayed in certain categories, now the thing is I am planning to have show a PopupMenu whenever a user clicks on the filter button, and it is working, but since the number if filers is large. so I want to group them and make them collapse able, and I have seen many apps doing so, but I am not able to implement than in code, if you could provide me with a nice code doing the same, or any tutorial it would be much appreciated. Thank you :)
If you are using json for getting the data, then it will be good to maintain the filter from back end side. So just pass the name of category or categories, for which you want to get filter. and you will get the result from json for all categories. Most of the Apps using this approach. So you can also try this way, to achieve filter.
I'm not sure if i understand your question correctly, but if you want to group some items in your popup ExpandableListView should solve your problem.
Link: http://developer.android.com/reference/android/widget/ExpandableListView.html

Best method for true drill-down navigation in Navigation Drawer

I know EXACTLY what I want to do, but am new to android programming. I have gone through countless tutorials and searched everywhere, but cannot find any code examples of how to use multiple listviews (or other method, if there's a better way) in Navigation Drawer to achieve a true multi-level drill-down menu. I'm talking 4 or maybe even 5 levels of hierarchy. Expandable listview will NOT work for me. The BEST explanation I can find is the "Dropbox" example located here: http://www.androidpatterns.com/uap_pattern/drill-down-navigation
Let's assume this is for a product catalog. So listview #1 would have options like Computers, Appliances, Video, Audio. Listview #2 would re-populate the NavDrawer list with options like Stereos, Speakers, Cables (assuming they select Audio), Listview #3 would re-populate list with Sony, Yamaha, Etc. (assuming they select Stereos), and the final listview #4 would list all Sony stereos. When they make their selection, it would query the database and display the fragment view of that particular stereo.
I think I can handle all the database code. What's really holding me up is simply the functionality of the navigation. I am a very visual learner, so any actual code examples or tutorials you can point me to would be invaluable. Thank you in advance for any help! :)
I would implement it with Fragments. For every level in your hierarchy you create a ListFragment and if a user clicks on an item in the list you perform a FragmentTransaction and replace the current Fragment with the next one. I assume you know how to implement a ListFragment, if not I can explain it to you. I'm not sure what code samples to give you aside from just posting a completely implemented ListFragment as this is not really a very specific question. Perhaps I can help you further if you explain what you have tried so far or if you post some relevant code.

How do I create a text box on eclipse just for viewing in a scroll type menu?

I am trying to make an app where you scroll(up and down) threw a list of game cheats and you can select a cheat and when you do it goes to a page in the app where you can see what the cheat code is with info about it. How do I do this? I am a complete noob.
I would suggest using a listView and populate it with "cheat" objects that have text, maybe an image, and some other properties of the class. Then in the onListItemClick start a new activity and implement more detailed information about the "cheat"
There are lots of good tutorials for this stuff here:
this is a really good one: http://www.vogella.com/tutorials/AndroidListView/article.html
Good luck!

how to display image and description from database in Android

hey guys Im starting developing android aplications however this is my problem.
I need to create a list like this:
http://i.imgur.com/TKRr9aE.jpg
as you can see I need the picture, title, description, finally a cursor that leads me to the complete imformation about the selected option.
searching I found tools like linear or table layouts, but Im not sure if that will be the good way to do this.
my database have just that 3 columns: image(path of the picture), name and description
so my question is ¿what will be the best way to display this? Maybe is something really basic, but again... Im starting with android and I love it! is really interesting I need to get in in this world.
Anyway Hope you guys can help me. thx
What you want is a listView here is a good starting point.
http://developer.android.com/guide/topics/ui/layout/listview.html
Now as far as getting the picture included as well you would probably need to create a custom class that extends listView and then make the appropriate changes.
You can use a list view with a custom adapter. The adapter should extend the CursorAdapter class for managing data from database.
http://www.mysamplecode.com/2012/07/android-listview-cursoradapter-sqlite.html

Android: ListView filtering from a dropdown menu OR checkboxes

I've been browsing these and other "forums" for quite a bit and I've not been able to find a "guide" to this issue I'm facing.
I've had an Android course and I decided to start working on my own app, everything was going smooth until I got to this point: I got a custom listview with several items. Now I want to have either a dropdown menu just above the listview or a few checkboxes so that the user can filter said items according to his selection.
Every tutorial I've read talks about filtering the listview thru an edittext field and the user input, but I want the user to click a button and the filter run.
Has anyone out here got a tutorial/guideline on how can I do this?
Thanks and cheers for your time!
Yours,
/D~
Answering myself as I've managed to do this:
As many internet tutorials show, just make your custom adapter implement Filterable and then create a custom Filter that satisfies your criteria - there's plenty of internet tutorials for this, but I could prolly attach the code if someone needs it.
After that's done, all you need to do is call: adapter.getFilter().filter(yourControlString) from the button/spinner item.
yourControlString will basically tell your custom Filter what do you want to display and what you don't want to - you've to customize that on your CustomFilter. Again, this sounds harder than what it really is.

Categories

Resources