I'm trying to make such an interface: so that the user would drop on the "Add" button, and an ImageView appeared in front of him - what ImageView he would click on, that one would be added to the previous Activity (where the "Add" button is located).

How to make the transfer ImageView from one activation to another, and at the same time the ability to save and clear the transferred ImageView ?

And how to make every new added ImageView lined up? An example of the interface can be seen in the screenshots.

enter image description here enter image description here

Closed due to the fact that it is necessary to reformulate the question so that it was possible to give an objectively correct answer by the participants pavlofff , Vladimir Glinskikh , Saidolim , tutankhamun , Nick Volynkin August 29 '15 at 6:24 .

The question gives rise to endless debates and discussions based not on knowledge, but on opinions. To get an answer, rephrase your question so that it can be given an unambiguously correct answer, or delete the question altogether. If the question can be reformulated according to the rules set out in the certificate , edit it .

  • You have here three questions in one, in a good way it should be three different questions. ) - Nick Volynkin

1 answer 1

First of all, ImageView is not sufficient here, since the data you display is heterogeneous (image, text) and some of them are dynamic (weight and repetitions may vary). Here we need a more complex organization of data, for example, a class-model. In addition, the selected workouts are likely to be saved between runs, so as not to re-enter everything every time - a database is needed here.

Since the question is very general and I don’t have the desire to write your program for you, we will limit ourselves to the general recommendations on the organization of such functionality:

  1. It is necessary to create a database in which to organize a table with all possible exercises. It will contain the id each exercise, the id image and the text describing the exercise (short and full) - this table is permanent and does not change.
  2. You need to create another table with the currently selected exercises. It will dynamically change depending on the user's choice and will contain exercise id and current weight and repetitions parameters.
  3. Now you need to write a class for interacting with the database, which will give all the records from the second table and include the data from the first one, as well as allow you to add delete and modify them. For the convenience of work, the class should give the data in the form of a model object, which at the output will contain: image id , workout name, given weight and number of repetitions. All this is packaged in some kind of container, for example the ArrayList collection.
  4. Now you need to write an adapter, which, according to the data obtained in paragraph 3 of the collection containing the model classes, will fill in the list.
  5. Create your own markup for each item (item). Specify the placement of images and texts.
  6. In the first activity, we place widgets to display the prepared data: add / edit buttons and ListView to display a list of workouts.
  7. The first activation logic is arranged in such a way that through the adapter of item 4, to the ListView with the items created in item 5, the list of table 2 converted to the desired type by the class from item 3.
  8. The second activation logic is designed to add to the table 2 the selected item from table 1 (the exercise itself) and the data about the repetitions and weight.
  9. All the highlights.

In more detail to answer your question in the form that it is designed now will not work, since it is necessary to write the whole program for you. Begin to do and ask SPECIFIC questions on problems, but not general on the organization and logic of work, then the help will be substantive.