How to create history of all pdf file clicked by user? - android

This is what I want for my app
I am stuck at passing my recycler view to the recent tab or you can say history tab...
I have created the pdf app in android studio everything is working fine but the problem that i m facing is i dont know how to add the same recycler view item from one tab(docs tab) to other tab(history) whenever i click on my pdf file.
I want to replace the file in history tab if already present in history list and add it to the 0 position of the history tab.

You have two options:
1- To basically just always show one recyclerView but update the items sorting whenever the top buttons are clicked.
2- To load 2 fragments for each tab which both have the same items but different sorting.
None of them are really hard especially 2. Just do a basic tab layout (lots of tutorials for it on YouTube) and in each fragment just use a different sorting function. For doing 1, you should use DiffUtils to update your list beautifully and fast.
Although I am not sure which part you are having a hard time with. Doing two tabs, updating the recyclerView, or remembering which files were opened last?!

Related

Android Studio Dinamically add a new Section

I'm a beginner in Android development and I'm stucked in a way to dinamically add or remove a new Section.
The image below shows the way I want to do it. If I press the + button then a new item is created and I can insert the info about the item. If i press the - button then it will delete the item.
I don't want to make the items to be fixed. I need the user to insert as many items as they want to.
For dynamic views I suggest RecyclerView, which is more flexible than ListView and provide basic animations by default (proper calls on adapter - notifyItemInserted, notifyItemRemoved).
Here is an example.

how can i add and remove elements of a listView?

Hi guys im making my first android app, it has 4 fragments, inside one of those fragmentes a listView is gonna be displayed, and i need to give the option of adding and removing every element of the listView to the user (every element of the list view is supposed to link to a unique fragment that has some information regarding to it) , so where should i save the elements of the listView?
thanks very much.
im using java (android studio)

two listviews in fragment?

I'm new to android development, and I have doubts about working with fragments.
I have to build an App that runs 2 ListViews on the same screen, but the list on the right depends on what I select in the list on the left. I've looked through all the tutorials and samples about the working with Fragments, and I haven't found a way to do that succesfully.
Hey refer this link and follow the example explained there. In the example given you have listfragment and when clicked on an Item, details will be changed. So You implement another listfragment which will display items upon selection of first listview instead of Details.

How to show 3 parts in one single view in android tablet?

My application for android tablet contains 3 parts in one single view.
Listview items
On Click of list that contained in first part the second list items is shown in second part.
On Click of list that contained in second part the detils of each list should be shown in third part.
How to achieve this?Can Any anyone help me with some examples.
add one ListView and two fragments into Activity . Both Fragments will have their own Life Cycle .

Simple List & List using Database Values

i need some suggestions first,
My application is like, on main screen a user clicks the image button "Courses" and navigates to a list, with three items, when user touches any item, he moves into another "List view" that pick up values from the database, and then if a user clicks on any item of second list,will be navigated to final view or a webview..
suggestion i need is, is it a nice practice to navigate a user from list to another list, in a
application..
and in Iphone application they make back button to each view,(as they dont have a back button on iphone) but in many android applications i didn;t seen back button in list view layout, do i need to have a back button on the top of the list view ?
Second question i have is, do i really have to make a Database for a list,
i have to make atleast 6 or 7 Lists in my application, with some list having values nearly 16
Ad. 1: No, you don't need back button in list view. It's real back button in all android devices.
Ad. 2: No. But when data are changing or you want to perform complex queries then database is preferred. In case of not changable data use xml. In case of simple data you can even use shared preferences.
Here is short guide to android data storage:
http://developer.android.com/guide/topics/data/data-storage.html
Here is simple tutorial to use hardcoded data with listview:
http://developer.android.com/resources/tutorials/views/hello-listview.html
I have a few comments on these:
1) The application might end up having a complex navigation to achieve simple tasks if there are multiple levels of lists. Consider using a Tab layout instead of the first level list, since you mentioned there are only 3 entries in the first list. Also try to consolidate your menus so that user can view options upfront
2) Back button: IMHO in android you should only implement it iff you want to override the default behaviour of the back button.
3) Database for a list: Totally depends on whether you want to change the lists once the app is installed. If they are static then you dont need to build it from the database

Categories

Resources