I'm trying to request permissions, it's throwing an unknown method for registerForActivityResult, at first I was using regular android.app.Activity, because, due to lack of a PC at the moment, I've been using AIDE, and I was having issues with AppCompatActivity before, but I noticed that the registerForActivityResult() method belongs to ActivityResultCaller which isn't implemented by Activity but is implemented by AppCompatActivity, so I switched my main activity over to extending AppCompatActivity, along the way I've changed out a bunch of imports and dependencies, and can't get it to work, I also tried to just implement ActivityResultCaller, but then that error goes away and everything fits, but then it says I'm not implementing the abstract method registerForActivityResult, which I am and now has no red lines or errors around it, so I went back to not implementing it and trying to get it to work with plain appcompatactivity, because in all the tutorials that I saw they weren't having to state that MainActivityimplements ActivityResultCaller, so I messed around more with the dependencies, at this point I don't really remember all that I've done, so I probably have some in there now that isn't necessary, I've cut away most of the code to make it simpler, but this is where I'm at now, any suggestions?
package com.mycompany.MyApp;
import android.app.*;
import android.os.*;
import android.view.Window;
import android.view.WindowManager;
import android.support.v4.content.*;
import android.content.Context;
import androidx.activity.result.*;
import android.provider.*;
import androidx.core.app.*;
import android.content.Intent;
import android.net.Uri;
import android.content.pm.*;
import androidx.activity.result.contract.*;
import androidx.activity.*;
import android.provider.*;
import java.security.*;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.*;
public class MainActivity extends AppCompatActivity{
String[] permissions = {android.Manifest.permission.READ_EXTERNAL_STORAGE, android.Manifest.permission.WRITE_EXTERNAL_STORAGE};
public static MainActivity instance;
public ActivityResultLauncher<Intent> activityResultLauncher;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
activityResultLauncher =
registerForActivityResult(
new ActivityResultContracts.StartActivityForResult(),
new ActivityResultCallback<ActivityResult>(){
@Override
public void onActivityResult(ActivityResult result){
}
});
setContentView( new Game(this));
}
}
And here's the build.gradle file
android {
compileSdkVersion 21
buildToolsVersion "21.1.0"
defaultConfig {
applicationId "com.mycompany.MyApp"
minSdkVersion 14
targetSdkVersion 29
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation "androidx.activity:activity:1.4.0"
implementation "androidx.activity:activity:1.2.0-rc01"
compile fileTree(dir: 'libs', include: ['*.jar'])
Implementation "com.android.support:support-v4:23.+"
Implementation "com.android.support:appcompat-v7:22.1.0"
}