1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
| using System;
| using Android.Content;
| using Java.IO;
|
| namespace HDL_ON_Android
| {
| /// <summary>
| /// 常用方法工具类
| /// </summary>
| public class HDLONUtils
| {
| public HDLONUtils()
| {
| }
|
| /// <summary>
| /// 发送广播,通知刷新图库的显示
| /// </summary>
| /// <param name="path"></param>
| public static void SendBroadcastScanFile(Context context, string path)
| {
| try
| {
| // 发送广播,通知刷新图库的显示
| Intent scanIntent = new Intent(Intent.ActionMediaScannerScanFile);
| scanIntent.SetData(Android.Net.Uri.FromFile(new File(path)));
| context.SendBroadcast(scanIntent);
| }
| catch
| {
| System.Console.WriteLine("发送广播刷新图库 catch");
| }
| }
| }
| }
|
|