I have 4 fragments and attaching to single grid adapter how to check from which fragment it is coming.
Related
I am using 3 fragment in viewpager and try to communicate between all fragments(send data)
I am using 3 fragment in viewpager and try to communicate between all fragments(send data)
There are a number of different ways to share data between fragments, I like using a shared view model, the different ways are outlined in https://androidwave.com/passing-data-between-fragments/
I have a problem. I'm building an Android app. I created a Tabbed Activity with Android Studio. I have 3 tabs. I created 3 classes java with their relative xml. In first tab I take data from internet with Jsoup and i put these data in 2 ArrayList. I want to pass these ArrayList to tab2 and tab3 to avoid downloading again these data.
How can i do? I tried with bundle and getter/setter but I have not been successful
The solution is to be make that ArrayList as static one. Once you got the required data in fragment A then assign that data into ArrayList. Now you can easily access from anywhere.
I've read a lot of things about restoring data in FragmentActivity but nothing works in my case. I tried a lot of methods to do it but it never worked.
I have a FragmentActivity containing a ViewPager with 6 or 7 fragments. These fragments are containing each one a ListView. The datas in these ListView have been retrieved from web.
I can select an item of the ListView in a fragment to open an new activity showing the detail of the selected item.
When i go back to my FragmentActivity i don't want to retrieve a new time datas from web, but getting it from a bundle or whatever allowing me to display data instantly.
I tried getLast(Custom)NonconfigurationInstance() but it is only called when a real configuration has been changed (such as screen orientation). I also tried onSavedInstanceState in FragmentActivity, in Fragment, whith and without calling the super method... I always get a null savedInstanceState bundle in my onCreate/onCreateView.
I don't have piece of code for you because i go back to zero.
Any ideas please ?
Okay i found a solution but i hate it ! anyway...
When i select an item in the list of my fragment, i put the data i want to restore in the ActivityA with a custom Class that implements Serializable, and i close ActivityA. ActivityB is launching. when i close ActivityB, i put the data iwant to restore in ActivityA. I check if my data are not null (it can be null if i don't come from ActivityB), and if they aren't, i can populate my fragments and my lists without network connection.
It's a very bad way to solve my problem, but i have really no idea why the "savedInstanceState" methods are not working in this case.
I am building a sample Spring WebFlow application and wanted to get some inputs on how the handle the below scenario.
I have 2 pages, the first page is a form where the user inputs data and the second page just displays the data the user entered in the previous page. The first page has a 'discard' and a 'continue' link and the second page just has the edit link which takes the user to the first screen so as to make edits on the data.
The scenario I am testing is..the user enters data, hits the continue link, the validators(Spring/WebFlow validators) are executed and the second page is displayed with the data (correct data). Now the user hits the edit link, changes a field on the first page, hits the continue link, the validators are executed and a error message(ex. user entered an invalid email address in the email field which is define as String in the model object) is shown on the same page (first page). Now the user hits the discard link and goes to the second page where the data is displayed. Now since the validations on the first page failed, the data displayed is not the correct one (shows the invalid email address).
Appreciate if some one can help me with displaying the old data (correct data) once the user hits the discard link since the data/model is not persisted anywhere.
If you're on a view-state with a model and you take a transition with bind="true" (the default), the model object is changed for that snapshot. That is, once you "continue", you've updated the object.
I don't know if you could track and return the user to a previous snapshot. If not, you'd need to retain a "backup" object and manually restore that one in the code attached to "discard".
I am using shared object to share data between two users. First user connect to shared object and set some value in shared object. Please consider that second user has not connected with the shared object yet.
Now when second user connects to the server and try to get that property set by first user, he could get shared object but could not get properties of Shared object set by first user. I observed few times that Second user can get these properties within "Sync" event between two users. But I would like to get these values for Second user in any stage (i.e. in load event etc.). Whenever Second user tries to get the property of Shared object, the object will reset the actual property value and then return reset value.
Anyone faced such issue while using shared object between two users. If so, I would appreciate if you could let me know your suggestions for following questions:
1) Is there any way to get all the properties of shared object before sync event called, as I want to get it immediately when second user connect to the application and perform next task based on the values stored in shared object.
2) Is it possible for second user to check whether any property has been set by first user? So that second user can use the property instead of reset it.
Give you a citation from adobe docs:
"The SharedObject class is used to read and store limited amounts of data on a user's computer or on a server.(...)To use remote shared objects, you need Adobe Flash Media Server"
Do you have a server that supports that technology?