Forum Xamarin.Forms

Application crashed while integrating stripe view payment gateway in xamarin android

gdkgdk INMember ✭✭✭
edited September 2017 in Xamarin.Forms

Hi everyone, I am trying to integrate stripe payment gateway in but I have get application closing issue. Here is the sample code what I have tried.

Sample Code:

[assembly: ExportRenderer(typeof(PaymentView), typeof(CardInputActivity)]
namespace SampleProject.Droid.PaymentController

public class CardInputActivity(Bundle bundle) : Activity


  Helper.StripeView = FindViewById<StripeView>(Resource.Id.stripeLayoutOne);


 <LinearLayout xmlns:android=""
    android:layout_marginBottom="10dp" />

This is the code I have tried. In above 'CardInPutActivity' is the renderer class in android, 'CardInputView' is the layout file in resource folder and 'PaymentView' is the portable class contain view.


  • ClintStLaurentClintStLaurent USUniversity ✭✭✭✭✭

    Getting error while

    Okay... But what is the error/exception? You don't mention it in your post.

  • gdkgdk INMember ✭✭✭
    edited September 2017

    Thanks Clint StLaurent. I have updated the question, I am getting application crashed issue. What my actual requirement is I am using portable project so need to add stripe payment ui for both ios and android. I have successfully adding stripe payment ui in ios using renderer class but when I try to add stripe payment ui for android getting crashed issue.

  • ClintStLaurentClintStLaurent USUniversity ✭✭✭✭✭

    You can understand how "Why does my app crash?" can be a bit vague for anyone to help you with - right?
    You need to narrow that down, get a log off the device reporting the crash, turn on more of the Exception Settings in Visual Studio... go through the output comments... something... by way of basic debugging.

  • gdkgdk INMember ✭✭✭

    I think this is cause of fallowing wrong pattern of designing xamarin android page designing. Can please suggest how can create design the page in xamarin android and how can we include that design in portable class. for example in ios I am design the page in controller and that design added in portable class using that controller added as renderer for on of the view in the portable class.

  • JohnHardmanJohnHardman GBUniversity mod
    edited September 2017

    @gdk - Rather than post "Application crashed", post "Application threw exception of type System.NullReferenceException" with the stack trace ... (replacing the type of exception with the correct type, and adding the stack trace, if any)

    "Application crashed" does not tell others the type of failure to look for, or where to look for it, but does tell us that the code does not contain appropriate try/catch blocks, does not contain unhandled exception handlers, does not integrate HockeyApp, Mobile Center or similar, and has not been stepped through in a debugger. We need more in order to help.

  • ClintStLaurentClintStLaurent USUniversity ✭✭✭✭✭

    Can please suggest how can create design the page in xamarin android and how can we include that design in portable class

    No. That's not how its done for a Xamarin.Forms app.
    You build the UI one time in the PCL. You don't build pages/UI in each of the platform projects.

    If that basic foundation concept is new to you - you NEED to stop developing until you have gone through some training. You can't expect to architect a solution when you have no understanding of the basics or concepts you should be using. I urge you to take a month and just learn. Maybe sign up for Xamarin University.

  • AdamMeaneyAdamMeaney USMember ✭✭✭✭✭

    If you do understand basic Xamarin Forms work, but not how to integrate native views to PCL, what you are looking for is how to make custom renderers properly.

    I have seen several threads before on taking a Stripe Payment view and showing it in XF.

    Your native side implementation needs to be a view, not an activity. Most likely that is your issue causing crashes.

  • gdkgdk INMember ✭✭✭

    Thanks Adam. Your are catch up what I have need. Can you please suggest how to use xamarin android view design included in pcl view design and both design show in single page.

  • AdamMeaneyAdamMeaney USMember ✭✭✭✭✭

    Read up on how to make your renderer work right. You seem to have the right idea in your post, just the wrong execution.

    Once you have tried it, get back to us if you have questions.

Sign In or Register to comment.