出于某种原因,buyIntentBundle.getParcelable(“BUY_INTENT”);返回null意味着我的应用程序停止运行
以下是相关代码:
String sku;
public void buyHint(){
try {
Bundle buyIntentBundle = mService.getBuyIntent(3, getPackageName(),
sku, "inapp", "(id used here)");
boolean buyintent=false;
if(buyIntentBundle!=null){
buyintent=true;
}
Log.d("buyintent"+buyintent,"daa");
PendingIntent pendingIntent = buyIntentBundle.getParcelable("BUY_INTENT");
boolean buyintentparcel=false;
if(buyIntentBundle.getParcelable("BUY_INTENT")!=null){
buyintentparcel=true;
}
Log.d("buyparcel"+buyintentparcel,"da");
try {
startIntentSenderForResult(
pendingIntent.getIntentSender(),
1131, new Intent(), Integer.valueOf(0), Integer.valueOf(0), Integer.valueOf(0));
} catch (SendIntentException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} catch (RemoteException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
所以,使用我的各种Log方法,我能够确定buyIntent包不是null,但是buyIntentBundle.getParcelable(“BUY_INTENT”)是......任何想法
非常感谢您的帮助
答案 0 :(得分:2)
PendingIntent pendingIntent = buyIntentBundle.getParcelable("BUY_INTENT");
可以返回NULL
。