Welcome! Log In Create A New Profile

Advanced

WM28: Call WLanguage proc from native java class SOLVED

Posted by Marijan Tomasic 
WM28: Call WLanguage proc from native java class SOLVED
August 23, 2023 01:14PM
How to Call WLanguage proc from native java class added in "Other" folder of project explorer?

function callWLProcedure() is not visible from inside java class code ?



Edited 1 time(s). Last edit at 08/25/2023 02:30PM by Marijan Tomasic.
Re: WM28: Call WLanguage proc from native java class
August 23, 2023 01:56PM
Re: WM28: Call WLanguage proc from native java class
August 23, 2023 02:24PM
I did not explain well...

How to call callWLProcedure() from inside java class code?
(CallReciver.java is imported in "Other" folder of ProjectExplorer)


public class CallReceiver extends BroadcastReceiver {

    @Override
    public void onReceive(Context context, Intent intent) {

	int duration = Toast.LENGTH_LONG;
	Toast toast = Toast.makeText(context, "onRecive...", duration);
    	toast.show();

        String action = intent.getAction();
        if (action.equals("android.intent.action.PHONE_STATE")) {
            String phoneState = intent.getStringExtra(TelephonyManager.EXTRA_STATE);
            if (phoneState.equals(TelephonyManager.EXTRA_STATE_RINGING)) {

                callWLProcedure();

            }
        }
    }

 
}

I get error "cannot find simbol" on callWLProcedure() line...

I think some kind of prefix is needed when the function is called from the class declaration.:

??????.callWLProcedure()

I think this is a JAVA knowledge issue...



Edited 2 time(s). Last edit at 08/24/2023 08:04AM by Marijan Tomasic.
WM28: Call WLanguage proc from native java class SOLVED
August 25, 2023 02:28PM
In the last few days I have made progress in getting to know JAVA on Android,
so I will share with you the solution to the problem (my way):


Problem:

How to call a JAVA function written in WindevMobile, from an external imported class
(Windev ProjectExplorer->Other->SomeImportedJavaClass.java):



Solution:

1. Define an abstract function in the SomeImportedJavaClass class, e.g.:

protected abstract void MyFutureWDFunction(...);


2. In your global JAVA function in WindevMobile, write extended class and override MyFutureWDFunction, and create a WDSomeImportedJavaClass class object:

class WDSomeImportedJavaClass extends SomeImportedJavaClass {

         @Override
         protected void MyFutureWDFunction(...) {

               // Here is your desired JAVA code written through Windev editor...
               // you can also use callWLProcedure*

         }
}

WDSomeImportedJavaClass NameOfObject = new WDSomeImportedJavaClass();

In this way, you can adapt and use various ready-made JAVA classes
written in Android Studio and other tools in your WindevMobile Android projects...


Regards!
Marijan Tomasic



Edited 4 time(s). Last edit at 08/25/2023 02:42PM by Marijan Tomasic.
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: