title: Stripe payment Integration in android Error java.lang.RuntimeException: Required Parameter: 'card' is required to create a token
body: <p>I have the following code where I want to implement Stripe payment in android application.please any tell how this problem i can solve if i giving card number dinamically in code like <code>this:card = new Card("4242424242421111", 12, 2019, "123");</code>  then after success token is creating but i can't give card number dynamically eachtime. so that i have added  <code>CardInputWidget</code> in my xml layout and writing this code: </p>
  
  <pre><code>CardInputWidget mCardInputWidget = (CardInputWidget) findViewById(R.id.card_input_widget);
  card = mCardInputWidget.getCard();
  </code></pre>
  
  <p>then j<code>ava.lang.RuntimeException: Required Parameter:</code> 'card' is required to create a token how can i solve this issues i am trying to solve this since last one day but unable to solve</p>
  
  <p><strong>my full code:</strong></p>
  
  <pre><code>  Card card;
      public static final String PUBLISHABLE_KEY = "pk_test_djaC9oh3D3xwh8FxOjh7pnew";
          private ProgressDialog progress;
          @Override
          protected void onCreate(Bundle savedInstanceState) {
              super.onCreate(savedInstanceState);
              setContentView(R.layout.activity_maincard);
              btnsubmit= (Button) findViewById(R.id.btnsubmit);
  
              CardInputWidget mCardInputWidget = (CardInputWidget) findViewById(R.id.card_input_widget);
  
            card = mCardInputWidget.getCard();
  
         //     card = new Card("4242424242424242", 12, 2018, "123");
              if (card == null) {
                  //    mErrorDialogHandler.showError("Invalid Card Data");
  
                  Stripe stripe = null;
                  try {
                      stripe = new Stripe(MainActivity.this, PUBLISHABLE_KEY);
                  } catch (AuthenticationException e) {
                      e.printStackTrace();
                  }
                  stripe.createToken(
                          card,
                          new TokenCallback() {
                              public void onSuccess(Token token) {
                                  // Send token to your server
                                  Log.d("token","token"+token);
                              }
                              public void onError(Exception error) {
                                  // Show localized error message
                                  Log.d("token","excep"+error.getMessage());
  
                              }
                          }
                  );
              }`
  </code></pre>
  
  <p><strong>activity_maincard.xml:</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
      &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
          xmlns:tools="http://schemas.android.com/tools"
          android:id="@+id/activity_main"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:paddingBottom="@dimen/activity_vertical_margin"
          android:paddingLeft="@dimen/activity_horizontal_margin"
          android:paddingRight="@dimen/activity_horizontal_margin"
          android:paddingTop="@dimen/activity_vertical_margin"
          tools:context="com.mspl.stripepay.MainActivity"
          xmlns:wallet="http://schemas.android.com/apk/res-auto"&gt;
  
          &lt;com.stripe.android.view.CardInputWidget
              android:id="@+id/card_input_widget"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              /&gt;
      &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>This is my xml containing <code>CardInputWidget</code> please try to help thanks in advance.</p>