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

Android Binding: Class is not abstract and does not override abstract method

$
0
0

I am building my binding project and I am getting 12 warnings and 0 errors. These are all my warnings.

Warnings:

/Users/gannonEllefsonTech/Desktop/SamsungDigitalHealth/SamsungDigitalHealth/SamsungDigitalHealth.csproj (Build) ->
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Bindings.targets (GenerateBindings target) ->

    BINDINGSGENERATOR:  warning BG8900: Type com.samsung.android.sdk.healthdata.HealthData: FxDG naming violation: Type name 'HealthData' matches namespace part 'Healthdata'.
    BINDINGSGENERATOR:  warning BG8800: Unknown parameter type com.samsung.android.sdk.internal.healthdata.r<T> in method A in managed type Com.Samsung.Android.Sdk.Internal.Healthdata.HealthResultReceiver
    BINDINGSGENERATOR:  warning BG8400: unexpected field type com.samsung.android.sdk.internal.database.e in method AggregateResult in managed type Com.Samsung.Android.Sdk.Internal.Database.BulkCursorDescriptor
    BINDINGSGENERATOR:  warning BG8C00: For type Com.Samsung.Android.Sdk.Healthdata.HealthDataService, base interface com.samsung.android.sdk.SsdkInterface does not exist.

/Users/gannonEllefsonTech/Desktop/SamsungDigitalHealth/SamsungDigitalHealth/SamsungDigitalHealth.csproj (Build) ->
/Library/Frameworks/Mono.framework/Versions/3.12.1/lib/mono/4.5/Microsoft.CSharp.Targets (CoreCompile target) ->

    obj/Release/generated/src/Com.Samsung.Android.Sdk.Healthdata.HealthDataResolver.cs(955,56): warning CS0108: `Com.Samsung.Android.Sdk.Healthdata.HealthDataResolver.AggregateResult.Creator' hides inherited member `Com.Samsung.Android.Sdk.Healthdata.HealthResultHolderBaseResult.Creator'. Use the new keyword if hiding was intended
    obj/Release/generated/src/Com.Samsung.Android.Sdk.Healthdata.HealthDataResolver.cs(2739,56): warning CS0108: `Com.Samsung.Android.Sdk.Healthdata.HealthDataResolver.ReadResult.Creator' hides inherited member `Com.Samsung.Android.Sdk.Healthdata.HealthResultHolderBaseResult.Creator'. Use the new keyword if hiding was intended
    obj/Release/generated/src/Com.Samsung.Android.Sdk.Healthdata.HealthPermissionManager.cs(132,56): warning CS0108: `Com.Samsung.Android.Sdk.Healthdata.HealthPermissionManager.PermissionResult.Creator' hides inherited member `Com.Samsung.Android.Sdk.Healthdata.HealthResultHolderBaseResult.Creator'. Use the new keyword if hiding was intended

When I add the dll as a reference to another project I get an error even if I am not using anything in the dll.

obj/Release/android/src/mono/com/samsung/android/sdk/healthdata/HealthResultHolder_ResultListenerImplementor.java(4,8): error :  error: HealthResultHolder_ResultListenerImplementor is not abstract and does not override abstract method onResult(BaseResult) in ResultListener
public class HealthResultHolder_ResultListenerImplementor

In my MetaData.xml file I currently have

<metadata>
  <attr path="/api/package[@name='com.samsung.android.sdk.healthdata']/interface[@name='HealthConstants.HeartRate']/field[@name='HEART_RATE']" name="name">SAMSUNG_HEART_RATE</attr>
  <attr path="/api/package[@name='com.samsung.android.sdk.healthdata']/interface[@name='HealthConstants.Weight']/field[@name='WEIGHT']" name="name">SAMSUNG_WEIGHT</attr>
</metadata>

Is there anything I can add to the metaData in the binding project to solve the error I am getting.

Thanks


Flexlayout Drag and drop`?

$
0
0

Does flexlayout have drag and drop feature? i have seen on twitter, somebody posted a video for that but i cant find information about it now.
or any view in xamarin forms 3.5 has this ability?

get Power fail/restart exceptions during Android native debugging

$
0
0

Hi! I got many "power fail/restart" exceptions on uncertain locations during native debugging. I guess what caused it is that I access sensors data by sensor manager. I can't show my code and I remove my all C++ code won't stop this. Can you tell what cause this exactly? How can I get through this?

Thanks a lot for your helping.

get Power fail/restart exceptions during Android native debugging

$
0
0

Hi! I got many "power fail/restart" exceptions on uncertain locations during native debugging. I guess what caused it is that I access sensors data by sensor manager. I can't show my code and I remove my all C++ code won't stop this. Can you tell what cause this exactly? How can I get through this?

Thanks a lot for your helping.

get Power fail/restart exceptions during Android native debugging

$
0
0

Hi! I got many "power fail/restart" exceptions on uncertain locations during native debugging. I guess what caused it is that I access sensors data by sensor manager. I can't show my code and I remove my all C++ code won't stop this. Can you tell what cause this exactly? How can I get through this?

Thanks a lot for your helping.

How to start out

$
0
0

I'm using VS 2017 Community. Xamarin is installed. I've created a few very tiny apps which sort of run. I'm used to creating C# native Windows apps. I build them and then run them. I do not know if my Xamarin experience is normal or due to something not right.

I'll create an app, like "Phoneword" from docs.microsoft.com/en-us/xamarin/xamarin-forms/get-started/hello-xamarin-forms/quickstart

It compiled. I am running the Android Device Manager (which I assume is required), Android_Accelerated_X86_Oreo.

Is that the "right one"? I don't know. Do I need ADB? I don't know.

So I built my PhoneWord app; the Android window appears but nothing happens. It's blank. I do this a few times and finally the app does come up. Is that normal? I mean, do these apps take a very long time to start up? I put a breakpoint on MainPage.xaml.cs InitializeComponent() and it's reached so that's hopeful. Anyway, after a few times the app does appear and, slow as it is, I can interact with it.

I built (based on developer.okta.com/blog/2018/01/10/build-app-for-ios-android-with-xamarin) HelloApp. That too worked but seems to be running outside of the VS environment.

The apps are very slow to come up. Is this normal? or due to components being out of date, perhaps? My computer has 8gB of memory.

BESIDES ALL THIS, What I am trying to do is port an app I have in WIndows (winforms app) to Android. It will have a few screens, no web portion at all. I am porting it so avoid the years-long rewrite of some central code.

Any pointers, references, recommendations, etc., are totally welcome.

RON

MvvmLight binding stops working on one of the directions. Binding edittext of textinputlayout.

$
0
0

Hello, I am having an issue with a binding that is killing me.

On my fragment I have

_viewModel.NameEntry = "test";
_bindings.Add(this.SetBinding(() => _viewModel.NameEntry, () => EditProfileTextInputLayout.EditText.Text, BindingMode.TwoWay));

When I open the "test" appears so it is working.

However, when I change the NameEntry on my viewmodel, the binding is not called and the UI is not updated.
I know the binding is still working because when I write on the edittext it triggers the NameEntry setter.

It is as if, apart from the initialization, the bindingmode.TwoWay does not work.

Anyone has any suggestions?

Could it be because the UI is on a "Gone" state?

Xamarin forms android splash screen appear when navigation.pushasync and navigation.popasync

$
0
0

style.xml

<? xml version="1.0" encoding="utf-8"? >
< resources >
< style name = "MainTheme" parent="MainTheme.Base" >
< /style >
< item name = "windowNoTitle"> true < /item >
< item name="windowActionBar">false< /item>
< item name = "colorPrimary">#2196F3< /item>
< item name="colorPrimaryDark">#1976D2< /item>
< item name = "colorAccent">#FF4081< /item>
< item name="windowActionModeOverlay">true
< item name = "android:datePickerDialogTheme" > @style / AppCompatDialogStyle </ item >
</ style>
< style name="AppCompatDialogStyle" parent="Theme.AppCompat.Light.Dialog" >
< item name = "colorAccent" >#FF4081< /item>
< /style>
< style name="MyTheme.Splash" parent="Theme.AppCompat.Light.NoActionBar" >
< item name = "android:windowBackground"> @drawable / Splash_background < / item>
</ style>
</ resources>

and

mainActivity class

[Activity(Label = "xxx", Icon = "@mipmap/icon", Theme = "@style/MyTheme.Splash", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation, ScreenOrientation = ScreenOrientation.Portrait, WindowSoftInputMode = SoftInput.AdjustResize)]
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
{

    public FirebaseAnalytics firebaseAnalytics;

    protected override void OnCreate(Bundle bundle)
    {
        TabLayoutResource = Resource.Layout.Tabbar;
        ToolbarResource = Resource.Layout.Toolbar;

        base.OnCreate(bundle);
        LoadApplication(new App());
    }

}

help me to resolve the issue


Xamarin.Forms (Android) - Spacing between TableSections

$
0
0

Is it possible to have a spacing between TableSections within a TableView on Android just like iOS did it?

Unable to share file using chooser intent and FileProvider

$
0
0

Hi I am currently having an issue when trying to share a file using a FileProvider.

In all but one test instance, the file is not available to the application selected from the chooser intent. Running the test, that was enable to attach the pdf document to an email, is now also failing.

Further to this, if Gmail is selected as the share destination and an email sent, the body of the email has appended to it, this is not in the value that is added to the intent with the ExtraText flag.

I have checked the file that is being tested, and it is a valid PDF file.

From stepping through the code I am able to see that the file is in the files/pdf directory on the device.

The canonical file path is:
/data/data/com.myapp.identity/files/pdf/testdocument.pdf.

The absolute file path is :
/data/user/0/com.myapp.identity/files/pdf/testdocument.pdf

The following is the contents of the providers file

<?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="...">
    <files-path name="pdfshare" path="./pdf" />
</paths>

The following is the method used for sharing the file.

public Task Show(string title, string message, string filePath)
{
    //  Create a Java file instance, to be used by the file provider and check that the file exists
    var pdfFile = new Java.IO.File(filePath);
    if (!pdfFile.Exists())
    {
        //  The file that is being shared does not exist so throw an exception
        throw new Exception("Unable to share file; File does not exist at specified path");
    }

    //  Get a URI for the file from the file provider to enable sharing
    var pdfUri = FileProvider.GetUriForFile(CrossCurrentActivity.Current.Activity, AUTHORITY, pdfFile);
    //  Get the mime type for the URI
    var mimeType = CrossCurrentActivity.Current.Activity.ContentResolver.GetType(pdfUri);
    //  Create the intent for the chooser with the required permissions
    var intent = new Intent();
    intent.SetAction(Intent.ActionSend);
    intent.AddFlags(ActivityFlags.GrantReadUriPermission);
    //  Add the PDF to the intent and set the mime type for the data
    intent.PutExtra(Intent.ExtraStream, pdfUri);
    intent.SetType(mimeType);
    //  Add the additional details to the intent, incase email is selected
    intent.PutExtra(Intent.ExtraSubject, title ?? SHARE_SUBJECT);
    intent.PutExtra(Intent.ExtraText, message ?? DEFAULT_TEXT);
    // Create and display the native chooser for the user to select an app from
    var chooserIntent = Intent.CreateChooser(intent, "Select App to share file");
    chooserIntent.SetFlags(ActivityFlags.ClearTop  | ActivityFlags.NewTask);
    CrossCurrentActivity.Current.Activity.StartActivity(chooserIntent);

    return Task.FromResult(true);
}

I am currently unable to determine why this code is failing to enable the file to be accessed by the selected application.

I also get the same result if I use ShareCompat.

Can anyone help?

Thank you.

Newbe question (Linking to a Visual Basic class library)

$
0
0

I want to develope a mobile application for my company using Xamarin.

I have got to grips with basics of Xamarin to the point at which and want to start using my companies standard routines for inter process communications (TCP/IP messages).

All of these standard routines are part of a visual basic class library. I have added a reference to the class library under "project" and I can access the routines in C++ code (e.g. "Produce.Send_message (type, Message);"

When I went to test to see is a message was sent, it initally said it could reference the visual basic runtime, add a NuGet package.

So I did, I found the Microsoft.VisualBasic NuGet runtime and installed that.

Now when I go to test the code, it just hangs and does nothing.

And now I'm stuck.

Before someone says just rewrite into C++ I should say there are a lot of routines coded in the class library that I will want to use (they are all tested and working exteremly well) so I really want to avoid rewriting it all into c++.

Can any one help me?

Xamarin.Forms reference not found.

$
0
0

Hi all!

does anyone know why VS2017 can not see the reference of Xamarin.Forms even it was installed? (See the attached pic)

Thanks!

Mabrouk.

Selection of multiple images from Gallery.(Xamarin forms)

$
0
0

Unable to select multiple images from android gallery. Please help.

Selection of multiple images from Gallery.(Xamarin forms)

$
0
0

Unable to select multiple images from android gallery.
I was able to perform multi select images from iOS using Dependency service, but in android i achieved multiple selection using native code to an extent, but there are certain gallery folders say, FILE MANAGER or SDCard and so on dint support multi selection of images.
Please help.

Xamarin.Android CI Builds on VSO

$
0
0

Anyone has success stories to share? I have my Xamarin.Android in VSO and I am trying to setup a build definition.

First I was getting this error
The specified solution configuration "Debug|BWS" is invalid. Please specify a valid solution configuration using the Configuration and Platform properties (e.g. MSBuild.exe Solution.sln /p:Configuration=Debug /p:Platform="Any CPU") or leave those properties blank to use the default solution configuration.

I resolved it and now I am getting this
The target "PackageForAndroid" does not exist in the project.

What am I missing? I am able to build the same SLN locally just fine.

Thanks in advance,
Pranav


ZXing.Net into standard .net 2.0 library and Xamarin application

$
0
0

Hi,
I'm new to Xamarin and this whole .NET, I,m starting a new project and I was creating .NET library 2.0 to put the commun code. I have a need to extract multiple barcode from an image and was using ZXing as demo on Window with full .NET Framework 4.7. Now I would like to port this to Xamarin and I'm having some trouble to integrate it into my library. Here's my project structure:

  • GF-Trace.Android (Xamarin Android)

    • Reference to:
      • GF-Trace
      • NuGet packages:
      • Xamarin.Forms
      • ZXing.Net
        * Android.*
  • GF-Trace (.Net Standard 2.0 lib)

    • Build Dependencies:

      • GF-Imaging
    • NuGet packages:

      • Xamarin.Forms
      • ZXing.Net
  • GF-Imaging (.Net Standard 2.0 lib)

    • NuGet packages:
      • Xamarin.Forms
      • ZXing.Net

I have some hard time to make it work properly. The compiler complain about missing reference.

Severity    Code    Description Project File    Line    Suppression State
Error       Can not resolve reference: `zxing`, referenced by `GF-Trace`. Please add a NuGet package or assembly reference for `zxing`, or remove the reference to `GF-Trace`.  GF-Trace.Android        

Under UWP, it does compile but when running I get a method missing exception error:

System.MissingMethodException
  Message=Method not found: 'ZXing.Result[] ZXing.BarcodeReader.DecodeMultiple(Byte[])'.
  Source=GF-Trace
  StackTrace:
   at GF_Trace.Views.XyMeasurementPage.ExtractQRCodeMessageFromImage(Byte[] bitmap) in ...\GF-Trace\GF-Trace\Views\Debug\XyMeasurementPage.xaml.cs:line 128
...

So I wonder how I should be doing this? GF-Imaging is a reusable lib that implement function to manipulate images and could do some processing to recover barcode with ZXing. GF-Trace is the common application library that also can use some ZXing types. GF-Trace.Android or GF-Trace.UWP consume the GF-Trace.

The ZXing.Net said it support .Net Standard 2.0 and Xamarin.Android. What is wrong or how does one ensure the function and lib are present for a given platform?

NOTE I did select ZXing.Net and not the mobile version because the image can come from different source and not only from the camera as stand still image. So I tried to avoid the ZXing.Net.Mobile which wrap all into a Form GUI.

Thanks, Maybe I'm doing something wrong into my setup, but I have no clue why it doesn't found the lib or the methods.

ScrollViewer vs. Enclosed, how to control who gets the MotionEvents?

$
0
0

I have a somewhat complicated design that has just slammed face first into reality.

I have an ImageView which shows a photo or other bitmap. I have a SketchCanvas which overlaps it, and the user can draw on it. The save functionality combines the bitmap in the ImageView and the Android.Graphics.Path 's that are created, so the user can basically annotate their images, circling the parts they care about and such.

This works great, but sometimes the image is too big for the screen. So I put it inside of a ScrollView. But doing this has caused a problem that was obvious in retrospect, but somehow made it through design.

The problem is, when the user drags their finger across the screen, what happens? Does it draw a line on the image, or does it pan the ScrollView? I have to pick one or the other.

So now I've added a button which is supposed to change whether you are in pan mode (where your finger controls the scrollviewer), and draw mode (where your finger draws lines on the image). My question is, how do I implement this in Android? That is, what is the hook that I should use to control whether the ScrollView or its children are handling the MotionEvent's that the user is creating?

How do I get the tabreselect event with tabbar at the bottom on android?

$
0
0

I'm trying to get an event firing when tab item of tabbedpage is reselected.

I've searched trough the forum and found that on Android, I need to create a customrenderer with

void TabLayout.IOnTabSelectedListener.OnTabReselected(TabLayout.Tab tab)
{
//do something
}

But it only triggered when the tabbar is on top.

If is set the tabbar placement to bottom with
On<Xamarin.Forms.PlatformConfiguration.Android>().SetToolbarPlacement(ToolbarPlacement.Bottom);
The "OnTabReselected" above won't be triggered.

So, how do I get the tabreselect event with tabbar at the bottom on android?

Thanks.

How to check device is in ideal state for some particular time.

$
0
0

Hello,
I want to check that in my application is device is in ideal state? means no activity perform in application.So how we can detect?

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!

Viewing all 204402 articles
Browse latest View live


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