In my application I am using fragment tab-host with view pager and I am opening child fragment inside each tab.
Every time I switch tab data get reloaded every time and one of the tab contains Google map, in Google map added markers programmatically but every time I switch tab it doubles the markers on map e.g. if I have added 10 markers for first time after switching once it get 20 and so on.
I have used this code to open child fragment
Used fragment page adapter with view pager
So please tellme how to stop reloading fragment.
This happens because each fragment has a lifecycle (http://developer.android.com/guide/components/fragments.html), and when you switch tab data the fragment is destroyed and another is created.
You are using fragments with view pager and this is controlled by a Parent Activity, so you can move the code to load the map to the Activity, and just use the fragment to display the data stored inside the activity.
You can get the parent activity with this code inside your fragment:
(YourActivity) this.getActivity();
Related
Is there a way to create a custom menu item so that it is present every time you open the application? For example, every time I open a new google doc the menu item appears so that I can run my script in any and every document rather than only in the original "container" document.
Currently I have a sample which I'm working on which is a basic master details page. This sample uses react-router-redux. Within the details panel I have a number of tabs which use can see different facets of the selected item... all fairly standard stuff.
When the user selects an item from the master list, the URL that the clicked <Link ... /> send them to is something like customer/123. Within the route that is registered for that url (i.e. :id), I have an indexRoute route which replacess the route to default route/tab /customer/${nextState.params.id}/address.
All this works well and the user can navigate between tabs just fine. The problem comes when the user closes the detail window and selects a different detail. As expected, it opens the tab based on the route specified by the indexRoute. Under normal circumstances, this might be fine but I want it to remember which route was selected. I'm wondering if anyone has ideas on how this should be done?
I think I can do achieve this by registering a callback with the onClick event of the Link and dispatching an event which will result in key of the selected tab being saved in the store. Then within the onEnter of the indexRoute I can access the store and pull out this saved state and target the replace to this that item.
This should work but seems like a lot, just wondering if this seems right to other?
I would use the same approach - dispatch an action when the tab is clicked and store the tab key in the store.
Use mapStateToProps to retrieve the value.
I am having a problem with a UI that I am building in a Google Spreadsheet. I will First explain a little about how it works and than I will get to the problem. The UI is fairly simple program that connects to a SQL database, it allows users to create new records, Query, search, and render reports. I have created all the panels (eg the intro page, the create record) in the GUI builder. As the user navigates through the UI I swap out a Grid with the new panel that i want the user to see. For example on the intro page there is a create button when the user clicks the button the gird where there intro panel was is replaced by the create record panel. I have created two ways for the user query/search for data. The first way is to select a number range on the intro panel and click the Query button. This will than query the last 10 or so records into a GUI built Panel that I will call MainForm. The second way is to "search" for a job. On the intro page there is a search button when the user clicks with button it goes to a new page; the grid is switched to the search panel. On the new page/panel the user can put in some parameters to search for. After the user clicks the search button the program should load the search results into the MainForm in the same way as when you Query from the intro page. I have taken the whole function apart line by line, so i am sure that the issue has to do with loading the panel/Component. What i mean by that is these few lines of code.
var Component = app.loadComponent("MainForm");
var panel = app.createVerticalPanel().setSize("770px", "900px").add(Component);
app.getElementById("contentGrid").setWidget(0,0, panel);
But why would it load in one case, but not in another? Also it is not the method of loading the Component, rather it is the returning the panel/ Component.
To Summarize, When I load the Component with the query function it works, but when i load the Component in the search function I get and error: Incompatible type passed in as a parameter. Also I load the MainForm Component in two other functions as and it works most of the time, but some times I get the same error.
I think your approach is not ideal, load component is not supposed to be called multiple times. It would be far more efficient to get all your panels in the same compnent and play with visibility of each panel to show / hide them on demand. Each panel should be inserted in a vertical panel so that the "new panel" slips to its place when the "old one" hides.
An example of this approach is shown in this post to simulate tabs and could easily be adapted to your needs.
btw, this method is also very fast and responsive since the full UI is ready from the very beginning ;-)
Please give me an advice on chrome extension API. I'm trying to write a code that would do the same thing like when I highlight all the tabs in chrome, click the right button on them and choose reload, so all the tabs get reloaded together at once. I have no problems with highlighting the tabs, but how can I apply some operation to those highlighted tabs ?
Applying operations on a set of tabs requires passing the tab ID(s) to the respective methods in the chrome.tabs API.
So, in your case, simply remember the tab IDs of the tabs you highlighted programmatically (or use chrome.tabs.query to fetch them) and call chrome.tabs.reload sequentially, passing a single tab ID per invocation. (Unfortunately, the API does not accept an array of IDs, so you'll have to pass them one by one.)
hi am using Google map in my project like store locator. there are 2 pages where one selects the store in first and page and the map is populated in second page now i want to display selected one on load of page by default.
if you want to show a map with a marker to locate the selected store then here are the demos create a logic to check which store is selected the redirect to another page and call the function with parameter that sets the center on users selected store