我得到的错误,当我做支付,我总是得到这样的错误,我能够得到哪里是窗口泄漏错误。
这是我的代码
private fun showAlertWithTextInputLayout(context: Context) {
val textInputLayout = TextInputLayout(context)
textInputLayout.setPadding(
resources.getDimensionPixelOffset(R.dimen.dp_19),
0,
resources.getDimensionPixelOffset(R.dimen.dp_19),
0
)
val input = EditText(context)
textInputLayout.hint = "Coin"
input.inputType= InputType.TYPE_CLASS_NUMBER + InputType.TYPE_NUMBER_FLAG_DECIMAL + InputType.TYPE_NUMBER_FLAG_SIGNED
textInputLayout.addView(input)
val alert = AlertDialog.Builder(context)
.setTitle("Add Coins")
.setView(textInputLayout)
.setMessage("How many coin wants to add?")
.setPositiveButton("Add") {
dialog, _ ->
if (!input.text.equals("") ){
launchPayUMoneyFlow(input.text.toString())
}else{
AppLogger.toast("Please enter some value.")
}
dialog.cancel()
}
.setNegativeButton("Cancel") { dialog, _ ->
dialog.cancel()
}.create()
alert.show()
}
private var mAppPreference: AppPreference? = null
private var mPaymentParams: PayUmoneySdkInitializer.PaymentParam? = null
private val isDisableExitConfirmation = false
lateinit var binding: ActivityPaymentBinding
lateinit var usetId:String
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = DataBindingUtil.setContentView(this, R.layout.activity_payment)
initView()
}
private fun initView() {
if(MoodApplication.sharedPreference.getValueUserLogedIn()!=null && MoodApplication.sharedPreference.getValueUserLogedIn()!!.data!!.id!=null ){
usetId = MoodApplication.sharedPreference.getValueUserLogedIn()!!.data!!.id!!
}
mAppPreference = AppPreference()
binding.btnBack.setOnClickListener(this)
binding.cardAddGift.setOnClickListener(this)
binding.cardReceivedGift.setOnClickListener(this)
binding.cardRedeem.setOnClickListener(this)
binding.cardTransctionHistory.setOnClickListener(this)
binding.cardSendGift.setOnClickListener(this)
selectSandBoxEnv()
setupCitrusConfigs()
}
override fun onResume() {
super.onResume()
val points=MoodApplication.sharedPreference.getValueUserLogedIn()!!.data!!.referralpoints
if (points!=null){
binding.tvTotalPonits.text=points
}
}
private fun setupCitrusConfigs() {
val appEnvironment = (application as MoodApplication).getAppEnvironment()
if (appEnvironment === AppEnvironment.PRODUCTION) {
} else {
}
}
private fun selectSandBoxEnv() {
(application as MoodApplication).setAppEnvironment(AppEnvironment.SANDBOX)
setupCitrusConfigs()
}
private fun launchPayUMoneyFlow(payMoney:String) {
val payUmoneyConfig = PayUmoneyConfig.getInstance()
payUmoneyConfig.doneButtonText = "Pay"
payUmoneyConfig.payUmoneyActivityTitle = "Pay :"+payMoney
payUmoneyConfig.disableExitConfirmation(isDisableExitConfirmation)
val builder = PayUmoneySdkInitializer.PaymentParam.Builder()
var amount = 0.0
try {
amount = java.lang.Double.parseDouble(payMoney)
} catch (e: Exception) {
e.printStackTrace()
}
val txnId = System.currentTimeMillis().toString() + ""
//String txnId = "TXNID720431525261327973";
val phone = MoodApplication.sharedPreference.getValueUserLogedIn()!!.data!!.phoneNumber
val productName = mAppPreference!!.productInfo
val firstName = mAppPreference!!.firstName
val email = MoodApplication.sharedPreference.getValueUserLogedIn()!!.data!!.email
val udf1 = ""
val udf2 = ""
val udf3 = ""
val udf4 = ""
val udf5 = ""
val udf6 = ""
val udf7 = ""
val udf8 = ""
val udf9 = ""
val udf10 = ""
val appEnvironment = (application as MoodApplication).getAppEnvironment()
builder.setAmount(amount.toString())
.setTxnId(txnId)
.setPhone(phone)
.setProductName(productName)
.setFirstName(firstName)
.setEmail(email)
.setsUrl(appEnvironment.surl())
.setfUrl(appEnvironment.furl())
.setUdf1(udf1)
.setUdf2(udf2)
.setUdf3(udf3)
.setUdf4(udf4)
.setUdf5(udf5)
.setUdf6(udf6)
.setUdf7(udf7)
.setUdf8(udf8)
.setUdf9(udf9)
.setUdf10(udf10)
.setIsDebug(appEnvironment.debug())
.setKey(appEnvironment.merchant_Key())
.setMerchantId(appEnvironment.merchant_ID())
Log.e("@@MerchantKEy",appEnvironment.merchant_Key() )
Log.e("@@MerchantKEy",appEnvironment.merchant_ID() )
Log.e("@@MerchantKEy",appEnvironment.salt() )
try {
mPaymentParams = builder.build()
mPaymentParams = calculateServerSideHashAndInitiatePayment1(mPaymentParams!!)
if (AppPreference.selectedTheme != -1) {
PayUmoneyFlowManager.startPayUMoneyFlow(mPaymentParams, this@WalletActivity, AppPreference.selectedTheme, mAppPreference!!.isOverrideResultScreen)
} else {
PayUmoneyFlowManager.startPayUMoneyFlow(mPaymentParams, this@WalletActivity, R.style.AppTheme_default, mAppPreference!!.isOverrideResultScreen)
}
} catch (e: Exception) {
Toast.makeText(this, e.message, Toast.LENGTH_LONG).show()
// payNowButton!!.isEnabled = true
}
}
private fun calculateServerSideHashAndInitiatePayment1(paymentParam: PayUmoneySdkInitializer.PaymentParam): PayUmoneySdkInitializer.PaymentParam {
val stringBuilder = StringBuilder()
val params = paymentParam.params
stringBuilder.append(params[PayUmoneyConstants.KEY]!! + "|")
stringBuilder.append(params[PayUmoneyConstants.TXNID]!! + "|")
stringBuilder.append(params[PayUmoneyConstants.AMOUNT]!! + "|")
stringBuilder.append(params[PayUmoneyConstants.PRODUCT_INFO]!! + "|")
stringBuilder.append(params[PayUmoneyConstants.FIRSTNAME]!! + "|")
stringBuilder.append(params[PayUmoneyConstants.EMAIL]!! + "|")
stringBuilder.append(params[PayUmoneyConstants.UDF1]!! + "|")
stringBuilder.append(params[PayUmoneyConstants.UDF2]!! + "|")
stringBuilder.append(params[PayUmoneyConstants.UDF3]!! + "|")
stringBuilder.append(params[PayUmoneyConstants.UDF4]!! + "|")
stringBuilder.append(params[PayUmoneyConstants.UDF5]!! + "||||||")
val appEnvironment = (application as MoodApplication).getAppEnvironment()
stringBuilder.append(appEnvironment.salt())
val hash = Membership.hashCal(stringBuilder.toString())
paymentParam.setMerchantHash(hash)
return paymentParam
}
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
Log.d("MainActivity", "request code $requestCode resultcode $resultCode")
try {
if (requestCode == PayUmoneyFlowManager.REQUEST_CODE_PAYMENT && resultCode == Activity.RESULT_OK && data != null) {
val transactionResponse = data.getParcelableExtra<TransactionResponse>(PayUmoneyFlowManager
.INTENT_EXTRA_TRANSACTION_RESPONSE)
val resultModel = data.getParcelableExtra<ResultModel>(PayUmoneyFlowManager.ARG_RESULT)
if (transactionResponse != null && transactionResponse.getPayuResponse() != null) {
if (transactionResponse.transactionStatus == TransactionResponse.TransactionStatus.SUCCESSFUL) {
val payuResponse = transactionResponse.getPayuResponse()
var gson: Gson = Gson()
var response = gson.fromJson(payuResponse, PayumoneyResponse::class.java)
Log.e("@@Response", response.toString())
addoinsApi(response.result.amount)
} else {
}
} else if (resultModel != null && resultModel.error != null) {
Log.d(Membership.TAG, "Error response : " + resultModel.error.transactionResponse)
} else {
Log.d(Membership.TAG, "Both objects are null!")
}
}
} catch (e: Exception) {
Toast.makeText(this, e.message, Toast.LENGTH_LONG).show()
}
}
private fun addoinsApi(amount: String) {
AndroidNetworking.post(Constant.BASE_URL + "app.php?api=addCoins")
.addUrlEncodeFormBodyParameter("userid",usetId)
.addUrlEncodeFormBodyParameter("addcoins",amount)
.setTag("addCoins")
.setContentType("application/x-www-form-urlencoded")
.setPriority(Priority.MEDIUM)
.build()
.getAsString(object : StringRequestListener {
override fun onResponse(response: String) {
AppLogger.e("addCoins response","====="+response)
val loginModel: LoginModel? =MoodApplication.sharedPreference.getValueUserLogedIn()
loginModel!!.data!!.referralpoints=(Integer.parseInt(loginModel.data!!.referralpoints.toString())+java.lang.Double.parseDouble(amount).toInt()).toString()
MoodApplication.sharedPreference.saveSigninUser(loginModel)
binding.tvTotalPonits.text=loginModel.data!!.referralpoints
AlertDialog.Builder(this@WalletActivity)
.setCancelable(false)
.setMessage("Coins successfully added.")
.setPositiveButton(android.R.string.ok) {
dialog, whichButton -> dialog.dismiss()
}.show()
}
override fun onError(error: ANError) {
AppLogger.toast(error.localizedMessage)
Log.e(" addCoins Error", "=======" + error.localizedMessage)
}
})
}
}
我得到了错误,我已经看到了很多答案,但我没有得到,所以请帮助我,谢谢你提前,我会感激每一个答案
错误是
20568-20568/com.example.moods E/WindowManager: android.view.WindowLeaked: Activity com.payumoney.core.SdkWebViewActivityNew has leaked window DecorView@7f9a05a[SdkWebViewActivityNew] that was originally added here
我认为,由于dialog的原因,此错误首先发生,您使用dialog.dismiss()
不要使用dialog.Cancel()
并且您必须在重写onDestroy()
方法和onpause()
方法中取消dialog。
@Override
protected void onPause() {
super.onPause();
if(dialog!=null)
dialog.dismiss();
}
@Override
protected void onDestory() {
super.onDestory();
if(dialog!=null)
dialog.dismiss();
}
我希望这项工作...
我正在尝试整合payumoney支付网关在我的网站。我能完成交易。然而,我正在寻找一种方法,以获得已被收取的金额作为交易费的一个特定的交易。我在payumoney服务器在交易成功后发送的交易响应对象中找不到此字段,请帮助我。 示例: 响应对象:{“Country”:“”,“UDF10”:“”,“Discount”:“0.00”,“CardToken”:“789CE930DF72D5693ADFC”
1. 前言 大家好,本小节,我们学习代理模式解决转账过程中产生的事务问题,如有中途而来的童鞋,请先移步上一小节学习下问题的场景。 2. 实战案例 2.1 实现思路介绍 1. 创建一个工具类,目的是用于管理数据库的事务,提供事务的开启,提交,回滚等操作; 2. 创建一个代理处理器类,目的是生成转账实现类的代理对象,对转账的业务方法提供增强,主要是在数据操作之前,和操作之后干点事,嘿嘿嘿; 3. 在
问题内容: 我在下一行出现错误。我正在做添加到jsonarray的过程。请帮我。 问题答案: 这是我在重新编程时经常遇到的错误。此异常的原因或细节非常清楚。不允许在迭代时修改集合(正在添加新元素)。至少不支持语法。 为了解决您的问题,我认为有两种方法很简单。 1)。而不是使用语句来循环,更好的方法是使用迭代器来避免ConcurrentModificationException。 2)。在循环播放时
当我试图用Docker构建PLC4X时,我获得了一个错误。我试图从Linux系统中构建它,并从虚拟机(托管在Windows机器中)中的Linux中构建它,在这两种情况下,我都获得了一个错误。 在Linux机器上,我得到了以下错误: 第20/36步:跑步/mvnw-P带有沙箱、boost、dotnet、python、代理和logstash com。2点起飞。专家插件:maven依赖插件:3.1.1。
问题内容: 下面是我的控制器,它从sql db中读取数据,然后尝试将结果编码为JSON并将数据发送回我的gridview.js 这就是问题所在,使用上面的代码,我在执行gridview.js时得到了没有数据的gridview表,但是如果我直接访问控制器的方法是这样的 我得到这个错误, 序列化类型为’System.Globalization.CultureInfo’的对象时,检测到循环引用。 说明:
我试图从不同的目录级别导入模块,因此我使用: 但现在我得到了这个错误。我正在使用Spyder,第一次使用以下导入时,它运行良好。 从第二次我得到这个错误。 文件“ipython-input-29-f35dfe634c32”,第1行,在模块运行文件中('C:/Users/nrshakya/Documents/CI/src/Comp\u IntelPython/CI\u search\u projec