Dear all,
Today I tried to access a third party SDK using Inline Java but got stuck with onActivityResult error.
I really don't know where to fix this!
This is the original java code:
When I tried to compile the app, B4A showed me the following message:
So it says "error: method onActivityResult(int,int,Intent) is already defined in class main", but I checked my codes and found no method that is named onActivityResult.
Can anyone help me to solve this problem? I have learnt a lot about using Inline Java from helpful people on this forum and I feel very happy Please help me fix this issue!
Today I tried to access a third party SDK using Inline Java but got stuck with onActivityResult error.
I really don't know where to fix this!
This is the original java code:
B4X:
static final int PLAY_REWARDED_VIDEO = 1;
public void showadvideo() {
String publisherId = "32740";
String profileId = "365";
String subid1 = "demo_subid1";
Intent intent = RewardedVideoActivity.getIntentForRewardedVideo(this, publisherId, profileId, subid1);
startActivityForResult(intent, PLAY_REWARDED_VIDEO);
}
public void onActivityResult(int requestCode, int resultCode, Intent data) {
BA.Log("onActivityResult");
// PLAY_REWARDED_VIDEO was declared earlier to identify intent request
if (requestCode == PLAY_REWARDED_VIDEO && resultCode == RESULT_OK)
{
// user was successfully credited
Log.d("AdscendMedia_", "User was credited");
}
else if (requestCode == PLAY_REWARDED_VIDEO && resultCode == RESULT_CANCELED)
{
// user was not credited
Log.d("AdscendMedia_", "User was not credited");
}
}
When I tried to compile the app, B4A showed me the following message:
B4X:
Compiling code. (0.02s)
Compiling layouts code. (0.00s)
Generating R file. (1.04s)
Compiling generated Java code. Error
javac 1.7.0_79
src\com\adscendmedia\helloadscend1\main.java:529: error: method onActivityResult(int,int,Intent) is already defined in class main
public void onActivityResult(int requestCode, int resultCode, Intent data) {
^
1 error
So it says "error: method onActivityResult(int,int,Intent) is already defined in class main", but I checked my codes and found no method that is named onActivityResult.
Can anyone help me to solve this problem? I have learnt a lot about using Inline Java from helpful people on this forum and I feel very happy