Dear all,
I found in line java is fun to play with, so I tried to access a third party SDK using the inline java feature.
But I have one problem with the word "this" in the original java codes of the SDK I am testing.
This is the original java codes:
And when I compile, I got this error:
I wonder what's wrong with it, so I just changed the word "this" to "null" like this:
Then I could compile the project without any errors. I am really doubt about this as I believe changing the word "this" to "null" is not good solution and can cause some errors at anytime.
Can anyone explain me something about this or suggest a better solution?
I found in line java is fun to play with, so I tried to access a third party SDK using the inline java feature.
But I have one problem with the word "this" in the original java codes of the SDK I am testing.
This is the original java codes:
B4X:
private void destroyVideoAd() {
// (Optional) Cancel listener for earning currency points. If register listener in onCreate, remember to cancel
// it.
VideoAdManager.getInstance(this).unRegisterRewards(this);
// Remember to invoke the below code on application exit, to tell SDK that the application is closed, which can
// make SDK release some resource about video.
VideoAdManager.getInstance(this).onDestroy();
}
And when I compile, I got this error:
B4X:
ObfuscatorMap.txt file created in Objects folder.
Compiling layouts code. (0.00s)
Generating R file. (0.24s)
Compiling generated Java code. Error
javac 1.7.0_79
src\com\trialpay\example\main.java:649: error: method unRegisterRewards in class VideoAdManager cannot be applied to given types;
VideoAdManager.getInstance(this).unRegisterRewards(this);
^
required: VideoRewardsListener
found: main
reason: actual argument main cannot be converted to VideoRewardsListener by method invocation conversion
1 error
I wonder what's wrong with it, so I just changed the word "this" to "null" like this:
B4X:
VideoAdManager.getInstance(this).unRegisterRewards(null);
Then I could compile the project without any errors. I am really doubt about this as I believe changing the word "this" to "null" is not good solution and can cause some errors at anytime.
Can anyone explain me something about this or suggest a better solution?