I'm trying to create a mobile app in xamarin in c# for ios using the google maps api
When you click a marker, the title appears, but when you click it again the title goes away. Is there any way to keep the title from disappearing on the second click?
I want the double click to change the content of the title, but I can't display the info if the title disappears.
Ive been playing around with different combinations of setting mapview.SelectedMarker = marker when I detect a second click on the same marker, but it won't work and I can't find any answers online.
Any help would be appreciated, thanks.
This seems to be working if anybody is having the same problem.
mapView.TappedMarker = (map, marker) => {
//Change the title
mapView.SelectedMarker = null;
return false;
}
Related
Summary
I have a Xamarin application which creates a GoogleApiClient and calls EnableAutoManage. When my app runs, I am asked which user account to use, and then the app hangs on a blank popup page with a Google-themed spinner. Why is this happening?
Details
I have been following this video which shows how to set up an application's to read Google Fit data. Notice the timestamp - this is where the code is presented.
https://youtu.be/j_zsNxMI6jI?t=2172
I have followed the examples here, and have narrowed the problem to this piece of code:
// In my MainActivity's OnCreate:
try
{
int defaultClientId = 0;
googleApiClient = new GoogleApiClient.Builder(this)
.AddApi(FitnessClass.HISTORY_API)
.AddApi(FitnessClass.RECORDING_API)
.AddScope(FitnessClass.ScopeActivityRead)
.EnableAutoManage(this, defaultClientId,
result =>
{
int m = 3; // Breakpoint here is never hit
})
.Build();
}
catch (Exception e)
{
int m = 3; // Breakpoint here is never hit either
}
If I run my app (tried on both emulator and physical hardware), I am first asked which account to use.
After selecting the account, another popup appears with a Google-themed (changing between red, yellow, green, and blue) spinner at the top. The popup stays on screen and the spinner animates indefinitely.
As noted in the code above, no exceptions are raised, and no result is returned in the EnableAutoManage delegate. Why is this happening?
Update 1
If I remove the following line, the app no longer shows a spinner indefinitely:
.AddScope(FitnessClass.ScopeActivityRead)
The addition of this line of code seems to be the cause of the popup with the spinner.
Update 2
I thought I'd try the "new" approach of using GoogleApi rather than GoogleApiClient as explained here:
https://android-developers.googleblog.com/2017/11/moving-past-googleapiclient_21.html
Unfortunately, there seem to be no Xamarin bindings for this yet:
Xamarin Android: Cannot resolve GoogleSignIn and GoogleSignInClient
The reason this happened is because my google account hadn't yet been added as a test user. One might expect that Google would provide some kind of useful feedback through a popup, but instead it provided an empty page.
To solve this problem:
Go to https://console.cloud.google.com/apis/dashboard
Click on OAuth consent screen
Scroll down to the Test Users section
Enter the email addresses of the test users you would like to use testing your app (such as your own personal gmail)
Now the app should properly display a confirmation page.
I'm trying to change the app title dynamically in a Win 10 UWP app using the code below. The colors change but the title won't change. Any suggestions?
public AppShell()
{
this.InitializeComponent();
var appTitle = ApplicationView.GetForCurrentView().Title;
appTitle = house.Name;
var appTitleBar = ApplicationView.GetForCurrentView().TitleBar;
appTitleBar.BackgroundColor = Colors.LightBlue;
appTitleBar.ButtonBackgroundColor = Colors.LightBlue;
appTitleBar.ButtonForegroundColor = Colors.Black;
...
}
Current accepted answer modifies the View title, not the App title. That appears to be good enough for the OP but if you want to actually change the App Title for a UWP app, here's what you do.
Open your package manifest and navigate to the "Application" tab. You'll see the app's display name like so,
Then just change the "Display name:" field to whatever you want your custom app title to be, then re-build and you're good to go, like below,
Try this:
var appView = Windows.UI.ViewManagement.ApplicationView.GetForCurrentView();
appView.Title = "Your title...";
Is there a way to open Bing maps that are inbuilt to Windows phone on click of a button. If you have used the Foresquare app, it loads bing maps and show the destination latitude and longitude when you click the directions button. I want to do the exact same thing. Please help me with any resource you have.
Until now I tried the code in this link
https://msdn.microsoft.com/library/windows/apps/jj710324%28v=vs.105%29.aspx
Problem is when I click the button it says do you want to search an app in the appstore. Please help.
You have to use BingMapsDirectionsTask like this (just replace latitude and longitude with yours):
BingMapsDirectionsTask bingMapsDirectionsTask = new BingMapsDirectionsTask();
GeoCoordinate spaceNeedleLocation = new GeoCoordinate(47.6204,-122.3493);
LabeledMapLocation spaceNeedleLML = new LabeledMapLocation("Space Needle", spaceNeedleLocation);
bingMapsDirectionsTask.End = spaceNeedleLML;
bingMapsDirectionsTask.Show();
You can reed more here about Bind Maps directions task.
I Have Created a Simple form in which i have added Adobe Reader from toolbox using steps
right click in toolbox - Choose Items
choose COM Components tab and there "Adobe PDF Reader"
Now Drag&Drop the Adobe PDF Reader Control into an UserControl
I have successfully added this, opened up a pdf file also. Now it automatically provides with vertical scrollbars for scrolling through the pdf document.
What i want to achieve is instead of using the given scrollbars or mouse to scroll, i want to use a button to scroll scroll the pdf, So there will be two buttons, One for Scroll Up And the other for scroll down.
I have gone through many forums, pages, etc. Havnt found anythn that i could use.
I have Tried Simulating key presses with
SendKeys.Send("{DOWN}");
But as i press the button, the focus is lost on the adobe reader so it doesnt work
Pls help me... I have spent almost half a day searchin for a solution
given that you have provided only a simple piece of code you have tried, i am going to try offer you a generic solution - where you will need to replace the specified variables:
button names
your web app name
as for first of the focus you need to specify where it will be, something along the lines of:
var pFocus = webapplication.formname.pdf_document.focus();
// or webapplication.focus(pdf_document);
again i am just writing this as an ideal layout as i have said you will need to replace the listed variables for this to work and possibly tweak the focus code as i haven't tested that - the buttons however provided you insert your variable names will work as i have tested these:
var buttonAction = ((IJavaScriptExecutor)webapplication).ExecuteScript("window.scrollTo(0, document.body.scrollHeight - 5)");
var buttonAction_2 = ((IJavaScriptExecutor)webapplication).ExecuteScript("window.scrollTo(0, document.body.scrollHeight 0)");
//button action will scroll to x co-ordinate 0(far left), y co-ordinate( 5px from bottom)
//buttonAction_2 will return you to the very top left of page, you can edit these values to mess around and try different settings.
so altogether it should look somewhat similar to (if you are using a method for the click just insert the code under there:
var pFocus = webapplication.formname.pdf_document.focus();
if (button.click = true)
webapplication = pFocus;
var buttonAction = ((IJavaScriptExecutor)webapplication).ExecuteScript("window.scrollTo(0, document.body.scrollHeight - 5)");
pFocus.execute(buttonAction);
then for button 2
var pFocus = webapplication.formname.pdf_document.focus();
if (button_2.click = true)
webapplication = pFocus;
var buttonAction_2 = ((IJavaScriptExecutor)webapplication).ExecuteScript("window.scrollTo(0, document.body.scrollHeight 0)");
pFocus.execute(buttonAction_2);
hope this helps to some extent.
I am developing a browser app for Windows Phone 8. I want to detect the scroll position, so that I can show the address bar only when user is at top of the page. I also want to restore the current scroll position after a page refresh.
I cannot inject javascript into the page because obviously the content is from all over the web.
So far I am able to determine if user is scrolling up or down based on this idea.
If I can inject javascript, I probably could use InvokeScript and detect if page scroll is at the very top
window.onscroll = function(ev)
{
var B= document.body; //IE 'quirks'
var D= document.documentElement; //IE with doctype
D= (D.clientHeight)? D: B;
if (D.scrollTop == 0)
{
alert("top");
}
};
DEMO
So I wonder if anyone has any suggestion to achieve this. Thanks.
EDIT
Is it possible to use IFRAME and place my javascript there while the external websites are loaded inside the IFRAME?