G
G
Gregary2014-07-18 11:20:56
Android
Gregary, 2014-07-18 11:20:56

How to make a menu in Android applications?

Hello. I am developing one of the first Android applications. Something like a city directory. There is a list (Museums, Parks, Attractions) In each of these lists there is another list. (Central Park, Culture Park, etc.). Then, by selecting the Park of Culture, the menu Description, photo, info, etc. appears. So. At this stage, for each of the menus, I make my own layout, and an adapter, as well as xml-with data-itemo's names. Thus, if I have three menus (Main-> Sub-menu-> Details), then I get three adapters that take information and supply it to the activity, as well as 3 + 3 + 3 = 9 layouto's I somehow confuse such a number files with such a small application. Is it possible to do something, if it is several menus consisting of lists (listView), then dynamically load the corresponding menu, depending on the selected element? Maybe some links, examples, patterns?
6270a75671e241c1b66d23fc2fb1842b.png
At the moment, for the first menu, I have an XML file that stores data in this form

<?xml version="1.0" encoding="utf-8"?>
<Menu>
    <mainMenuData>
        <id>1</id>
        <itemName>Туры</itemName>
        <icon>tours</icon>
    </mainMenuData>
    <mainMenuData>
        <id>2</id>
        <itemName>Музеи</itemName>
        <icon>museums</icon>
    </mainMenuData>
    <mainMenuData>
        <id>3</id>
        <itemName>Достопримечательности</itemName>
        <icon>monuments</icon>
    </mainMenuData>
</Menu>

And I use Binder for the first menu, inherited from BaseAdapter in order to take data from the XML file and create a list of the given elements. Accordingly, for the second menu (List of tours), I have the same XML file containing the name of the tours. And for him, I also use a binder, but a different one, and so on for all menus and submenus. Is it possible to somehow use the same layout depending on the activity, but load different data into it? PS layoutov is also a lot now - for each menu.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question