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

Starting an activity outside of activity context

$
0
0

Kind of stuck here. I'm trying to call StartActivityForResult(Intent x, int y) in class 'Z' that does not implement an activity class, hence I cannot call this.StartActivityForResult(x,y). I'm trying to pass x and y to a method in MainActivity to call StartActivityForResult there, however I cannot use "this" inside a a static method, and the function needs to be static in order for me to see the method from a different class. Does anyone have any suggestions on how I can start the activity from Z?


Turn off recording of user location

$
0
0

Is there a config item to stop the recording of the location of "Identified" users? Or one planned on the product roadmap?

How to fix Error: Tool exited with code: 1. Output: unknown output extension:

$
0
0

Updated to latest stable Xamarin Studio, Android, Xcode etc. Created a blank Xamarin Forms App using the wizard, get the following error when built:

/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets: Error: Tool exited with code: 1. Output: unknown output extension: obj/Debug/android/bin
usage:
dx --dex [--debug] [--verbose] [--positions=] [--no-locals]
[--no-optimize] [--statistics] [--[no-]optimize-list=] [--no-strict]
[--keep-classes] [--output=] [--dump-to=] [--dump-width=]
[--dump-method=[*]] [--verbose-dump] [--no-files] [--core-library]
[--num-threads=] [--incremental] [--force-jumbo]
[.class | .{zip,jar,apk} | ] ...
Convert a set of classfiles into a dex file, optionally embedded in a
jar/zip. Output name must end with one of: .dex .jar .zip .apk. Positions
options: none, important, lines.
dx --annotool --annotation= [--element=]
[--print=]
dx --dump [--debug] [--strict] [--bytes] [--optimize]
[--basic-blocks | --rop-blocks | --ssa-blocks | --dot] [--ssa-step=]
[--width=] [.class | .txt] ...
Dump classfiles, or transformations thereof, in a human-oriented format.
dx --find-usages <file.dex>
Find references and declarations to a field or method.
declaring type: a class name in internal form, like Ljava/lang/Object;
member: a field or method name, like hashCode
dx -J ... <arguments, in one of the above forms>
Pass VM-specific options to the virtual machine that runs dx.
dx --version
Print the version of this tool (1.7).
dx --help
Print this message.
(FormsTest5.Droid)

=== Xamarin Studio ===

Version 5.9.3 (build 1)
Installation UUID: 1db186c8-6df9-4801-8a46-5cb2115276fb
Runtime:
Mono 4.0.1 ((detached/ed1d3ec)
GTK+ 2.24.23 (Raleigh theme)

Package version: 400010044

=== Xamarin.Android ===

Version: 5.1.3.1 (Indie Edition)
Android SDK: /Users/mac/Library/Developer/Xamarin/android-sdk-mac_x86
Supported Android versions:
2.3 (API level 10)
4.0.3 (API level 15)
4.1 (API level 16)
4.3 (API level 18)
4.4 (API level 19)
Java SDK: /usr
java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-466.1-11M4716)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-466.1, mixed mode)

=== Xamarin Android Player ===

Version: Unknown version
Location: /Applications/Xamarin Android Player.app

=== Apple Developer Tools ===

Xcode 5.1.1 (5085)
Build 5B1008

=== Xamarin.iOS ===

Version: 8.10.1.64 (Starter Edition)
Hash: e6ebd18
Branch: master
Build date: 2015-05-21 21:55:09-0400

=== Xamarin.Mac ===

Not Installed

=== Build Information ===

Release ID: 509030001
Git revision: 5a524e1726ed103fdd4fe37e0356f2b35466ce9d
Build date: 2015-06-02 16:35:08-04
Xamarin addins: 51957cfbd06be911b212671ad05c2c6221ac90f9

=== Operating System ===

Mac OS X 10.10.3
Darwin Mac-00264a19dfc6 14.3.0 Darwin Kernel Version 14.3.0
Mon Mar 23 11:59:05 PDT 2015
root:xnu-2782.20.48~5/RELEASE_X86_64 x86_64

android.support.v7.internal.widget.NativeActionModeAwareLayout does not exist

$
0
0

All of a sudden, I am getting this error at build. The only thing that has changed is that 3 packages were updated:

Support.v4
Support.v7.AppCompat
Support.v7.MediaRouter

The error shows that it is inside something maybe in one of those at the last line below:

    package mono.android.support.v7.internal.widget;


    public class NativeActionModeAwareLayout_OnActionModeForChildListenerImplementor
        extends java.lang.Object
        implements
            mono.android.IGCUserPeer,
            android.support.v7.internal.widget.NativeActionModeAwareLayout.OnActionModeForChildListener

Any ideas on what I can do to build my app again?

The Operation has Time Out Issue.

$
0
0

Hi,

Right now i have working xamarin android platform now i had integrated WCF in xamarin android project when we trying to call wcf connection threw database getting response wcf method but when call method completed event getting error "The Operation has time out issue".
please give me reply if anyone have right solution as soon as possible.

Thanks in advance.

Best practice for calling an Android Activity with a Dependency Service

$
0
0

I have a PCL that defines an Interface (IPictureTaker). From a viewmodel within the PCL, I use the DependencyService to call my SnapPic method :

public interface IPictureTaker
  {
       void SnapPic();
  }

In the view model:

public void ExecuteMethod()
{
     IPictureTaker pictureTaker = DependencyService.Get<IPictureTaker>();
     pictureTaker.SnapPic();
}

I implement the interface in the MainActivity of the Android Project and call activity.StartActivityForResult:

`public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsApplicationActivity, IPictureTaker
{
//OnCreate omitted

    public void SnapPic()
    {
        var activity = Forms.Context as Activity;

        var picker = new MediaPicker(activity);
        var intent = picker.GetTakePhotoUI(new StoreCameraMediaOptions
        {
            Name = "profile.jpg",
            Directory = "Krizzma"
        });
        activity.StartActivityForResult(intent, 1);
    }

protected override async void OnActivityResult(int requestCode, Result resultCode,
        Android.Content.Intent data)
    {
        if (resultCode == Result.Canceled)
            return;

        var mediaFile = await data.GetMediaFileExtraAsync(Forms.Context);

        WriteImageToDB(mediaFile);

        MessagingCenter.Send<IPictureTaker, Stream>(this, "pictureTaken", mediaFile.GetStream());

    }   

}`

My Question: I would prefer to not use the MainActivity for this purpose as I plan to have multiple interfaces similar to this one and it feels wrong to have to handle which method was called inside of the OnActivityResult. I have tried creating a "TakePictureActivity" with the exact same code and the SnapPic method is called correctly, but OnActivityResult is called in the MainAcitivty. I believe this is because Forms.Context is the MainActivity. I have tried starting the TakePictureActivity from within the SnapPic method, but was unsuccessful and it also does not seem to be the correct way to go about it.

Any suggestions on how to properly implement this would be appreciated.

Issue with Microsoft.Http.Net library - Operation is not valid due to the current state of the objec

$
0
0

Hello friends,

I'm dealing with an issue on iOS, the app works perfectly on Simulator, but it does not work on physical device.

This is the inner exception of the error:

    System.InvalidOperationException: Operation is not valid due to the current state of the object
      at System.Lightup.Call[HttpWebRequest,Int64] (System.Delegate& storage, System.Net.HttpWebRequest instance, System.String methodName, Int64 parameter) [0x00000] in <filename unknown>:0 
      at System.Lightup.Set[HttpWebRequest,Int64] (System.Delegate& storage, System.Net.HttpWebRequest instance, System.String propertyName, Int64 value) [0x00000] in <filename unknown>:0 
      at System.Net.HttpWebRequestLightup.SetContentLength (System.Net.HttpWebRequest instance, Int64 value) [0x00000] in <filename unknown>:0 
      at System.Net.Http.HttpWebRequest.set_ContentLength (Int64 value) [0x00000] in <filename unknown>:0 
      at System.Net.Http.HttpClientHandler.StartRequest (System.Object obj) [0x00000] in <filename unknown>:0 

I tried the workaround of the app.config file and also gave it a try to set the Microsoft.Net.Http to false (local copy) and none of that worked.

I checked these 2 pages of the bugs:
https://bugzilla.xamarin.com/show_bug.cgi?id=20589
and https://bugzilla.xamarin.com/show_bug.cgi?id=17936

None of the workaround worked for me. Any ideas or workaround are always welcome.

Thanks in advance

Correct use of Activity Indicator iOS and Android

$
0
0

I'm using the next code for login in my app:

    private Command loginCommand;
    public const string LoginCommandPropertyName = "LoginCommand";
    public Command LoginCommand
    {
        get
        {
            return loginCommand ?? (loginCommand = new Command(async () =>
            {
                if (IsLoading)
                    return;
                IsLoading = true;
                await ExecuteLoginCommand();
                IsLoading = false;
            }));
        }
    }

    protected async Task ExecuteLoginCommand()
    {
        bool isLogin = false;
        await Task.Run(async () =>
        {
             isLogin = await UserAccount.doLogin(username, password); //doLogin is a public async static Task<bool>
        });
            if (isLogin)
            {
            var mainP = new NavigationPage(new RootPage());
            await navigation.PushModalAsync(mainP);
            }
    }

Activity indicator runs well on Android with the code above but on iOS is not working at all, I removed the Task.Run and executed the login function but now there is no Activity indicator running either on Android nor iOS, Is there a problem with the await/Task.Run or can someone please lend me a right way to use activity indicators?

Thanks in advance


Android: Multiple app start/stops throws mono exception

$
0
0

I'm posting this here first before logging a bug because I am a little greener with Android and maybe I am missing something obvious with how Activities are setup.

I've noticed that when you use the back button, and subsequently it drops out of the app, that when you restart it - the main activity OnCreate is fired again, the heap seems pretty much completely collected, and what was on the stack is still hanging around. In short, the app seems very much in a zombie state rather than being fully destroyed. That's OK and not my beef - I've worked around this fact, but I do think it is part of the problem.

However, when I include Insights into my project I can throw a nasty low-level exception with the following steps:

  • Launch App
  • Back Button
  • Repeat 2-5 times

I've tinkered with some of the Activity settings such as AllowTaskReparenting, AlwaysRetainTaskState, and ClearTaskOnLaunch but none of those settings help bypass the exception. I'm GUESSING that what is happening is Insights is attempting to report an app Paused event and then attempting to reference an ApplicationContext or Activity that no longer exists (thus my zombie state comment above).

Below is the output window dump - thanks for taking a look!

cc @GordAllott

The thread '<Thread Pool>' (0x4) has exited with code 0 (0x0).
An unhandled exception occured.

10-21 16:09:19.190 D/Mono    ( 8243): DllImport attempting to load: '/system/lib/liblog.so'.
10-21 16:09:19.190 D/Mono    ( 8243): DllImport loaded library '/system/lib/liblog.so'.
10-21 16:09:19.190 D/Mono    ( 8243): DllImport searching in: '/system/lib/liblog.so' ('/system/lib/liblog.so').
10-21 16:09:19.190 D/Mono    ( 8243): Searching for '__android_log_print'.
10-21 16:09:19.190 D/Mono    ( 8243): Probing '__android_log_print'.
10-21 16:09:19.190 D/Mono    ( 8243): Found as '__android_log_print'.
10-21 16:09:19.194 I/MonoDroid( 8243): UNHANDLED EXCEPTION:
10-21 16:09:19.202 I/MonoDroid( 8243): System.NullReferenceException: Object reference not set to an instance of an object
10-21 16:09:19.202 I/MonoDroid( 8243): at Xamarin.InsightsCore.PlatformServices.<.ctor>b__1 (object,Xamarin.InsightsCore.BackgroundedChangedEventArgs) <IL 0x00008, 0x0002f>
10-21 16:09:19.202 I/MonoDroid( 8243): at Xamarin.InsightsCore.BackgroundManager.EmitBackgroundChange (bool) <IL 0x00023, 0x0009f>
10-21 16:09:19.202 I/MonoDroid( 8243): at Xamarin.InsightsCore.BackgroundManager.OnActivityPaused (Android.App.Activity) <IL 0x00002, 0x0002b>
10-21 16:09:19.202 I/MonoDroid( 8243): at Android.App.Application/IActivityLifecycleCallbacksInvoker.n_OnActivityPaused_Landroid_app_Activity_ (intptr,intptr,intptr) [0x00011] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.18-series/3b7ef0a7/source/monodroid/src/Mono.Android/platforms/android-17/src/generated/Android.App.Application.cs:192
10-21 16:09:19.206 I/MonoDroid( 8243): at (wrapper dynamic-method) object.20f6d7a6-0ead-4486-a777-c73127f6f90b (intptr,intptr,intptr) <IL 0x00017, 0x0001f>
An unhandled exception occured.

10-21 16:09:20.954 W/dalvikvm( 8243): JNI WARNING: JNI method called with exception pending
10-21 16:09:20.954 W/dalvikvm( 8243):              in Lxamarin/insightscore/BackgroundManager;.n_onActivityPaused:(Landroid/app/Activity;)V (CallObjectMethod)
10-21 16:09:20.954 W/dalvikvm( 8243): Pending exception is:
10-21 16:09:20.954 I/dalvikvm( 8243): android.runtime.JavaProxyThrowable: System.NullReferenceException: Object reference not set to an instance of an object
10-21 16:09:20.954 I/dalvikvm( 8243): at Xamarin.InsightsCore.PlatformServices.<.ctor>b__1 (object,Xamarin.InsightsCore.BackgroundedChangedEventArgs) <IL 0x00008, 0x0002f>
10-21 16:09:20.954 I/dalvikvm( 8243): at Xamarin.InsightsCore.BackgroundManager.EmitBackgroundChange (bool) <IL 0x00023, 0x0009f>
10-21 16:09:20.954 I/dalvikvm( 8243): at Xamarin.InsightsCore.BackgroundManager.OnActivityPaused (Android.App.Activity) <IL 0x00002, 0x0002b>
10-21 16:09:20.954 I/dalvikvm( 8243): at Android.App.Application/IActivityLifecycleCallbacksInvoker.n_OnActivityPaused_Landroid_app_Activity_ (intptr,intptr,intptr) [0x00011] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.18-series/3b7ef0a7/source/monodroid/src/Mono.Android/platforms/android-17/src/generated/Android.App.Application.cs:192
10-21 16:09:20.954 I/dalvikvm( 8243): at (wrapper dynamic-method) object.20f6d7a6-0ead-4486-a777-c73127f6f90b (intptr,intptr,intptr) <IL 0x00017, 0x0001f>
10-21 16:09:20.954 I/dalvikvm( 8243):   at xamarin.insightscore.BackgroundManager.n_onActivityPaused(Native Method)
10-21 16:09:20.954 I/dalvikvm( 8243):   at xamarin.insightscore.BackgroundManager.onActivityPaused(BackgroundManager.java:58)
10-21 16:09:20.954 I/dalvikvm( 8243):   at android.app.Application.dispatchActivityPaused(Application.java:182)
10-21 16:09:20.954 I/dalvikvm( 8243):   at android.app.Activity.onPause(Activity.java:1271)
10-21 16:09:20.954 I/dalvikvm( 8243):   at android.app.Activity.performPause(Activity.java:5106)
10-21 16:09:20.954 I/dalvikvm( 8243):   at android.app.Instrumentation.callActivityOnPause(Instrumentation.java:1225)
10-21 16:09:20.954 I/dalvikvm( 8243):   at android.app.ActivityThread.performPauseActivity(ActivityThread.java:2825)
10-21 16:09:20.954 I/dalvikvm( 8243):   at android.app.ActivityThread.performPauseActivity(ActivityThread.java:2794)
10-21 16:09:20.954 I/dalvikvm( 8243):   at android.ap10-21 16:09:20.954 I/dalvikvm( 8243):  at android.app.ActivityThread.handlePauseActivity(ActivityThread.java:2772)
10-21 16:09:20.954 I/dalvikvm( 8243):   at android.app.ActivityThread.access$800(ActivityThread.java:130)
10-21 16:09:20.954 I/dalvikvm( 8243):   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1212)
10-21 16:09:20.954 I/dalvikvm( 8243):   at android.os.Handler.dispatchMessage(Handler.java:99)
10-21 16:09:20.954 I/dalvikvm( 8243):   at android.os.Looper.loop(Looper.java:137)
10-21 16:09:20.954 I/dalvikvm( 8243):   at android.app.ActivityThread.main(ActivityThread.java:4745)
10-21 16:09:20.954 I/dalvikvm( 8243):   at java.lang.reflect.Method.invokeNative(Native Method)
10-21 16:09:20.954 I/dalvikvm( 8243):   at java.lang.reflect.Method.invoke(Method.java:511)
10-21 16:09:20.954 I/dalvikvm( 8243):   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
10-21 16:09:20.958 I/dalvikvm( 8243):   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
10-21 16:09:20.958 I/dalvikvm( 8243):   at dalvik.system.NativeStart.main(Native Method)
10-21 16:09:20.958 I/dalvikvm( 8243): "main" prio=5 tid=1 NATIVE
10-21 16:09:20.958 I/dalvikvm( 8243):   | group="main" sCount=0 dsCount=0 obj=0xa62c24b0 self=0xb8049510
10-21 16:09:20.958 I/dalvikvm( 8243):   | sysTid=8243 nice=0 sched=3/0 cgrp=[fopen-error:2] handle=-1216748480
10-21 16:09:20.958 I/dalvikvm( 8243):   | schedstat=( 1188225290 317423519 2514 ) utm=96 stm=22 core=0
10-21 16:09:20.978 I/dalvikvm( 8243):   #00  pc 0008f4ad  /system/lib/libdvm.so
10-21 16:09:20.978 I/dalvikvm( 8243):   #01  pc 00073efa  /system/lib/libdvm.so
10-21 16:09:20.978 I/dalvikvm( 8243):   #02  pc 00074024  /system/lib/libdvm.so
10-21 16:09:20.978 I/dalvikvm( 8243):   #03  pc 0003879a  /system/lib/libdvm.so
10-21 16:09:20.978 I/dalvikvm( 8243):   #04  pc 00049882  /system/lib/libdvm.so
10-21 16:09:20.978 I/dalvikvm( 8243):   #05  pc 0000c054  <unknown>
10-21 16:09:20.978 I/dalvikvm( 8243):   at xamarin.insightscore.BackgroundManager.n_onActivityPaused(Native Method)
10-21 16:09:20.978 I/dalvikvm( 8243):   at xamarin.insightscore.BackgroundManager.onActivityPaused(BackgroundManager.java:58)
10-21 16:09:20.978 I/dalvikvm( 8243):   at android.app.Application.dispatchActivityPaused(Application.java:182)
10-21 16:09:20.978 I/dalvikvm( 8243):   at android.app.Activity.onPause(Activity.java:1271)
10-21 16:09:20.978 I/dalvikvm( 8243):   at android.app.Activity.performPause(Activity.java:5106)
10-21 16:09:20.978 I/dalvikvm( 8243):   at android.app.Instrumentation.callActivityOnPause(Instrumentation.java:1225)
10-21 16:09:20.978 I/dalvikvm( 8243):   at android.app.ActivityThread.performPauseActivity(ActivityThread.java:2825)
10-21 16:09:20.978 I/dalvikvm( 8243):   at android.app.ActivityThread.performPauseActivity(ActivityThread.java:2794)
10-21 16:09:20.978 I/dalvikvm( 8243):   at android.app.ActivityThread.handlePauseActivity(ActivityThread.java:2772)
10-21 16:09:20.978 I/dalvikvm( 8243):   at android.app.ActivityThread.access$800(ActivityThread.java:130)
10-21 16:09:20.982 I/dalvikvm( 8243):   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1212)
10-21 16:09:20.982 I/dalvikvm( 8243):   at android.os.Handler.dispatchMessage(Handler.java:99)
10-21 16:09:20.982 I/dalvikvm( 8243):   at android.os.Looper.loop(Looper.java:137)
10-21 16:09:20.982 I/dalvikvm( 8243):   at android.app.ActivityThread.main(ActivityThread.java:4745)
10-21 16:09:20.982 I/dalvikvm( 8243):   at java.lang.reflect.Method.invokeNative(Native Method)
10-21 16:09:20.982 I/dalvikvm( 8243):   at java.lang.reflect.Method.invoke(Method.java:511)
10-21 16:09:20.982 I/dalvikvm( 8243):   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
10-21 16:09:20.982 I/dalvikvm( 8243):   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
10-21 16:09:20.982 I/dalvikvm( 8243):   at dalvik.system.NativeStart.main(Native Method)
10-21 16:09:20.982 I/dalvikvm( 8243): 
10-21 16:09:20.982 E/dalvikvm( 8243): VM aborting
10-21 16:09:20.982 E/mono-rt ( 8243): Stacktrace:
10-21 16:09:20.982 E/mono-rt ( 8243): 
10-21 16:09:20.982 E/mono-rt ( 8243):   at <unknown> <0xffffffff>
10-21 16:09:20.982 E/mono-rt ( 8243):   at (wrapper managed-to-native) object.wrapper_native_0xb6779840 (intptr,intptr,intptr) <IL 0x00027, 0xffffffff>
10-21 16:09:20.982 E/mono-rt ( 8243):   at Android.Runtime.JNIEnv.CallObjectMethod (intptr,intptr) [0x00040] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.18-series/3b7ef0a7/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.g.cs:174
10-21 16:09:20.982 E/mono-rt ( 8243):   at Android.Content.ContextWrapper.get_ContentResolver () [0x00043] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.18-series/3b7ef0a7/source/monodroid/src/Mono.Android/platforms/android-17/src/generated/Android.Content.ContextWrapper.cs:263
10-21 16:09:20.982 E/mono-rt ( 8243):   at Xamarin.InsightsCore.HardwareDetector.get_DeviceId () <IL 0x00006, 0x0002a>
10-21 16:09:20.982 E/mono-rt ( 8243):   at Xamarin.InsightsCore.PlatformServices.GetDeviceId () <IL 0x00006, 0x0002b>
10-21 16:09:20.982 E/mono-rt ( 8243):   at Xamarin.InsightsCore.Device.get_Id () <IL 0x00005, 0x00034>
10-21 16:09:20.982 E/mono-rt ( 8243):   at Xamarin.InsightsCore.Json.Envelope..ctor (int) <IL 0x00001, 0x00027>
10-21 16:09:20.982 E/mono-rt ( 8243):   at Xamarin.InsightsCore.Json.Track..ctor (string,System.Collections.Generic.IDictionary`2<string, string>) <IL 0x00002, 0x0002b>
10-21 16:09:20.982 E/mono-rt ( 8243):   at Xamarin.InsightsCore.WebApi.SubmitTrackInformation (string,System.Collections.Generic.IDictionary`2<string, string>) <IL 0x00002, 0x0004f>
10-21 16:09:20.982 E/mono-rt ( 8243):   at Xamarin.InsightsCore.Core.Track (string,System.Collections.Generic.IDictionary`2<string, string>) <IL 0x00011, 0x00077>
10-21 16:09:20.982 E/mono-rt ( 8243):   at Xamarin.InsightsCore.Core.OnUnhandledException (System.Exception) <IL 0x0003f, 0x00143>
10-21 16:09:20.982 E/mono-rt ( 8243):   at Xamarin.InsightsCore.Core.PlatformServicesOnUnhandledException (object,Xamarin.InsightsCore.PortableUnhandledExceptionEventArgs) <IL 0x00028, 0x0011b>
10-21 16:09:20.986 E/mono-rt ( 8243):   at Xamarin.InsightsCore.PlatformServices.EmitUnhandledException (object,System.Exception) <IL 0x00016, 0x00093>
10-21 16:09:20.986 E/mono-rt ( 8243):   at Xamarin.InsightsCore.PlatformServices.HandleException (object,System.Exception) <IL 0x00003, 0x0002f>
10-21 16:09:20.986 E/mono-rt ( 8243):   at Xamarin.InsightsCore.PlatformServices.CurrentDomainOnUnhandledException (object,System.UnhandledExceptionEventArgs) <IL 0x0000f, 0x0006f>
10-21 16:09:20.986 E/mono-rt ( 8243):   at (wrapper delegate-invoke) <Module>.invoke_void_object_UnhandledExceptionEventArgs (object,System.UnhandledExceptionEventArgs) <IL 0x00027, 0x00042>
10-21 16:09:20.986 E/mono-rt ( 8243):   at (wrapper delegate-invoke) <Module>.invoke_void_object_UnhandledExceptionEventArgs (object,System.UnhandledExceptionEventArgs) <IL 0x00059, 0xffffffff>
10-21 16:09:20.986 E/mono-rt ( 8243):   at (wrapper runtime-invoke) <Module>.runtime_invoke_void__this___object_object (object,intptr,intptr,intptr) <IL 0x0005a, 0xffffffff>
10-21 16:09:20.986 E/mono-rt ( 8243): 
10-21 16:09:20.986 E/mono-rt ( 8243): =================================================================
10-21 16:09:20.986 E/mono-rt ( 8243): Got a SIGSEGV while executing native code. This usually indicates
10-21 16:09:20.986 E/mono-rt ( 8243): a fatal error in the mono runtime or one of the native libraries 
10-21 16:09:20.986 E/mono-rt ( 8243): used by your application.
10-21 16:09:20.986 E/mono-rt ( 8243): =================================================================
10-21 16:09:20.986 E/mono-rt ( 8243): 
10-21 16:09:20.986 F/libc    ( 8243): Fatal signal 11 (SIGSEGV) at 0xdeadd00d (code=1), thread 8243 (le.finalexpense)
The program 'Mono' has exited with code 0 (0x0).

Error Installing Json.NET

$
0
0

Adding Newtonsoft.Json...
Adding 'Newtonsoft.Json 6.0.8' to Resun8r.
Could not install package 'Newtonsoft.Json 6.0.8'. You are trying to install this package into a project that targets 'MonoAndroid,Version=v4.4', 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.

I have tried versions as low as 4.03 up to 5.0 and continue to get the same error. Any pointers are welcome!

unexacting error in application when updated the emulator

$
0
0

Hello guys,
You know i installed the HAXM in MAC OS for improve the performance in the emulator, the problem is that when i updated Xamarin Studio give me the error about The Fast Deployment error. I deactivated it and i don't have the error but the application still crashes when start, the application were working after the update.
The error that i getting is:

[art] Not late-enabling -Xcheck:jni (already on)
[AndroidRuntime] Shutting down VM
[AndroidRuntime] FATAL EXCEPTION: main
[AndroidRuntime] Process: com.jperera.realstatediary.android, PID: 2107
[AndroidRuntime] java.lang.RuntimeException: Unable to get provider mono.MonoRuntimeProvider: java.lang.RuntimeException: Unable to find application Mono.Android.DebugRuntime!
[AndroidRuntime] at android.app.ActivityThread.installProvider(ActivityThread.java:5005)
[AndroidRuntime] at android.app.ActivityThread.installContentProviders(ActivityThread.java:4597)
[AndroidRuntime] at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4537)
[AndroidRuntime] at android.app.ActivityThread.access$1500(ActivityThread.java:151)
[AndroidRuntime] at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1364)
[AndroidRuntime] at android.os.Handler.dispatchMessage(Handler.java:102)
[AndroidRuntime] at android.os.Looper.loop(Looper.java:135)
[AndroidRuntime] at android.app.ActivityThread.main(ActivityThread.java:5257)
[AndroidRuntime] at java.lang.reflect.Method.invoke(Native Method)
[AndroidRuntime] at java.lang.reflect.Method.invoke(Method.java:372)
[AndroidRuntime] at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
[AndroidRuntime] at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
[AndroidRuntime] Caused by: java.lang.RuntimeException: Unable to find application Mono.Android.DebugRuntime!
[AndroidRuntime] at mono.MonoRuntimeProvider.attachInfo(MonoRuntimeProvider.java:47)
[AndroidRuntime] at android.app.ActivityThread.installProvider(ActivityThread.java:5002)
[AndroidRuntime] ... 11 more
[AndroidRuntime] Caused by: android.content.pm.PackageManager$NameNotFoundException: Mono.Android.DebugRuntime
[AndroidRuntime] at android.app.ApplicationPackageManager.getApplicationInfo(ApplicationPackageManager.java:281)
[AndroidRuntime] at mono.MonoRuntimeProvider.attachInfo(MonoRuntimeProvider.java:41)
[AndroidRuntime] ... 12 more
[Process] Sending signal. PID: 2107 SIG: 9

Please i'll appreciate any help from you.

Thank you

Back key press on Android throws a null reference exception on restarting the app

$
0
0

I am closing the Activity by calling the finish method. When I relaunch the app it throws a exception. Thanks...

Here is the log
06-18 17:04:11.590 D/Mono ( 3967): Searching for '__android_log_print'.
06-18 17:04:11.590 D/Mono ( 3967): Probing '__android_log_print'.
06-18 17:04:11.590 D/Mono ( 3967): Found as '__android_log_print'.
06-18 17:04:11.591 I/MonoDroid( 3967): UNHANDLED EXCEPTION:
06-18 17:04:11.593 I/MonoDroid( 3967): System.NullReferenceException: Object reference not set to an instance of an object
06-18 17:04:11.593 I/MonoDroid( 3967): at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw ()
06-18 17:04:11.593 I/MonoDroid( 3967): at System.Runtime.CompilerServices.AsyncMethodBuilderCore.m__0 (object)
06-18 17:04:11.593 I/MonoDroid( 3967): at Android.App.SyncContext/c__AnonStorey0.<>m__0 ()
06-18 17:04:11.593 I/MonoDroid( 3967): at Java.Lang.Thread/RunnableImplementor.Run ()

What is the definitive "best" way to call web services from cross-platform code?

$
0
0

Hi,

We need to call web services (SOAP, not REST) from a cross-platform Xamarin app. There seem to be lots of choices, and it's not clear which is best. Is there a definitive answer, to choose between the following?

  1. PCL and WCF. We tried this, but got incorrect behaviour - in that the generated XML request was subtly wrong. We put this down to the fact that WCF support on Xamarin is described as "preview" only, which suggests to us that we can't rely on it.
  2. PCL and ASMX ("old school") web service proxies. There seem to be conflicting information on whether this is supported. Is it?
  3. Abandon PCLs and go for Shared Projects instead. Presumably with ASMX-style rather than WCF.

Thanks,
John

Hello World errors

$
0
0

I am having some trouble with the Hello World app tutorial. My simulator is working, but my app is loading off center, and when I click the translate button a MonoTouch.Foundation.MonoTouchException is being thrown. It looks like TranslateButton and translatedNumber are unknown identifiers in ViewController.cs. I copied the text word for word for ViewController.cs from the tutorial; it did not have any code that declared those variables.. Isn't that done by the Storyboard? What am I missing? I am attaching my zipped project file.

PHImageManager.RequestImageForAsset leaking / fragmenting memory

$
0
0

Guys,

if we request images in a back ground thread synchronously in an eternal loop, after a while the app starts receiving memory warnings and end up to be killed by the OS.
It does not seem to happen if we request it asynchronously.
Please, look to this example which is using already unified api. It was happening before, though.
Is this code leaking and i'm not able to see where? Is it PhotoKit leaking? What is your opinion?

cheers
Manuel

`` Thread t = new Thread (new ThreadStart (delegate {

                var assets = PHAsset.FetchAssets (new PHFetchOptions (){ Predicate = NSPredicate.FromFormat (@"mediaType == " + (int)PHAssetMediaType.Image) });

                var options = new PHImageRequestOptions () {
                    NetworkAccessAllowed = true,
                    DeliveryMode = PHImageRequestOptionsDeliveryMode.HighQualityFormat,
                    Synchronous = true
                };

                while (true) {
                    foreach (var asset in assets) {
                        using (var pool = new NSAutoreleasePool ()) {   
                            UIImage img = null;

                            PHImageManager.DefaultManager.RequestImageForAsset ((PHAsset)asset, new CoreGraphics.CGSize (240, 240), PHImageContentMode.AspectFill, options, (UIImage result, NSDictionary info) => {

                                img = result;

                            });

                            if (img != null) {
                                img.Dispose ();
                            }

                        }
                    }


                }
            }));

            t.Start ();

``


Java Binding Lib - java.io.inputstream and outputstream both changed to system.io.stream

$
0
0

I'm trying to bind to a .jar from LeadTools and I've run into an interesting situation. The LeadStream class has two constructors, one with signature (java.io.outputStream p0) and the other (java.io.inputStream p0). After building, this results in two constructors in api.xml, both with the same signature (System.IO.Stream p0). The consequent error is Type 'LeadTools.LeadStream' already defines a member called LeadStream with the same parameter types

What's the best way to deal with this? Best plan I could come up with was to hide both constructors from api.xml, then create a partial class that adds a single constructor with the System.IO.Stream signature. I'm not sure how to do this otherwise I'd give it a try. Is there a better solution in metadata.xml?

Thanks
Mark

Parse - Unable to instantiate receiver com.parse.GcmBroadcastReceiver

$
0
0

Hi guys

we are receiving "could not load library com.parse.GcmBroadcastReceiver" exceptions very often in debug mode and less frequent in release.
We are using the following components:
- Parse from Xamarin component store (http://components.xamarin.com/view/parse)
- Parse binding to have push notification functionality available (https://parse.com/apps/quickstart#parse_push/android/native)

Any idea of what can be causing this?

Manuel

Manifest

<uses-sdk android:minSdkVersion="18" android:targetSdkVersion="21" />

<application android:label="###" android:hardwareAccelerated="false" largeHeap="true" android:icon="@drawable/icon">

    <!-- PARSE PUSH NOTIFICATIONS -->
    <service android:name="com.parse.PushService" />
    <meta-data android:name="com.facebook.sdk.ApplicationId" android:value="########" />
    <receiver android:name="com.parse.ParseBroadcastReceiver">
        <intent-filter>
            <action android:name="android.intent.action.BOOT_COMPLETED" />
            <action android:name="android.intent.action.USER_PRESENT" />
        </intent-filter>
    </receiver>

    <receiver android:name="com.parse.GcmBroadcastReceiver" android:permission="com.google.android.c2dm.permission.SEND">
        <intent-filter>
            <action android:name="com.google.android.c2dm.intent.RECEIVE" />
            <action android:name="com.google.android.c2dm.intent.REGISTRATION" />
            <category android:name="com.###.###" />
        </intent-filter>
    </receiver>

    <receiver android:name="com.parse.ParsePushBroadcastReceiver" android:exported="false">
        <intent-filter>
            <action android:name="com.parse.push.intent.RECEIVE" />
            <action android:name="com.parse.push.intent.DELETE" />
            <action android:name="com.parse.push.intent.OPEN" />
        </intent-filter>
    </receiver>

</application>

<uses-permission android:name="android.permission.INTERNET" />

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

<uses-permission android:name="android.permission.WAKE_LOCK" />

<uses-permission android:name="android.permission.GET_TASKS" />

<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />

<uses-permission android:name="android.permission.VIBRATE" />

<uses-permission android:name="android.permission.GET_ACCOUNTS" />

<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />

<permission android:protectionLevel="signature" android:name="com.###.###.permission.C2D_MESSAGE" />

<uses-permission android:name="com.###.###.permission.C2D_MESSAGE" />

Stack trace

Device = samsung, GT-I9505, jflte;
App Version = Android 0.9.8; Build = 109;
System Version = Level = L; Error = Java.Lang.RuntimeException: Exception of type 'Java.Lang.RuntimeException' was thrown. --- End of managed exception stack trace --- java.lang.RuntimeException: Unable to instantiate receiver com.parse.GcmBroadcastReceiver: java.lang.ClassNotFoundException: Didn't find class "com.parse.GcmBroadcastReceiver" on path: DexPathList[[zip file "/data/app/com.###.####-1/base.apk"],nativeLibraryDirectories=[/data/app/com.###.###-1/lib/arm, /vendor/lib, /system/lib]] at android.app.ActivityThread.handleReceiver(ActivityThread.java:2976) at android.app.ActivityThread.access$1800(ActivityThread.java:177) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1525) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:145) at android.app.ActivityThread.main(ActivityThread.java:5944) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1389) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1184) Caused by: java.lang.ClassNotFoundException: Didn't find class "com.parse.GcmBroadcastReceiver" on path: DexPathList[[zip file "/data/app/com.###.###-1/base.apk"],nativeLibraryDirectories=[/data/app/com.###.###-1/lib/arm, /vendor/lib, /system/lib]] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56) at java.lang.ClassLoader.loadClass(ClassLoader.java:511) at java.lang.ClassLoader.loadClass(ClassLoader.java:469) at android.app.ActivityThread.handleReceiver(ActivityThread.java:2971) ... 9 more Suppressed: java.lang.ClassNotFoundException: com.parse.GcmBroadcastReceiver at java.lang.Class.classForName(Native Method) at java.lang.BootClassLoader.findClass(ClassLoader.java:781) at java.lang.BootClassLoader.loadClass(ClassLoader.java:841) at java.lang.ClassLoader.loadClass(ClassLoader.java:504) ... 11 more Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available

Android C# Client - Windows C# Server, Can this connection be done with Socket/TCP Connection?

$
0
0

Hi there, I'm trying to make an Android C# Client App that communicates with a C# Windows Server. What do you recommend for the connection? TCP? Socket? Http? I would like to work with sockets. Is it possible?
Does android supports socket connection? I'm using (and would like to continue using) C# for both server and client and using xamarin studio.
Thanks

How can i pass a value from Activity to a Fragment

$
0
0

Hello guys,
I'm trying to pass an integer value to a fragment but i got an exception then the application crash.
This is the code that i'm using:
In the vent where i create the fragment:

var tabGeneral = this.ActionBar.NewTab();
            tabGeneral.SetText (Resource.String.edit_property_general);
            tabGeneral.TabSelected += (object sender, ActionBar.TabEventArgs e) => {
                Bundle fragBundle = new Bundle();
                var fragment = this.FragmentManager.FindFragmentById(Resource.Id.fragmentPropertyContainer);
                fragBundle.PutInt("PropertyId", myProperty.Id);
                fragment.Arguments = fragBundle;
                if (fragment != null)
                    e.FragmentTransaction.Remove(fragment);         
                e.FragmentTransaction.Add (Resource.Id.fragmentPropertyContainer, new EditPropertyGeneral());
            };
            this.ActionBar.AddTab (tabGeneral);

The code to read the value in the fragment is:
public override void OnCreate (Bundle savedInstanceState)
        {
            base.OnCreate (savedInstanceState);
            // Create your fragment here
            Bundle bundle = this.Arguments;
            if (bundle != null) {
                int propertyId = bundle.GetInt("PropertyId", 0);
                myProperty = RealStateDiary.Core.BusinessLayer.Poco.Property.GetProperty (propertyId);
                tbEditPropertyName.Text = myProperty.PropertyName;
            }
        }

I'll appreciate a lot any help from you.
Thanks in advanced.
Note: The exception is:
[MonoDroid] UNHANDLED EXCEPTION:
[MonoDroid] System.NullReferenceException: Object reference not set to an instance of an object
[MonoDroid] at RealStateDiary.EditProperty.m__0 (object,Android.App.ActionBar/TabEventArgs) [0x00030] in /Users/jperera/Projects/RealStateDiary/RealStateDiary.Android/Screens/EditProperty.cs:33
[MonoDroid] at Android.App.TabEventDispatcher.OnTabSelected (Android.App.ActionBar/Tab,Android.App.FragmentTransaction) [0x0000d] in /Users/builder/data/lanes/monodroid-mavericks-monodroid-5.1-series/d419c934/source/monodroid/src/Mono.Android/src/Android.App/ActionBar.cs:89
[MonoDroid] at Android.App.ActionBar/ITabListenerInvoker.n_OnTabSelected_Landroid_app_ActionBar_Tab_Landroid_app_FragmentTransaction_ (intptr,intptr,intptr,intptr) [0x00019] in /Users/builder/data/lanes/monodroid-mavericks-monodroid-5.1-series/d419c934/source/monodroid/src/Mono.Android/platforms/android-19/src/generated/Android.App.ActionBar.cs:1315
[MonoDroid] at (wrapper dynamic-method) object.704803a1-549b-4e3d-9b64-8f1bb1cf425a (intptr,intptr,intptr,intptr)
[MonoDroid] UNHANDLED EXCEPTION:
[MonoDroid] System.NullReferenceException: Object reference not set to an instance of an object
[MonoDroid] at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw ()
[MonoDroid] at Android.Runtime.JNIEnv.CallVoidMethod (intptr,intptr,Android.Runtime.JValue*) [0x00063] in /Users/builder/data/lanes/monodroid-mavericks-monodroid-5.1-series/d419c934/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.g.cs:571
[MonoDroid] at Android.App.ActionBarInvoker.AddTab (Android.App.ActionBar/Tab) [0x00044] in /Users/builder/data/lanes/monodroid-mavericks-monodroid-5.1-series/d419c934/source/monodroid/src/Mono.Android/platforms/android-19/src/generated/Android.App.ActionBar.cs:3074
[MonoDroid] at RealStateDiary.EditProperty.OnCreate (Android.OS.Bundle) [0x00070] in /Users/jperera/Projects/RealStateDiary/RealStateDiary.Android/Screens/EditProperty.cs:38
[MonoDroid] at Android.App.Activity.n_OnCreate_Landroid_os_Bundle_ (intptr,intptr,intptr) [0x00011] in /Users/builder/data/lanes/monodroid-mavericks-monodroid-5.1-series/d419c934/source/monodroid/src/Mono.Android/platforms/android-19/src/generated/Android.App.Activity.cs:2475
[MonoDroid] at (wrapper dynamic-method) object.7dde707d-e92a-43e8-ae68-a525a797b5a0 (intptr,intptr,intptr)
[AndroidRuntime] Shutting down VM

Have tabs at the bottom of a TabbedPage instead of at the top.

$
0
0

I'm trying to get the tabs to show up at the bottom of the screen instead of at the top so they're easier to access with one hand on a phone. Is this possible to do without a custom renderer? Thanks!

Viewing all 204402 articles
Browse latest View live




Latest Images