0

It is the first time I try to convert some Jni bridges. However I'm getting some troubles when converting some data types.

The first one is related to this autogenerated header:

Every time I try to recompile (Without the original .pas file, once I can't compile anymore (IDE restrictions)) I get some errors in the following line:

/* TJavaImport.Create */ inline __fastcall TJToast(void * ID, void * ClsID, Androidapi::Jnibridge::TJavaVTable* VTable) : Androidapi::Jnibridge::TJavaGenericImport__2<_di_JToastClass,_di_JToast> (ID, ClsID, VTable) { }

ERROR:

[bccaarm Error] Androidapi.JNI.Toast.hpp(76): no matching constructor for initialization of 'Androidapi::Jnibridge::TJavaGenericImport__2<_di_JToastClass, _di_JToast>' Androidapi.JNIBridge.hpp(197): candidate constructor not viable: requires 0 arguments, but 3 were provided
Androidapi.JNIBridge.hpp(174): candidate constructor (the implicit copy constructor) not viable: requires 1 argument, but 3 were provided

The other is related to

I was using a library wich getBonded() had already been implemented, but once I'm unable to use .pas files anymore I have to implement it manually, so I got it:

void getBonded(TStringList* res){

    JBluetoothAdapter* x;
    JSet* externalDevices;
    JIterator* it;
    JBluetoothDevice* o;
    JBluetoothDevice* remote;
    JBluetoothSocket* xx;

    x = TJBluetoothAdapter::JavaClass->getDefaultAdapter();

    externalDevices = x->getBondedDevices();
    it = externalDevices->iterator();

    while (it->hasNext()){
        o = TJBluetoothDevice::Wrap(it->next()::ILocalObject::GetObjectID());
        res->Add(JStringToString(o->getName())+"="+JStringToString(o->getAddress()));
    }
}

But I get errors in the following line:

        o = TJBluetoothDevice::Wrap(it->next()::ILocalObject::GetObjectID());

Errors:

[bccaarm Error] Main.cpp(2423): expected ';' at end of declaration [bccaarm Error] Main.cpp(2424): call to 'Wrap' is ambiguous
Androidapi.JNIBridge.hpp(187): candidate function
Androidapi.JNIBridge.hpp(188): candidate function

So I've changed the last one to (but hasn't tested yet):

o = TJBluetoothDevice::Wrap(it->next()->IJavaInstance);

Since now, thank you a lot;

mauroaraujo
  • 332
  • 1
  • 10
  • 23
  • Seems I've fixed the first problem Just by removing the 3 arguments provided, so it just became: `/* TJavaImport.Create */ inline __fastcall TJToast() : Androidapi::Jnibridge::TJavaGenericImport__2<_di_JToastClass,_di_JToast> () { }` – mauroaraujo Dec 29 '15 at 20:33
  • Probably I also got a workaraound with a simple cast in the second problem (not tested yet because of a problem described in other topic). Here you have the workaraound: `conv = _di_ILocalObject(it->next()); o = TJBluetoothDevice::Wrap(conv->GetObjectID());` – mauroaraujo Dec 30 '15 at 02:04

0 Answers0