Android Question BigDecimal problem

astf

Member
Licensed User
Every time i tried to pass a BigDecimal value to PagSeguro (with intent), the value received by it is always 0

B4X:
...
   Private gValorRec as Double ' valor de recebimento
   Private valor As BigDecimal ' valor a passar pagseguro

   valor.Initialize(gValorArec)
   valor.SetScale(2)
...

B4X:
...
   In.PutExtra("FLAG_APP_PAYMENT_VALUE",valor)
...

Part of manual (java)
B4X:
...
   private static final String FLAG_APP_PAYMENT_VALUE = "FLAG_APP_PAYMENT_VALUE";

   BigDecimal paymentValue = new BigDecimal(“10.99”);

   Intent it = new Intent(Intent.ACTION_MAIN);
   it.setClassName(PAG_SEGURO_PACKAGE_NAME, PAG_SEGURO_CLASS_NAME);
   it.putExtra(FLAG_APP_PAYMENT_VALUE, paymentValue);
...

When o tried to pass a string value or zero, instead of var valor, pagseguro returns me "Value can't be lower than 1,00"


B4X:
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'' AÇÕES DE REQUISÃO AO APP PAGSEGURO
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'' CHAMA APP PAGSEGURO
Sub IniciaPagSeguro
    Dim In As Intent
   
    Try
        valor.Initialize(gValorArec)
        valor.SetScale(2)
       
    Catch
        Log(LastException)
    End Try


    Log(valor)
    In.Initialize(In.ACTION_MAIN,"")
    In.PutExtra("FLAG_APP_PAYMENT_VALUE",valor)
    In.SetComponent("br.com.uol.ps/br.com.uol.ps.app.MainActivity")
   
    StartActivityForResult(In)
End Sub

'' ESPERANDO O RESULTADO DO PAGSEGURO
Sub StartActivityForResult(In As Intent)
   Dim jo As JavaObject = GetBA
   ion = jo.CreateEvent("anywheresoftware.b4a.IOnActivityResult", "ion", Null)
   jo.RunMethod("startActivityForResult", Array As Object(ion, In))
End Sub

Sub GetBA As Object
   Dim jo As JavaObject
   Dim cls As String = Me
   cls = cls.SubString("class ".Length)
   jo.InitializeStatic(cls)
   Return jo.GetField("processBA")
End Sub
 
Last edited:

astf

Member
Licensed User
Nothing.....
i tried
B4X:
valor.Initialize(10)
valor.Initialize(10.99)
valor.Initialize(10,99)
valor.Initialize("10")
valor.Initialize("10.99")
valor.Initialize("10,99")
 
Upvote 0
Top