PayPal Woes

I have to implement the paypal lib in the DBZ update because paypal makes it difficult for people to donate on the browser. I really want to learn how to use it; good learning experience. The problem is that it loads some sort of view after you press a button. And that view won’t show.

I read the sample code for paypal 30-40 times. I don’t see any code that launches that view. Yet the tutorials say that the button is supposed to handle everything.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


ScrollView scroller = new ScrollView(this);
 scroller.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
 scroller.setBackgroundColor(Color.BLACK);

LinearLayout simplePay = new LinearLayout(this);
 simplePay.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
 simplePay.setBackgroundColor(Color.TRANSPARENT);
 simplePay.setGravity(Gravity.CENTER_HORIZONTAL);
 simplePay.setPadding(10, 10, 10, 10);
 simplePay.setOrientation(LinearLayout.VERTICAL);

CheckoutButton payButton = pp.getCheckoutButton(this, PayPal.BUTTON_194x37, CheckoutButton.TEXT_DONATE);
 payButton.setOnClickListener(this);

LinearLayout btnHolder = new LinearLayout(this);
 btnHolder.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
 btnHolder.setGravity(Gravity.CENTER_HORIZONTAL);
 btnHolder.setOrientation(LinearLayout.VERTICAL);
 btnHolder.setPadding(0, 5, 0, 5);
 btnHolder.addView(payButton);

simplePay.addView(btnHolder);
 scroller.addView(simplePay);
 setContentView(scroller);

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This code should work according to the sample code and all the tutorials I’ve read. It’s not thou. I’m not worried. I’m certain I’m close to understanding why and how to fix it.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s