I'm having a bit of awkwardness in App Inventor and lists.
I had hoped to generate a list for a user entered value.
For eample - a text box the user enters Book title, publication year, author, and ISBN.
I would like to create a list with the ISBN as list number.
How feasible/practical is this?
Add items x,y,z to (previously non-existent) ISBN list does not work.
I'm currently trying a working around with empty lists List1, List2, etc that are filled sequentlially but this is less than ideal.
This is very feasible/practical. You have to use 2 lists: listISBN which stores your ISBN and another list, let's call it listDetails which stores sublists of the detail data. To save the data, use two add items to list blocks, see screenshot:
To select the items from your lists, use the same list index together with select list item blocks.
More about lists here, also see chapter 19 here
Related
I'm in the middle of making my first Android app and have been asked to make an app that displays information on books. I currently have a login screen which brings me to a new page of buttons with different genres. When you click on a genre it brings you to a listview of books in that genre, you then click on a book and it should display information on that book.
My main issue is, I have made a lot a activities already and I'm wondering if I'm going about this the wrong way? When I get to displaying information on each of the books that will be clicked inside of my listview, do I then have to make a new activity for each or is there a better way to do this that I seem to be missing?
Try the following pattern:
Create your first activity for Login (i.e LoginActivity.class)
Create your second activity that contains your genres (i.e GenresActivity.class)
Create your third activity that contains a list of books in that particular genre - remember this will be reused for all genres because it is simply a list of items. (Have you heard of RecyclerView instead of a ListView?)
Create your 4th activity for details of a book (i.e BookDetails.class) - this will also be reused each time to display a book's information. The caveat would be to have the same structure/layout used because a book object has the same information like title, author, year and perhaps cost. So, when a user clicks a book from a list, you want to direct them to a details view where they can view more information on that particular book!
That brings you to 4 activities - not too many if you think about it.
I hope this helps! Good luck!
II would like to create a scrollable list of items that can be sorted according to different criteria that can be chosen by the user from the action bar; I was thinking of a button that says:"Sort by...". I am working on an Android app.
I am developing a tourist guide, or rather, making an app out of a paper tourist guide I have previously written, thus I have a list of monuments through which the user can browse.
It would be great if the user could sort the items of the list in alphabetical order, or according to the rating of the monuments or on the basis of a tag indicating their type (historical building, museum, etc.).
Would it be even possible to display under the name of each item, like a sort of subtitle, a series of dots or stars indicating the above-mentioned rating?
At last but not the least, would it be possible, only when the monuments are sorted by name or rating, to automatically group them by another tag?
Like in some song player apps, when you choose an artist, you get all of his/her songs displayed often grouped by album. In my case the grouping tag would represent the zone in the city of the monuments.
Despite my experience in publishing, I am a newbie in Android (followed just a few courses) and the API docs made me very agoraphobic about coding. I know I am asking much so I don't demand a detailed explanation but a few suggestions about what could be a solution, a bunch of helpful guidelines and some names of specific API docs about Array Lists and sorting methods I should look at.
Thanks already for your help.
Firstly, you need to have a custom Java Object for a particular item
for example:
public class CustomItem{
private String Name;
private int Rating;
private String Tag;
// getters and setters
}
Then you can create a Listview with Input consisting of a List of type CustomItem. Here is a good ListView tutorial: http://www.vogella.com/tutorials/AndroidListView/article.html
You can then have somethibng like a Spinner, in which you can add the sort criteria. When the user selects one sort criteria, you can sort the Input List for the ListView and refresh the listview by doing: listView.getAdapter().notifyDataSetChanged();
Hope this helps.
I have a scenario here.I am developing a housing app in which the Complex owners can post announcements and flat owners can see it.I am using webservice.The complex owner can add a new announcement(which I am saving in my server) and the flat owners can see those announcements(I am binding the announcements headers into a list view through json parsing and on-clicking a header a full message will be displayed).
Now the problem is in case of new announcements.I want to distinguish between the readed and unreaded messages(just like in our mail).So how can I determine which listview item is clicked or which item is not clicked??And also how can I give them different colors(i.e. to mark an item unreaded or not clicked ??)
Any help will be appreciated.
Save all announcements in a table locally in sqlite. Add a column to contain the read unread flag.
While populating the list read from the table and load considering the flag.
I have a small issue with ArrayList. I have to fetch the document from the server.
The document contains 7 fields of data. I have to show the document names in the list view.
For this I have added different fields data to the different ArrayList. So when I click on the document name, based on the position of the document, I fetched the all fields data from the different Arraylist based on the position.
But Have a small issue using by using the above procedure. Is there any procedure that is not depend on the position, what I want is irrespective of position if I click on the Document,based on the keyword document data to be extract.
Any Help Appreciated.
Thanks in Advance.
I got your point. If you try to manage different ArrayLists then it would be difficult to manage it. I mean if you delete item from particular position from particular ArrayList then you will have to delete items from same position from other ArrayList, if you forgot to do so then it will be unbalanced.
Solution:
Instead feasible solution is to create ArrayList<Object> or ArrayList<HashMap<String,String>>, so your every item is the type of particular object, and every object contains detail and everything of particular items.
For example: ArrayList<Documents>, here ArrayList will contains list of Documents objects, and every objects contains values of 7 fields.
Its simply easy to define Documents class with getter/setter attributes.
I have an android app which displays quotes and have navigation to go to next quote and so on. would like to add "Save Quote As favourite" based on users selection of particular quote.
Once user saves Fav quotes and wants to see those quotes only, app should show those quotes.
Currently app reads the quotes from XML file. Let me know if any more information is required to understand the problem.
I would provide every quote with an ID (int). Whenever the user selects a quote to be a favourite, that ID is saved to a Set of integers. Later on if user decides to show favourites, you fetch all quotes with your IDs from the Set and show them in a appropriate view, for example a ListView
If you have a Quote class or something like that, you might as well put them in a collection whenever user decide his favourites, and show them in a ListView with a custom adapter.