I want to create widget which will show some information divided into categories. I came with idea to use ExpandableListView in my widget. Is is possible? If yes - how to do this?
Yes, this is possible. you need to extend BaseExpandableListViewAdapter and implement the methods in it. You also need to make the layout xml files for whatever you want to show and specify this to the adapter or inflate it yourself if you have more than one.
A good example is http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/view/ExpandableList1.html which is where the expandable list is the whole activity on the screen but if you extend it like how i said in a seperate file and include a ExpandableListView in your activity that will work as well.
Related
Within my layout I have set a Include Other Layout. this layout schould in his turn show a listview with items loaded from the web (my webserver)
the only problem is: the items don't load in because the class that holds the code to load the items isnt called on because im using a Include Other Layout meaning only the layout is called and not the functional code from any .java files (classes)
leaving me with a blank page...
is there a way to make a call upon the class containing the code for the layout i have included?
<include/> tag is only for including only the view into another layout. It can be very useful if you use a common view everywhere. A ProgressBar can be an example. You can include ProgressBar everywhere you want. But it is just a UI.
If you also want the functionality you should use Fragments. Actually Fragments are exactly for what you describe.
Here is the tutorial from Android Developers official website
http://developer.android.com/training/basics/fragments/index.html
I am learning android development and i am kinda stuck here. I want to create a friend list screen like shown in this picture.
What kind of activity should i use? Is there any available resources similar to what i want to achieve?
Thanks!
you can use ListActivity , also check out tutorials on lists, for example:
http://www.androidhive.info/2011/10/android-listview-tutorial/
http://www.vogella.com/tutorials/AndroidListView/article.html
you can find mire tutorials on google.
also you can use a regular Activity class with listView in the layout file
Use list view and custom adapter to populate the list view...
Listview should extend to the bottom but limit it just above the Type a name edit text and button.
Custom list view should contain linear layout horizontal in that include checkbox, Textview and Button
For type a name and Add use linear layout horizontal
Use listView with custom adapter , for array use arrayList<,friends,> sure you have to create friends class, in xml file put ListView then below that button and TextView
In my Android APP I have this ListView where I wish that each item is divided in two parts and it could be swiped. I wonder what should be the best way of doing that since the SlidingDrawer is now deprecated (and is not swippable). I need it to be an easy way to implement and few stress to mobile processor.
The content would be different in each item so I need to be able to access the TextViews inside them.
This is the example I wish to the item od the ListView:
The user could Swipe between both fragments and check its contents.
Any idea, advice or tutorial on this matter? Thank you very much for your attention
Use a ViewPager. Really easy to use, just extend a FragmentPagerAdapter to create the fragments to swipe between.
Let's say I've got a whole interface with some Layouts, View-Objects and stuff and now I want to write a java method that adds a pop-up error message over all this layouts to the front.
I know that there is the possibility to add it to an existing layout (e.g. main_layout) this way:
main_layout.addView(error_layout);
But is there maybe a way to put it just independent from the other layouts on the interface?
Something like
UInterface.addView(error_layout);
?
This should give you the root layout of your activity
getWindow().getDecorView().findViewById(android.R.id.content)
I am working on an Android project where a group of buttons needs to show on the bottom of every screen (activity) in the application. The group of buttons are basically a navigation bar. I want to know the best way to do this without creating new buttons for every activity. I have been around programming (C++/C#) for many years but am pretty new to Android and Java so if someone can point me in a general direction, it would be appreciated.
Thanks.
I bet you need to use "include" tag for xml layouts. It's the best when you need to reuse some UI components. See http://www.curious-creature.org/2009/02/25/android-layout-trick-2-include-to-reuse/ for the examples and description.
To elaborate on Konstantin's answer, after you've used include, you'll need to bind actions to these buttons.
If the buttons should have the same action regardless of the activity they are in, use the include tag to create their layout and then create a parent NavigationActivity (or whatever else you want to call it) class from which all your other activites will inherits.
In the parent NavigationActivity class' onCreate method, you can set up the onClickListener (and other needed stuff) for the buttons.