Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all 204402 articles
Browse latest View live

Xamarin forms: Hide Flowlistview item including it's space from UI based on a string value.

$
0
0

I am using flowlistview for listing images. I need to hide the image if pageStatus value is OFF and show the image if pageStatus value is ON. I tried like below:

In model:

public string pageStatus { get; set; }
public bool pictureStatus
        {
            get
            {
                if (pageStatus == "OFF")
                    return false;
                else
                    return true;
            }
        }

In XAML added IsVisible="{Binding pictureStatus}" for the image. The images are not showing in the UI but blank spaces are showing for OFF status pictures like below.

enter image description here

I need to remove that blank space also from the UI, how can I do that?


How can we apply MVVM pattern in xamarin.android step by step

$
0
0

How can we apply MVVM pattern in xamarin.android step by step

is there a way to call function from appdelgate?

$
0
0

i dont know if this question difficult or not, but i want to call function from appdelgate to xamarin form, can someone help me figure it out?

Xamarin Forms upload/download files to Google Drive

$
0
0

Hi,

Pardon the ignorance but I am new to XF and am trying to wrap my head around this.

I had asked a previous question on uploading a file to OneDrive through my XF app. I got it to work and will post a solution.

The problem I am now facing is doing the same thing but for GoogleDrive. I have read much on how to do this and it seems very cumbersome. Has anyone successfully done this and if so is there a sample project any where.

After searching the web I did create a Drive API at console.developers.google.com

In my XF app I did this:

private static async Task SignInToGoogleDrive()
{
string[] Scopes = { DriveService.Scope.DriveReadonly, DriveService.Scope.DriveFile };

        GoogleWebAuthorizationBroker.Folder = "Google.Apis.Util.Store.FileDataStore";
        UserCredential credential;

        try
        {
            using (var stream = new FileStream(App.GoogleJsonFilePath, FileMode.Open, FileAccess.Read))
            {
                credential = await GoogleWebAuthorizationBroker.AuthorizeAsync(
                    GoogleClientSecrets.Load(stream).Secrets, 
                    Scopes, "user", 
                    CancellationToken.None
                    );                   
            }

            // Create the service.
            var service = new DriveService(new Google.Apis.Services.BaseClientService.Initializer()
            {
                HttpClientInitializer = credential,
                ApplicationName = "GarageMaster",
            });

            // Define parameters of request.
            FilesResource.ListRequest listRequest = service.Files.List();
            listRequest.PageSize = 10;
            listRequest.Fields = "nextPageToken, files(id, name)";

            // List files.
            IList<Google.Apis.Drive.v3.Data.File> files = listRequest.Execute()
                .Files;
        }
        catch (Exception ex)
        {
            int testStop = 0;
        }

        int testStop1 = 0;
    }

I followed, what I think is correct, from the Google Api examples, and created a json file. I put it in my project and load it as a stream. That is what, in the above code, App.GoogleJsonFilePath is.

Now to be quite honest, I really don't know what this line does:

GoogleWebAuthorizationBroker.Folder = "Google.Apis.Util.Store.FileDataStore";

so I am going about this a bit blindly.

The above does compile, but when it gets to this line,
credential = await GoogleWebAuthorizationBroker.AuthorizeAsync(…..

flow goes to the Catch statement and the error is:

ex = {System.NotSupportedException: Failed to launch browser with "https://accounts.google.com/o/oauth2/v2/auth?access_type=offline&response_type=code&client_id=6181........

I really don't know where to go from this point and any help would be appreciated.

Thanks.

How to wrap in complex word boundaries, such as: '/command'

$
0
0

I have set LineBreakMode to WordWrap. I have commands, words which start with '/', (for example: '/help'). If there is no more place in a row word is divided such as '/' stays in one row and other part of the word goes to the second row.
For example:

What I have:

bla bla bla /
command

What I want:

bla bla bla
/command

What should I do?

Setting the resource file I want to use (not using localization)

$
0
0

Hello there!

I read about you can use .resx resource files automatically according the Localization of the App, so if you have MyData.en.resx and MyData.es.resx, it will use one or another according if the device language is set as englis or spanish.

I wonder if I can use something like that, in order to set if my WebApi must use one or another SQL scripts, for example, SQL Server or Oracle SQL sentences, according to some preprocessor directive, global variable or programm parameter.
As far as I look for information, all the data I get is for using them with Localization.

Thank you!

When publishing for Android, how to avoid Upload failed You uploaded an APK that is not zip aligned?

$
0
0

When uploading an APK using Google Play Developer Console, I am getting the following error:

"UPLOAD NEW APK TO ALPHA
Upload failed
You uploaded an APK that is not zip aligned. You will need to run a zip align tool on your APK and upload it again."

Whilst I'm sure I could work out how to fix this using Java SDK tools, I'm curious as to why it is happening. Subject to having to skip bits like Dobfuscator as they're too expensive for me, I'm pretty confident that I followed the instructions at
https://developer.xamarin.com/guides/android/deployment,_testing,_and_metrics/publishing_an_application/
correctly, using Visual Studio 2015.

(if I deliver the APK to a device directly and install it, it works fine - Google Play Developer Console clearly checks some extra bits).

Any thoughts as to how to tweak configuration to make this work smoothly would be much appreciated :-)

is there a way to check lockscreen enable or not?

$
0
0

hello everyone.
i need to make a project that can detect if password are being set or not on android in form of true or false.
can someone help me figure it out?
thank you


Asymmetric encryption using keystore with fingerprint authentication

$
0
0

Hello,
For my project I try to create a private and public key on keystore and keychain. But I would like protect the access of the keys with fingerprint authentification.

I find a lot example to create keys. Unfortunately I can't add link in this post ..
I didn't find any example for protect my keys with authentification. Do you have some information about that ?

Moreover, I hear that it's possible on native Android to unlock key when the user unlock the smartphone (scheme, pin or fingerprint). Do you know if it's possible with Xamarin ?

Thanks for your answer ;)

iOS : ToolbarItems not displaying on root navigation page

$
0
0

Hello all,

I got three toolbaritems in my app which display everywhere on Android.
Prob is on iOS it only shows on pages which are pushed in the navigationPage. When I'm on the root page of the navigation page, they don't display. How to force iOS to show them even if I'm on the root of the navigationPage ?

Thanks.

     var toolbarItem = new ToolbarItem
            {
                Order = ToolbarItemOrder.Secondary,
                Priority = 0,
                Text = "Help"
            };
            var toolbarItem2 = new ToolbarItem
            {
                Order = ToolbarItemOrder.Secondary,
                Priority = 1,
                Text = "Support"
            };
            var homeToolBar = new ToolbarItem
            {
                Order = ToolbarItemOrder.Primary,
                Priority = 0,
                Icon = "ic_home_black_18dp"
            };

AOT + LLVM - API Level 4

$
0
0

I'm trying to use AOT + LLVM on my Xamarin.Forms project but I keep getting an error:
Platform library directory for target Arm and API Level 4 was not found. Expected path is "C:\Program Files (x86)\Android\android-sdk\ndk-bundle\platforms\android-4\arch-arm\usr\lib"

The ndk is downloaded and there are loads of platforms in the ndk platforms folder but I can't see how to get it for "android-4".

Can anyone point me in the direction of the ndk platform 4 folder?

Problem with using Add when trying to add a class to a list

$
0
0

Hi,

I've had a problem with a simple bit of code. When a button is clicked an activity should be added to a list of activities. The code is below, I don't understand why it does not add it when it is so simple, i'm probably missing something very obvious?? Thanks in advance

`namespace serialiser
{
public partial class MainPage : ContentPage
{
public MainPage()
{
InitializeComponent();
}

    public void Serialiser(object sender, EventArgs args)
    {
        SelfCare selfCare = new SelfCare();

        // add activities
        var myActivity1 = new Activity()
        {
            Category = "Fitness",
            ActivityDescription = "Boxing class",
        };

        selfCare.Activities.Add(myActivity1);
    }

    public class SelfCare
    {
        public List<Activity> Activities { get; set; }

        public SelfCare()
        {
            Activities = new List<Activity>();
        }
    }

    public class Activity
    {
        public String ActivityDescription { get; set; }
        public String Category { get; set; }
    }
}

}
`

Sharapie tool does not generate C# code properly.

$
0
0

Hi Folks,

I want to print receipts using EPSON TM-T88V thermal POS printer through mobile on Android and iOS platform.
For Android, I downloaded EPSON SDK from here.
For iOS, I downloaded it from here.

Epson SDK for android contains two .jar files named ePOS2.jar and ePOSEasySelect.jar and two libraries with extension .so named libepos2.so and libeposeasyselect.so which were referenced to Xamarin.Android project successfully, printing receipts on android went well.

For iOS, I refereed this walk-through on Xamarin documentation.

I used the following command to generate the c# files where my header and binary files were located:

sharpie bind --output=ePOS --namespace=ePOS --sdk=iphoneos12.0 *.h -scope ePOS

The generated files have too many syntax errors, which I don't know how to resolve at the moment. Below is the Structs.cs file with errors like "Identifier expected".

public struct
{
    [FieldOffset(0)]
    public long double __f;

    [FieldOffset(0)]
    public ulong __u;
}

Kindly help, and suggest whether I'm going in right direction.

Xamarin IPA file with Exe file which increase the App size

$
0
0

Recently I generated an IPA file using the Visual Studio (Xamarin).
when I extract the IPA file -> Show Package content. I see there is an appName.IOS.exe file, which is 84MB of size.
This increase the overall app size. Meaning is Exe file is treated as a document from IOS device.

How to build an IPA without this Exe file?

Your inputs are appreciated. Thanks.

Linking to a library

$
0
0

I have compiled a C library and I can load the appropriate .so file. However I'm getting EntryPointNotFoundExceptions and I'm pretty sure it's because the compiled library has been output in two parts. There's a small .so and a larger .a. So it looks like NDK Build has only created a 'shim' .so. Looking at the files with a hex editor tends to confirm this as the .a has no strings associated with the library.

Does anyone know how to either make NDK Build emit a single file, or else how I can make use of the .a files (each platform has one of course).


WatchConnectivity, Session, Watch iPhone

$
0
0

I am trying to implement communication between WatchExtension and iOS App. I would like every time I press the UI button on Apple Wach to follow the method on the iOS application side (regardless of whether the application is in the background or in the foreground).

Will you help me find an example of such communication?

How to open PDF or TXT file in default app on Xamarin Forms

$
0
0

I am going to open document using default app in Xamarin Forms. I tried already this approach but it doesn't work for me and I am not sure what is the reason.

Device.OpenUri(new Uri(FILE_PATH));

Please give me great solution if anyone knows how to handle it. Thanks.

How to change the colour of the SVG image at run time

$
0
0

I am trying to change the colour of the svg image at run time. I have a svg file and by using FFImageLoading I am able to display that image.But I want to change the selected part of colour. Here is the image I am displaying, when I taps on head the colour should be changed.

Can such a functionality added in Xamarin.forms?

How to trigger a upload complete event when files is uploaded in aws s3 server?

$
0
0

I need to get notified when the upload is complete. Can someone help me?

Right now I'm using this code to upload
await s3Client.UploadObjectFromFilePathAsync(bucketName, uploadFileName, filePathName, null);

Xamarin.Form How do i get the count of items from a folder? and the name of the items?

$
0
0

I have

Project 1 Default for the other platforms
Folder

  • Images
    • 1.jpg
    • 2.jpg

Project 2 Android
Folder

  • Images
    • 1.jpg
    • 2.jpg

Project 3 iOS
Folder

  • Images
    • 1.jpg
    • 2.jpg

PART 1

If i want to count the number of items in the Images folder
how do i do it?
Can i do it in the default, with embedded images
or do i need to do it with platform specific logic. if so how.

numbers of items: 2

PART 2
And when i can count the numbers of items in the folder, and how can i take out there names.

names
List list = new List();
foreach() {

list.add(x); // 1.jpg 2.jpg

}

Viewing all 204402 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>