I have an application "app_a" which contains a fragment ("fragment_a") with a RecyclerView to show content. The content is from database of "app_a". There may be some buttons on each RecyclerView item, click these buttons will modify some database value of "app_a".
I would like to show same content on another application "app_b" without duplicated code. Tap buttons on RecyclerView item in "app_b" will also modify database value of "app_a". Can anyone give me some suggestions to do this?
Thanks.
Related
I am working on a "users" activity that show online users in a chat application, to show them I am using a ListView and every item contains the profil photo, the name and an extra textview about the online user.I am storing images in FirebaseStorage.
the problem is that when I scroll the items aren't stable and some images of other users are shown in the wrong item, and I have to wait around 2 seconds until the view becomes stable.
what if I used RecyclerView ? will it change and solve this issue ? I need your suggestions.
thanks in advance.
Whenever you scroll up and down, these views are getting re-drawed with wrong options so always specify both if-else conditions cause listview doesn't know the previous state/conditions/values of our widgets.
I am trying to create a fragment and inside that i want to create multiple textviews whoose text is set from the data retreived from the database(mysql).
And also i want to have the feature "refresh" by which the textviews are updated with recent data from the database.Iam trying to do that but iam not getting enough idea how to do it as iam new to android programming.
Please help me with this. thank you in advance and any suggestions are acceptable.
i.e
I have database of a person and i want to get his name and address from that,then in my activity i want to create a fragment that displays a name and address in separate textboxes and if address or name exceeds some length then i can press "more" to see left information
Consider using a ListView to populate data from the database, and a SwiperRefreshLayout to refresh it. Check these links for more info :
SwipeRefreshLayout
ListViews
The answer depends on what your app will do.
If you have a fixed number of TextViews, and the number won't change in the future or depending on the answer to the database query, you could simply stick to normal TextViews; if the number changes, I suggest using ListViews or ExpandableListViews.
Regarding the layout, you can create a normal layout using AndroidStudio's layout designer, and then inflate it to your view.
For the refresh, you can add a button that calls the method in which you fill the textviews/listviews.
Actually your question is too broad: if you want a more specific answer, you should edit it asking what you really need.
Now I’m designing the UI for my first Android Application. I just wanted to confirm if what I grasped and design choice is rightly done.
The requirement is, I need to display a list of Images+Data on the home page, it might run into hundreds. It also contains a search header. + category selection on thetop.
Clicking on the menu button must side the panel of links for Menu/Config.
I learnt, doing nested layouts are closer to evil in Android. So I did not put multiple one into the other. I’ve put a simplified one.
I have shared what I’ve designed for this requirement. Any word of concern/recommendation would be highly appreciated.
SlidingPaneLayout is the root element of MainActivity.
Bottom View contains list of menus
Top view diplays list of Images
Top view has the following elements
Title Layout : which is basically a RelativeLayout, holds Title name, burger icon and search button
Image ListView : displays list of images from local memory
Sub Category Layout : which is again a RelativeLayout. This displays the sub-category of the image displayed in the Image listview. This will change when user scrolls. Taping on this will display a sub-category listview.
Search bar Layout : which is a RelativeLayout. This has a drop down suggestion listview, which displays suggestions.
Key Questions
Should search be put in a separate activity?
Should search be put in a separate View/Fragment?
Is there any way the layouts can be reduced or replaced with better layout?
1-2/ The ListView should be put in a separate fragment and the search should have its own also. The search view fragment should be open on press of the search icon. You have listeners for opening and collapsing the search field. The idea is to change fragment only in the host activity. Each fragment should implement its own logic.
3/ For sure don't use ListView when you are going to have hundres of items. Instead use the RecyclerView that recycles and reuses the views. ListView will be okay for the left drawer menu as its going to implement static number of elements that won't need recycling.
I am working on a shopping list app, and in one activity I need show many shopping list that I want use expandable/collapsible headers. Also, I want to strike out item by left swipe and delete item by right swipe.
I am looking for some ListView that can do this.
I tried to use StickyListHeaders lib with swipe layout but it works incorrectly (white spaces after deleting).
Anybody can help me?
Maybe you need to update your adapter content and call notifyDataSetChanged() to refresh your data and remove the empty space.
I need to create a UI that allows the user to rearrange its elements and store the configuration of that arrangement somewhere. And when the user opens the application the UI would load as the user arranged it.
Just like you would rearrange the icons and widgets on the homescreen. Is there a tutorial for that? What approach would you suggest?
Thanks
This question is farly near rearranging items on a ListView. You should check this question:
reordering of listview items by drag and drop using android