我正在做paypal付款,因为我必须在onCreate()方法中初始化Button与PayPal图像我调用一个函数从它验证上述字段,然后触发一个API ,如果用户错误的Toast出现了“......这个提交不是空白的”。但之后,当我纠正该领域,再次点击Btn,然后它什么都不做。onClickListener不会被第二次调用Android
Thread libraryInitializationThread = new Thread() {
public void run() {
initLibrary();
// The library is initialised so let's create our CheckoutButton
// and update the UI.
if (PayPal.getInstance().isLibraryInitialized()) {
runOnUiThread(new Runnable() {
public void run() {
/**
* Create our CheckoutButton and update the UI.
*/
PayPal pp = PayPal.getInstance();
/**
* Get the CheckoutButton. There are five
* differentsizes. The text on the button can either
* be of type TEXT_PAY or TEXT_DONATE.
**/
launchChainedPaymentBtn = pp.getCheckoutButton(
BuyDeal.this, PayPal.BUTTON_194x37,
CheckoutButton.TEXT_PAY);
/**
* You'll need to have an OnClickListener for the
* CheckoutButton. For this application, MPL_Example
* implements OnClickListener and we have the
* onClick() method below.
**/
launchChainedPaymentBtn
.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// dealResponse
getDealResponseLogic();
}
});
//
BottomBtnsLinearLayout
.addView(launchChainedPaymentBtn);
Log.v("Btn added ", "SuccessFully...");
Flag = true;
}
});
//
//
BottomBtnsLinearLayout.addView(launchChainedPaymentBtn);
Log.v("Btn added ", "SuccessFully...");
// }
// });
Log.i("Lib. initialized", "now...");
/** Calling Thread to add Btn to It! **/
AddPayPalBtn.start();
} else {
Log.i("Cannot Initialize Payment Btn",
"setAPyment Btn..failed due to Lib. initialization..");
}
}
};
libraryInitializationThread.start();
我在我的活动的onCreate()方法中调用了上述线程。
dealResponseLogic()只处理验证的代码。
initLibrary();它使PayPal实例利用互联网,然后设置该实例的一些字段。
我知道我可以调用该线程从该btn监听器代码btn我正在寻找另一种方式。
请...任何帮助将不胜感激......
请问您可以上传代码吗? – Lucifer
你能发表一些代码吗?我不明白什么问题确切地是 – zeiger
我加了代码,请检查... – MobileEvangelist