TheOneAtFault
New Member
- Joined
- Jan 14, 2020
- Messages
- 2
- Reaction score
- 0
Ahoy hoay!
Bare with me on this one.
So some background; I am working in a development environment called WinDev, the mobile edition and it uses a language called WLanguage. It's handy for cross platform development, think Xamarin, and they make use of a customized android/gradle(not sure what the correct terminology is to use) and allow you to write Java procedures for some custom development.
What I am trying to achieve:
I have an external .aar library that I want to make use of. Now the library makes use of the AppCompatActivity class and on of the methods required an instance of this to be passed as a parameter:
The trick is, The Android version used by WinDev does not seem to have support for the "android.support.v7.app.AppCompatActivity;" library.
So I need to pass an instance of context from WinDev but the only two methods I can use to get some form of context are "getApplicationContext()" and "getCurrentActivity()"
From what I understand I should be able to use "getCurrentActivity()" and pass that to my .aar library where I then cast the "Activity" to "AppCompatActivity".
From WinDev:
In my .aar:
But this results in an exception stating the following:
"Failed resolution of: Landroidx/appcompat/app/AppCompatActivity; "
Now I am quite stuck and can't find my a way around this. If someone can advise me on this or point out my mistake, it would be greatly appreciated.
Thanks a bunch!
Bare with me on this one.
So some background; I am working in a development environment called WinDev, the mobile edition and it uses a language called WLanguage. It's handy for cross platform development, think Xamarin, and they make use of a customized android/gradle(not sure what the correct terminology is to use) and allow you to write Java procedures for some custom development.
What I am trying to achieve:
I have an external .aar library that I want to make use of. Now the library makes use of the AppCompatActivity class and on of the methods required an instance of this to be passed as a parameter:
Code:
public Example(AppCompatActivity var1, boolean var2, ServiceConfigurationEnum var3) {
}
The trick is, The Android version used by WinDev does not seem to have support for the "android.support.v7.app.AppCompatActivity;" library.
So I need to pass an instance of context from WinDev but the only two methods I can use to get some form of context are "getApplicationContext()" and "getCurrentActivity()"
From what I understand I should be able to use "getCurrentActivity()" and pass that to my .aar library where I then cast the "Activity" to "AppCompatActivity".
From WinDev:
Code:
imports ...
public static String Beta(){
//Context context = getApplicationContext();
Activity activity = getCurrentActivity();
Oscar oscar = new Oscar(activity);
String response = oscar.run();
return response;
}
In my .aar:
Code:
public Oscar(Activity activity) {
AppCompatActivity altContext = (AppCompatActivity) activity; //error occurs here
blob = new Example(altContext, true, ServiceConfigurationEnum.UAT);
}
But this results in an exception stating the following:
"Failed resolution of: Landroidx/appcompat/app/AppCompatActivity; "
Now I am quite stuck and can't find my a way around this. If someone can advise me on this or point out my mistake, it would be greatly appreciated.
Thanks a bunch!
Last edited: