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

Content Page Secondary Toolbar Items in iOS same as Android

$
0
0

I am using secondary toolbar items in my content page. I want the same menu items in iOS as in android. By default it is showing under navigation bar. How can I achieve this.


Insert row in UITableView at given section

$
0
0

I'm pretty sure this worked before I installed latest stable xamarin.ios (11.8.0.20).

var indexPath = new NSIndexPath[] { NSIndexPath.Create(1, row) };

TableView.BeginUpdated();
TableView.InsertRows(indexPath, UITableViewRowAnimation.Fade);
TableView.EndUpdates();

The problem is that the row is always inserted in section 0, even though

System.Diagnostics.Debug.WriteLine(indexPath[0].Section)

outputs 1.

Convert Uri to Bitmap

$
0
0

I'm trying to get the image from the gallery, its a success, but I also want to convert URI to base64String. But I guess to achieve that, I need to convert it first to bitmap then to Base64string.

How to convert Image from Gallery (URI) to Bitmap?

Unable to load any project in VS15.6.1

$
0
0

None of my existing projects load in VS15.6.1 , I am seeing it reported everywhere.
Anyone found a workaround/solution yet ?

My App crash on Android 8

$
0
0

Hello,
My app crash on a Huawei Mate 10 Pro working with Android 8.
But I have not this mobile, how to test it ?
Thank you,
cjacquel

UIScrollView - Where is "scrollViewDidScroll" method?

$
0
0

Hi,
I have a UIScrollView with paging enabled. My intent is to do some operation when the UIScrollView finish to scroll to the next page.
Searching on Google I found that there is this method: "scrollViewDidScroll". But I cannot find it in the UIScrollView or in the UIScrollViewDelegate.
How I can call this method?

Thanks a lot.

Regards.

Marco

How can I change the BackgroundColor for the first ListView's Item automatically?

$
0
0

How can I change the BackgroundColor for the first ListView's Item automatically? Because when I open the application, I'm on the first Item's Page. I want automatically selection for the first item.

Deployment on the appstore - I don't get it...

$
0
0

I have an issue with deploying my iOS app. Here is my setup:
Visuals studio 2017 Enterprise on Mac

I followed the instructions to create an archived version of my app. I signed it with an "Appstore distribution" provisioning profile.
The application Loader then opens and I enter my email, my password and I get the error "Please sign in with an app-specific password...."

So I created an app-specific password, but when I enter it with my email I get the error "Your Apple ID or password was entered incorrectly"

Now I am staring at my screen completely confused.

I am not enrolled in the Developer Program, could that be the source of the problem ? (my account is kinked to my company's account which is enrolled)
Is there any other tool that I could use to deploy ?


Zebra EMDK: barcode scanning crashes in debug with Xamarin 4.9.0.749

$
0
0

I have a barcode scanning application built in Xamarin.Android using the Zebra EMDK. Under Xamarin 4.9.0.749, it crashes 100% reproducibly at or near a call to scanner.Read():

03-09 13:27:43.043 F/        (21460): * Assertion at /Users/builder/jenkins/workspace/xamarin-android-d15-6/xamarin-android/external/mono/mono/metadata/threads.c:3016, condition `internal' not met
03-09 13:27:43.043 F/libc    (21460): Fatal signal 6 (SIGABRT), code -6 in tid 21532 (Thread-1255)

This only happens when running in the debugger; release builds work fine. I see the same problem on various platforms including TC70X, TC75X and WT6000.

This is a regression; the same code worked fine (in both release and debug modes) with prior Xamarin versions.

I am using Microsoft Visual Studio Professional 2015, Version 14.0.25431.01 Update 3, with Xamarin.Android SDK 8.2.0.15.

The problem can be easily re-created using the Zebra sample application.

Steps to recreate:
1. Open solution.
2. Change build mode from "Release" to "Debug".
3. Clean solution.
4. Build solution.
5. Connect target device via USB cable. Ensure USB debugging is enabled and that your target device model appears next to the "Run" in the toolbar.
6. Launch application in debugger.
7. When UI appears, check "continuous" box, then press "Start" button.
8. Press and release scan trigger a few times. (Two is usually enough. Ten always is.)

Additional information:

The same crash happens regardless of the specific version of Symbol.XamarinEMDK I link against. I've tried it with the default that comes with the sample app (2.4.0.87) as well as the latest pre-release EMDK in a NuGet package (2.7.0.76), plus some 2.5.x and 2.6.x intermediate versions.

It also doesn't seem to matter what target framework I use. The sample app default (Android 4.4 KitKat) exhibits the problem, as does Android 8.1 Oreo.

Android Highlight and Background Color of a Cell

$
0
0

So I'm trying to theme the background color of a cell. And keep a long press highlight on the item.

I've themed the highlight with the style.xml:

<style name="MyTheme" parent="MyTheme.Base">
<style name="MyTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar">
    <item name="android:colorPressedHighlight">@color/ListViewSelected</item>
    <item name="android:colorLongPressedHighlight">@color/ListViewHighlighted</item>
    <item name="android:colorFocusedHighlight">@color/ListViewSelected</item>
    <item name="android:colorActivatedHighlight">@color/ListViewSelected</item>
    <item name="android:activatedBackgroundIndicator">@color/ListViewSelected</item>
</style>
<color name="ListViewSelected">#96BCE3</color>
<color name="ListViewHighlighted">#4BA398</color>

Which gives this output:

I have coloured the add cell white below with the following code:

public class AddCellRenderer : ViewCellRenderer
{
    protected override Android.Views.View GetCellCore(Xamarin.Forms.Cell item, Android.Views.View convertView, Android.Views.ViewGroup parent, Android.Content.Context context)
    {
        var result = base.GetCellCore(item, convertView, parent, context);
        result.SetBackgroundColor(Android.Graphics.Color.White);
        return result;
    }
}

When I color the cell above via the same code, it works but the highlight color must be behind it, as then it doesn't show.

Does anyone know how do I get background color of a cell working with a long press highlight color on Android?

Check a control property in Ui-Test?

$
0
0

I want to check the 'ItemSource' property of a 'ListView' element in a Ui-Test.

var ItemSourceOfmyListView = App.Query(e => e.Marked("MyListView").Invoke("ItemsSource"));

The ListView has the AutomationId "MyListView". The element will be found. But the method "Invoke" seems to work only for methods not for properties.

Is there another way to access a properties of an element in a Ui-test???

Thanks in advance :)

No resource found that matches the given name "Theme.AppCompat.Light"

$
0
0

Hi Xamarinians

I have upgraded the support library packages to v23. After that I am getting this error in the style.xml files

Error APT0000: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.DarkActionBar'. (APT0000)

Here is my style file

  <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
    <item name="windowNoTitle">true</item>
....

I have to go back to the older version, any idea why is this happening?

Thank you

How could I resolve java.lang.NoSuchMethodError issue?

$
0
0

Hello,

I'm working on project that use Xamarin.GooglePlayServices.Auth.
I have the following issue when try to signin with Google+:

[MonoDroid] UNHANDLED EXCEPTION:
[MonoDroid] Java.Lang.LinkageError: no non-static method "Lcom/google/android/gms/auth/api/signin/internal/zzc;.getSignInIntent(Lcom/google/android/gms/common/api/GoogleApiClient;)Landroid/content/Intent;"
[MonoDroid]   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () <0x9f659950 + 0x00035> in <filename unknown>:0 
[MonoDroid]   at Java.Interop.JniEnvironment+InstanceMethods.GetMethodID (JniObjectReference type, System.String name, System.String signature) <0xa04b39b0 + 0x0009c> in <filename unknown>:0 
[MonoDroid]   at Android.Runtime.JNIEnv.GetMethodID (IntPtr kls, System.String name, System.String signature) <0x9ef7fcb0 + 0x00059> in <filename unknown>:0 
[MonoDroid]   at Android.Gms.Auth.Api.SignIn.IGoogleSignInApiInvoker.GetSignInIntent (Android.Gms.Common.Apis.GoogleApiClient client) <0x9e708cd0 + 0x0004d> in <filename unknown>:0 
[MonoDroid]   at SafeShare.LoginActivity.GoogleLogin () <0xa050d070 + 0x0013b> in <filename unknown>:0 
[MonoDroid]   at SafeShare.LoginActivity.btnLoginWithGoogle_Click (System.Object sender, System.EventArgs e) <0xa050d040 + 0x0001d> in <filename unknown>:0 
[MonoDroid]   at Android.Views.View+IOnClickListenerImplementor.OnClick (Android.Views.View v) <0x9ef4fd30 + 0x0003e> in <filename unknown>:0 
[MonoDroid]   at Android.Views.View+IOnClickListenerInvoker.n_OnClick_Landroid_view_View_ (IntPtr jnienv, IntPtr native__this, IntPtr native_v) <0x9ef4fa70 + 0x00065> in <filename unknown>:0 
[MonoDroid]   at (wrapper dynamic-method) System.Object:7da7d48c-5430-4799-85ea-11ed356a68ea (intptr,intptr,intptr)
[MonoDroid]   --- End of managed Java.Lang.LinkageError stack trace ---
[MonoDroid] java.lang.NoSuchMethodError: no non-static method "Lcom/google/android/gms/auth/api/signin/internal/zzc;.getSignInIntent(Lcom/google/android/gms/common/api/GoogleApiClient;)Landroid/content/Intent;"
[MonoDroid]   at mono.android.view.View_OnClickListenerImplementor.n_onClick(Native Method)
[MonoDroid]   at mono.android.view.View_OnClickListenerImplementor.onClick(View_OnClickListenerImplementor.java:30)
[MonoDroid]   at android.view.View.performClick(View.java:4780)
[MonoDroid]   at android.view.View$PerformClick.run(View.java:19866)
[MonoDroid]   at android.os.Handler.handleCallback(Handler.java:739)
[MonoDroid]   at android.os.Handler.dispatchMessage(Handler.java:95)
[MonoDroid]   at android.os.Looper.loop(Looper.java:135)
[MonoDroid]   at android.app.ActivityThread.main(ActivityThread.java:5254)
[MonoDroid]   at java.lang.reflect.Method.invoke(Native Method)
[MonoDroid]   at java.lang.reflect.Method.invoke(Method.java:372)
[MonoDroid]   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
[MonoDroid]   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
[MonoDroid]   --- End of managed Java.Lang.LinkageError stack trace ---
[MonoDroid] java.lang.NoSuchMethodError: no non-static method "Lcom/google/android/gms/auth/api/signin/internal/zzc;.getSignInIntent(Lcom/google/android/gms/common/api/GoogleApiClient;)Landroid/content/Intent;"
[MonoDroid]   at mono.android.view.View_OnClickListenerImplementor.n_onClick(Native Method)
[MonoDroid]   at mono.android.view.View_OnClickListenerImplementor.onClick(View_OnClickListenerImplementor.java:30)
[MonoDroid]   at android.view.View.performClick(View.java:4780)
[MonoDroid]   at android.view.View$PerformClick.run(View.java:19866)
[MonoDroid]   at android.os.Handler.handleCallback(Handler.java:739)
[MonoDroid]   at android.os.Handler.dispatchMessage(Handler.java:95)
[MonoDroid]   at android.os.Looper.loop(Looper.java:135)
[MonoDroid]   at android.app.ActivityThread.main(ActivityThread.java:5254)
[MonoDroid]   at java.lang.reflect.Method.invoke(Native Method)
[MonoDroid]   at java.lang.reflect.Method.invoke(Method.java:372)
[MonoDroid]   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
[MonoDroid]   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)

It is very interesting that it happens only in Release mode. When this code called in Debug mode it works without any issues.

scroll bar for label if content is more than width in xamarin.mac application

$
0
0

i have NSscrollview but the scroll bar dont appear. the width of the label remains same regardless of its content. how to make the width of the label change according to its content and enable scrolling for the view. any help would be greatly appreciated.

ACR Speech Recognition Plugin for Xamarin & Windows


.NET Standard + Custom Renderer

$
0
0

Hi all,

I would like to ask if is it possible to have a custom renderer while using .NET Standard?
I am trying to upgrade my PCL to .NET Standard (due to the needs of some libraries of .net) however, seems like my custom renderers can't manage to find the reference to my .net standard library. So if it is possible, can I ask how can I do this? I appreciate all the help. Thanks!

Could not load assembly Xamarin.Android.Support.Fragment (Xamarin.Forms 2.5)

$
0
0

Hi,

I tried to upgrade to latest release of Xamarin.Forms v2.5.0.77107 (was before on v2.4.0.74863). It works properly for my iOS and shared projects but compilation fails for my Android project:

/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2,2): Error: Exception while loading assemblies: System.IO.FileNotFoundException: Could not load assembly 'Xamarin.Android.Support.Fragment, Version=1.0.0.0, Culture=neutral, PublicKeyToken='. Perhaps it doesn't exist in the Mono for Android profile?
File name: 'Xamarin.Android.Support.Fragment.dll'
  at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference reference, Mono.Cecil.ReaderParameters parameters) [0x00099] in /Users/builder/data/lanes/5147/c2a33d8e/source/xamarin-android/external/Java.Interop/src/Java.Interop.Tools.Cecil/Java.Interop.Tools.Cecil/DirectoryAssemblyResolver.cs:220 
  at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference reference) [0x00000] in /Users/builder/data/lanes/5147/c2a33d8e/source/xamarin-android/external/Java.Interop/src/Java.Interop.Tools.Cecil/Java.Interop.Tools.Cecil/DirectoryAssemblyResolver.cs:170 
  at Xamarin.Android.Tasks.ResolveAssemblies.AddAssemblyReferences (Java.Interop.Tools.Cecil.DirectoryAssemblyResolver resolver, System.Collections.Generic.ICollection`1[T] assemblies, Mono.Cecil.AssemblyDefinition assembly, System.Boolean topLevel) [0x0015c] in <593a6fd557984367bb21e275d0fa0659>:0 
  at Xamarin.Android.Tasks.ResolveAssemblies.Execute (Java.Interop.Tools.Cecil.DirectoryAssemblyResolver resolver) [0x0019c] in <593a6fd557984367bb21e275d0fa0659>:0  (LionsBase.Droid)

The Package section of my project does not have any reference to Xamarin.Android.Support.Fragment and if I try to add it manually, I get exception:

Could not install package 'Xamarin.Android.Support.Fragment 26.1.0.1'. You are trying to install this package into a project that targets 'MonoAndroid,Version=v6.0', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.

Tried to choose an older release (24 or so) and error is similar.

My project is targeting Android 5.0 (API level 21) up to Android 7.0 (API level 24).

Tried to raise the maximum to Android 7.1 (API level 25) but it does not help.

Background task even when the app is closed

$
0
0

Hi All,

i am building an Xamarin Forms App which retrieves location data from the device when its running as background service and when its connected to the server it would send the gps data to the server. The functionality of the app must not stop when the app is closed. Can you guys guide me through the process, or provide me some reference or sample code to do this. I am really struggling to make the app run in the background when its closed.

Regards,
Zak

Label FontSize OnPlatform - XAML error

$
0
0

Hey,

i have this code:

  <Label x:Name="questionGroupHintInfoLabel" FontAttributes="Bold"  Text="Folgende Hinweismeldung wurde für die aktuelle Fragengruppe hinterlegt:">
      <Label.FontSize>
        <OnPlatform x:TypeArguments="NamedSize"
                    iOS="Small"
                    Android="Small" />
      </Label.FontSize>
    </Label>

...and get this error:

No property, bindable property, or event found for 'FontSize

What i'm doing wrong?

Thanks.

Debugger operation failed

$
0
0

If any breakpoint is present in Android project the following exception can be seen at ide log:

System.ArgumentNullException: Value cannot be null.
Parameter name: instruction
at Mono.Cecil.Cil.InstructionOffset..ctor (Mono.Cecil.Cil.Instruction instruction) [0x00003] in <2e24b151dd8041d8b7d36a855bb53c66>:0

Does anybody have the same issue?

VS for Mac version 7.4 (1033)

Viewing all 204402 articles
Browse latest View live


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