Android Question Activity use on Java code..

EduardoElias

Well-Known Member
Licensed User
Longtime User
I was happy using the following code:

B4X:
#if java
import anywheresoftware.b4a.BA;
import anywheresoftware.b4a.*;

import android.app.Activity;
import android.content.Context;

import java.util.HashMap;
import java.util.List;

import br.com.destaxa.destaxasdk.DestaxaSDK;
import br.com.destaxa.destaxasdk.DestaxaSDKDynamicField;
import br.com.destaxa.destaxasdk.DestaxaSDKKeyword;
import br.com.destaxa.destaxasdk.DestaxaSDKTransactionListener;
import br.com.destaxa.destaxasdk.DestaxaSDKDebugListener;

public static class TransactionActivity implements DestaxaSDKTransactionListener, DestaxaSDKDebugListener {

    private DestaxaSDK destaxaSDK;

    private String     comprovanteEstabelecimento;
    private String     comprovanteCliente;
    private String     comprovanteClienteSMS;
    private String     relatorioTransacoes;
    private String    nsu;

    private BA ba;

    public TransactionActivity(B4AClass parent) {
        ba = parent.getBA();
    }


    private int                transactionType;
    
    final int ttAtivacao = 1;
    final int ttCancelamento = 2;
    final int ttComprovante = 3;
    final int ttRelatorios = 4;

    public void setTransactionType(int transactionType) {
        this.transactionType = transactionType;
    }
    
    public int getTransactionType() {
        return this.transactionType;
    }

    public void Start(Context c) {
        BA.Log("Transaction.Ativar loadSDK");

        destaxaSDK.loadSDK(c);
    }
    
    public void Cancelar(double valorCancelamento, String numeroDocumento, String dataTransacao) {
        BA.Log("Transaction.Cancelar");

        setTransactionType(ttCancelamento);
        destaxaSDK.cancelarTransacao(valorCancelamento, numeroDocumento, dataTransacao);
    }

    public void Preparar(Context c, Activity a, boolean Producao, string MAC) {
        BA.Log("Transaction.Prepare");
    
         destaxaSDK = new DestaxaSDK(this, a);

        // servidor producao
        if (Producao) {
            BA.Log("Transaction.Preparar definirServidor PRODUCAO");
            destaxaSDK.configurar("app-prod.destaxa.cloud", 60906, "1.1.0", "DASHEN", "**** DASHEN ****", MAC);
        } else {
            BA.Log("Transaction.Preparar definirServidor QA");
            destaxaSDK.configurar("app-stag.destaxa.cloud", 60906, "1.1.0", "DASHEN", "**** DASHEN ****", MAC);
        }
    }

Now I am getting the following error:

B4X:
B4A Version: 11.00
Parsing code.    (0.17s)
    Java Version: 8
Building folders structure.    (0.04s)
Compiling code.    (0.10s)
Compiling layouts code.    (0.00s)
Organizing libraries.    (0.00s)
    (AndroidX SDK)
Compiling resources    (0.19s)
Linking resources    (1.26s)
Compiling generated Java code.    Error
javac 1.8.0_60
src\yashar\yTEF\ynexu.java:559: error: cannot find symbol
    public void Preparar(Context c, Activity a, boolean Producao, string MAC) {
                                                                  ^
  symbol:   class string
  location: class TransactionActivity
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
1 error

*** Legacy debugger is deprecated. ***
 It is recommended to switch to the default debugger (Tools - IDE Options).

Not sure if something changed on the latests version of B4A
 
Top