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();
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):