Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all 91519 articles
Browse latest View live

How to STOP Device.StartTimer mid flow

$
0
0

Hi all,

I have a number of buttons on my UI. Each button is intended to have 2 functions - a short press function and a long press function. When the user simply selects the button method_one is called. I want to implement the ability for the user to be able to press and hold the button for 5 seconds and call method_two.

I have been trying to use button.released to call method_one and use button.pressed to call Device.StartTimer for 5 seconds and method_two - which works but I cant figure out how to stop the timer called by onPress once the button is released and vice versa. I always receive both the button.pressed return and button.released return.

Please help :(

This is a snippet of what I have so far. The button.pressed is called from the XAML file

[code]`

public void OnAdminButtonPressed(object sender, EventArgs e)
{

            Device.StartTimer(TimeSpan.FromMilliseconds(5000.0), () =>
            {
                DisplayAlert("pressed", "5 seconds", "ok");
                return false;

            });         

    }


    public void OnAdminButtonReleased(object sender, EventArgs e)
    {

            Device.StartTimer(TimeSpan.FromMilliseconds(500.0), () =>
            {
                DisplayAlert("Released", "Immmediately Hopefully", "ok");
                return false;

            });          

    }

`
[/code]


Recording - Twitch Workshop: Build Your First Mobile App with C#, Xamarin, and the Cloud

$
0
0

Hi,

I was hoping someone has a recording of the "Twitch Workshop: Build Your First Mobile App with C#, Xamarin, and the Cloud" from blog.xamarin.com?
It was hosted by Jame Montemagno.

Kind Regards

The case for .NET Standard in favour of shared project for Xamarin.Forms

$
0
0

There is a bunch of information online about using .NET Standard for your Xamarin.Forms app, but I'm still confused as to why you would want to use one over the other. The main sources I have read through/watched:
1. Sharing Code Overview (MS docs)
2. .NET Standard 2.0 Support in Xamarin.Forms
3. .NET Standard and Xamarin.Forms for the .NET Developer

My history is I've been a Xamarin developer since the Novell days. Since the introduction of Xamarin.Forms (1.5ish?) I've always used it for creating apps over Xamarin.iOS and Xamarin.Android directly. I've never created a Forms app with PCL, always shared library. One thing I've relied heavily on is the ability to just go:

#if __IOS__
    UIApplication.SharedApplication.StatusBarHidden = true;
#elif __ANDROID__
    // Other things.
#endif

Being able to do this in the Forms code directly has made things nice and easy. Another example I have used it is in in my own HTTP REST classes, and the ability to use cookie containers in certain ways that would work on both platforms (bugs that may have been resolved now). I now know that in the first example I could create a dependency service called StatusBarActions or something. The second example I know now not to re-invent the wheel and I could just use RestSharp. It's just that one of the listed benefits of using shared code is the ability to use those pre-processor directives.

Likewise two of the main pros of .NET Standard are "Allows you to share code across multiple projects." and "Refactoring operations always update all affected references.". But wouldn't this still be true for a shared Forms app?

Lately I was playing around with converting some smaller in progress apps to be .NET Standard Forms apps. I really enjoy the simplicity of having my main NuGet packages (Xamarin.Essentials, Json.NET, FFImageLoading, sqlite-net-pcl, etc) in the Forms project itself. Its really nice to be able to update all packages at once. The package list also stays nice and short, although I think that's more to do that it doesn't list all package dependencies as new packages. I also liked that it forced me to write cleaner code. Things were good... until I tried Xamarin.Forms on macOS.

Although it is still in preview one of the first things I found that out of the box Xamarin.Essentials was not having a bar of it. It's just one of many packages that may not be supported. It made me think of another project I am working on, Onewheel Community Edition App. It relies heavily on the Plugin.BLE NuGet package that doesn't support macOS or UWP. If I wanted to add either of those platforms I now have to add it via a dependency service or something similar. Alternatively if I used a shared project I could just have a

#if __IOS__ OR __ANDROID__ etc. 

I can see both being possible. One makes it easier when a core component is platform specific, but can also make it more of a pain in the case of Xamarin.Essentials when you may just want to use it to display the app version number.

So the real things I want to know are:

  • Is it worth it?
  • Are there any performance benefits of either?
  • Are there binary size or binary security differences that are worth noting.

What are other peoples experience with it shared vs .NET Standard. Are there some other programming paradigms that I am not thinking of to make .NET Standard apps make more sense?

Native linking failed error in xamarin for GoogleSign

$
0
0

I am following this tutorial for GoogleSign in my project. https://www.pujolsluis.com/google-client-plugin-for-xamarin/ .Works fine in android. But getting Native linking failed errors while rebuild in ios.

Native linking error: clang: error: no such file or directory: '/Users/cybasetechnologies/Library/Caches/Xamarin/mtbs/builds/login2.iOS/0f92dcc98e9717a0d2643ed70077af70/obj/iPhone/Debug/mtouch-cache/FirebaseInstanceID'
Native linking error: clang: error: no such file or directory: '/Users/cybasetechnologies/Library/Caches/Xamarin/mtbs/builds/login2.iOS/0f92dcc98e9717a0d2643ed70077af70/obj/iPhone/Debug/mtouch-cache/FirebaseNanoPB'
Native linking failed. Please review the build log.
Native linking error: clang: error: no such file or directory: '/Users/cybasetechnologies/Library/Caches/Xamarin/mtbs/builds/login2.iOS/0f92dcc98e9717a0d2643ed70077af70/obj/iPhone/Debug/mtouch-cache/FirebaseCoreDiagnostics'
Native linking error: clang: error: no such file or directory: '/Users/cybasetechnologies/Library/Caches/Xamarin/mtbs/builds/login2.iOS/0f92dcc98e9717a0d2643ed70077af70/obj/iPhone/Debug/mtouch-cache/FirebaseAnalytics'
Native linking error: clang: error: no such file or directory: '/Users/cybasetechnologies/Library/Caches/Xamarin/mtbs/builds/login2.iOS/0f92dcc98e9717a0d2643ed70077af70/obj/iPhone/Debug/mtouch-cache/GoogleSignIn'
Native linking error: clang: error: no such file or directory: '/Users/cybasetechnologies/Library/Caches/Xamarin/mtbs/builds/login2.iOS/0f92dcc98e9717a0d2643ed70077af70/obj/iPhone/Debug/mtouch-cache/FirebaseCore'

Deleted bin and obj folders in both mac and visualstudio; clean and rebuid; still error persists.Please help..

[UWP] Changing image on button causes flicker

$
0
0

I typically change images on a button from one image to another, like enabled image to disabled greyscale image. Both of these images are the same size. When the image changes on Android/iOS, no problem. But when the image changes on UWP, it looks like the entire widget hierarchy is recalculated and redrawn causing a horrible flicker. I can understand this if the images were different sizes, but they aren't. Anybody experience this issue on UWP and have a good workaround?

publish app to win store

Google's Read SMS Permission

$
0
0

Have any one checked on how to use the auto retriever api from google in Xamarin.Forms PCL app? because now we cannot use the read sms permission to auto fetch the otp. So is there any help upon this?

WebView/HybridWebView Context Menu

$
0
0

Is there any way to show the context menu? especially ios.
do you have an idea or sample? can you please share?

Thanks


how to open image in webview in xamarin forms

$
0
0

i am using xamarin forms i want to display image in webview for android any help ? its urgent

What is equivalent to LayerDrawable.SetLayerInsetRight in versions before 23?

$
0
0

I am developing custom renderer for android and using LayerDrawable.SetLayerInsetRight method and works fine but that method is added in API level 23 and I am wondering what is equivalent to it in versions before 23?

HotReload LiveReload LiveXaml [Mac] [Windows] [nuget package] [opensource]

What is equivalent to Android.Widget.ListView.NestedScrollingEnabled in versions before 21?

$
0
0

I am developing custom renderer for android to enable the nested scrolling for a ListView and I'm using Android.Widget.ListView.NestedScrollingEnabled attribute and it works fine but that attribute is added in API level 21 and I am wondering what is equivalent to it in versions before 21?

Responsive UI, Ripple animation, ImageButton, Tapable layout etc.

$
0
0

Hi all,

Responsive UI in xamarin forms - there is an easy way to achieve it!

On touch you can change:
Background image
Background color (animated or not)
Opacity (animated or not)
Scale (animated or not)

Ripple animation is supported

https://github.com/AndreiMisiukevich/TouchEffect (good documentation is there)

TouchView | TouchImage | TouchFadeView | TouchColorView package

$
0
0

Hi all, let me introduce new plugin for Xamarin.Forms development.

https://github.com/AndreiMisiukevich/TouchEffect

This plugin allows developers to create UI-responsive controls/layouts with touch effect (fade control, change image source, change background color)

I will appreciate any feedback)

ExpandableView nuget package


Custom context menu for ViewCell

FFImageLoading Plugin

$
0
0

Hi , I had use this plugin with my app downloading many photos from my web to the app phone, its works perfect.
My question is if I put all that photos in my resources folder its will work ok?? or maybe I will have a memory collapse ,, ?? the photos I have compressed to 45 kb each one, and I want to use my app out of internet.
But I've read that using the resource folder too much is not a good practice..

Where is my database

$
0
0

I am using VS 2017 Xamarin Forms with SQLite.

My database path is: /data/user/0/com.companyname.QRep/files/.local/share/QRepDB.db3

I am having trouble inserting a record. On the simple tables it works fine but on the more complex table (21 fields) the insert fails with no error message. I would like to inspect the database using SSMS but cannot locate it on mt machine.

Any help will be appreciated.

How to create a camera app in xamarin app

$
0
0

Suggest best ways to create a camera app, and best plugins available for using cama in xamarin forms cross platform app

Using RelativeLayout.BoundsConstraint?

$
0
0

Hi,
Any documentation on how to use RelativeLayout.BoundsConstraint, the official doc doesn't mention anything about it!

Viewing all 91519 articles
Browse latest View live