问题
String path = Environment.getExternalStorageDirectory() + File.separator + Environment.DIRECTORY_PICTURES+ File.separator + "Screenshots";
FileObserver fileObserver = new FileObserver(path, FileObserver.CREATE) {
@Override
public void onEvent(int event, String path) {
Intent mIntent = new Intent(MainActivity.this,MainActivity.class);
mIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
getApplicationContext().startActivity(mIntent);
}
};
fileObserver.startWatching();
来源:https://stackoverflow.com/questions/39092557/issue-in-app-open-with-fileobserver