I have a problem with a feature of my application. I need to open external files to display them like .jpeg or .xls for example. For that I use Intents to open them with the default system application and it works fine. But in a case where we will first open a document, for example a photo. this will display in the default app and then I go back and forth in my app. Everything is OK But then I'm going to open another standard .xls document, it'll open the document in the appropriate application and going back will show the opened image first and not my application again. I don't understand why it happens like this. What I would like is that when we do previous in a file viewer app, the app quits and doesn't stay in the ActivityManager. Is it possible ? I have already tried some intent flags but without success.
My code here :
Android.Net.Uri fileUri = FileProvider.GetUriForFile(Android.App.Application.Context, "com.app.fileprovider"
, file);
Intent intent = new Intent(Intent.ActionView);
intent.SetData(fileUri);
intent.AddFlags(ActivityFlags.GrantReadUriPermission);
intent.AddFlags(ActivityFlags.NewTask);
intent.AddFlags(ActivityFlags.NoHistory);
Android.App.Application.Context.StartActivity(intent);
return true;
Thanks a lot for the help
Max B
CodePudding user response:
SO ! My bad, It was not a real problem. It was a design error. Indeed during my call of my function to call the intention I linked my opening event without then unbinding it. So that with each call I recalled X times my file opening function without ever destroying my variable or my variable instance.
The Intent Works Well Thanks for the comments