I can open files on Android with the Delphi code shown below. But when I compile it at API 26, it gives the error I added in the picture below. How can I solve this problem?
ExtFile := AnsiLowerCase(StringReplace(TPath.GetExtension(yol), '.', '',[]));
mime := TJMimeTypeMap.JavaClass.getSingleton();
ExtToMime := mime.getMimeTypeFromExtension(StringToJString(ExtFile));
Intent := TJIntent.Create;
Intent.setAction(TJIntent.JavaClass.ACTION_VIEW);
Intent.setDataAndType(StrToJURI('file:' + yol), ExtToMime);
SharedActivity.startActivity(Intent);
Thank you so much for your help. I'm glad that I finally came across this kind of understanding person on this platform. I tried the .pas file you sent. but I see a different error window. I share my codes and the error. thank you so much.
var
  ExtFile,yol,deger,id:string;
  mime: JMimeTypeMap;
  ExtToMime: JString;
  Intent: JIntent;
  javafile:JFile;
begin
  yol:='/sdcard/SkyWiFiDownload/sancak.jpg';
  javafile:=TJFile.JavaClass.init(StringToJString(yol));
  ExtFile := AnsiLowerCase(StringReplace(TPath.GetExtension(yol), '.', '',[]));
  mime := TJMimeTypeMap.JavaClass.getSingleton();
  ExtToMime := mime.getMimeTypeFromExtension(StringToJString(ExtFile));
  Intent := TJIntent.Create;
  id:=JStringToString(TAndroidHelper.Context.getApplicationContext.
  getPackageName) + '.fileprovider';
  deger:=JURIToStr(TJFileProvider.JavaClass.getUriForFile(
  TAndroidHelper.Context,StringToJString(id),javafile));
  Intent.setAction(TJIntent.JavaClass.ACTION_VIEW);
  Intent.setFlags(1);
  Intent.setDataAndType(StrToJURI(deger), ExtToMime);
  SharedActivity.startActivity(Intent);
end;  

(source: resmim.net) 
 
     
    