Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 75885

facing problem with ClipData.NewHtmlText

$
0
0

Hi,

I am new in Xamarin forms, i am working on HTML Copy and Paste, in IOS working fine. Facing problem in android.
I have created Renderer for android and ios, in android code is :

protected override void OnElementChanged (ElementChangedEventArgs e)
{
base.OnElementChanged (e);
activity= this.Context as Activity;
if (e.OldElement == null) {
CustomButton custombutton = e.NewElement as CustomButton;
custombutton.Clicked += delegate {
ClipboardManager clipboardmanager= (ClipboardManager)activity.GetSystemService(Activity.ClipboardService);
ClipData clipdata = ClipData.NewHtmlText("label","text",emailsignatureViewModel.HtmlSignature);
clipboardmanager.PrimaryClip= clipdata;
custombutton._popup.DismissPopup();
};
}

image

when i copy the html the below exception is throw.

Java.Lang.NoSuchMethodError: no static method with name='newHtmlText' signature='(Ljava/lang/CharSequence;Ljava/lang/CharSequence;Ljava/lang/String;)Landroid/content/ClipData;' in class Landroid/content/ClipData;
at at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw ()
at at Android.Runtime.JNIEnv.GetStaticMethodID (intptr,string,string)
at at Android.Content.ClipData.NewHtmlText (Java.Lang.ICharSequence,Java.Lang.ICharSequence,string)
at at Android.Content.ClipData.NewHtmlText (string,string,string)
at SocialPhoto.Android.CustomButtonRenderer/c__AnonStorey0.<>m__0 (object,System.EventArgs) [0x00036] in /Users/pht/Documents/social-photo-mobile/Android/Renderer/CustomButtonRenderer.cs:34
at at Xamarin.Forms.Button.Xamarin.Forms.IButtonController.SendClicked ()
at at Xamarin.Forms.Platform.Android.ButtonRenderer/ButtonClickListener.OnClick (Android.Views.View)
at at Android.Views.View/IOnClickListenerInvoker.n_OnClick_Landroid_view_View_ (intptr,intptr,intptr)
at at (wrapper dynamic-method) object.a3514efb-a1ce-4562-aafe-d8727f95267d (intptr,intptr,intptr)
at --- End of managed exception stack trace ---
at java.lang.NoSuchMethodError: no static method with name='newHtmlText' signature='(Ljava/lang/CharSequence;Ljava/lang/CharSequence;Ljava/lang/String;)Landroid/content/ClipData;' in class Landroid/content/ClipData;
at at md5530bd51e982e6e7b340b73e88efe666e.ButtonRenderer_ButtonClickListener.n_onClick(Native Method)
at at md5530bd51e982e6e7b340b73e88efe666e.ButtonRenderer_ButtonClickListener.onClick(ButtonRenderer_ButtonClickListener.java:29)
at at android.view.View.performClick(View.java:3620)
at at android.view.View$PerformClick.run(View.java:14322)
at at android.os.Handler.handleCallback(Handler.java:605)
at at android.os.Handler.dispatchMessage(Handler.java:92)
at at android.os.Looper.loop(Looper.java:137)
at at android.app.ActivityThread.main(ActivityThread.java:4507)
at at java.lang.reflect.Method.invokeNative(Native Method)
at at java.lang.reflect.Method.invoke(Method.java:511)
at at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:978)
at at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:745)
at at dalvik.system.NativeStart.main(Native Method)

please help
Thanks


Viewing all articles
Browse latest Browse all 75885

Trending Articles



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