小编luk*_*e88的帖子

如何在照片后更新Android图库?

对于大学,我将在面部检测器上开发一个Android应用程序.为此,我要在我的画廊中保存各种照片.问题是保存照片后,图库不会更新.更确切地说,如果我删除了我要保存图像的目录,我打开应用程序并拍摄照片,然后进入图库,在"更新"后我看到了照片.但是一旦我有了目录,如果我拍了一张新照片,就不会覆盖旧照片了.

在线我发现了这个:

    sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED,Uri.parse("file://" + Environment.getExternalStorageDirectory())));
Run Code Online (Sandbox Code Playgroud)

......但它不起作用!

这是我的代码:

    .
    .
    .
      ImageButton buttonPicture = (ImageButton) findViewById(R.id.camera_surface_button);
                        buttonPicture.setOnClickListener(new OnClickListener(){
                                public void onClick(View v) {
                                        mCamera.takePicture(null, null, jpegCallback); 
                                        //File file = new File(savedPath, "ing.jpg");
                                        sendBroadcast(new         Intent(Intent.ACTION_MEDIA_MOUNTED,Uri.parse("file://" +     Environment.getExternalStorageDirectory())));

                                }
                        });
     .
     .
     .
     .

    PictureCallback jpegCallback = new PictureCallback() {
                public void onPictureTaken(byte[] _data, Camera _camera) {
                        imagesFolder = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES), "/TTRprova");
                        imagesFolder.mkdirs();
                        String fileName = "image3.jpg";

                        File output = new File(imagesFolder, fileName);

                        textView1.setText("-----Sono nella callback-----");

                        Uri outputFileUri = Uri.fromFile(output);
                        String filePath …
Run Code Online (Sandbox Code Playgroud)

android photo gallery face-detection android-intent

5
推荐指数
1
解决办法
7515
查看次数

Quartz.net CancellationToken

在我的计划程序中,使用quartz.net v3实现,我正在尝试测试取消令牌的行为:

....
IScheduler scheduler = await factory.GetScheduler();
....
var tokenSource = new CancellationTokenSource();
CancellationToken ct = tokenSource.Token;
// Start scheduler
await scheduler.Start(ct);
// some sleep 
await Task.Delay(TimeSpan.FromSeconds(60));
// communicate cancellation
tokenSource.Cancel();
Run Code Online (Sandbox Code Playgroud)

我有一个无限运行的测试作业,并在Execute方法中检查取消令牌:

public async Task Execute(IJobExecutionContext context)
{
    while (true)
    {
        if (context.CancellationToken.IsCancellationRequested)
        {
            context.CancellationToken.ThrowIfCancellationRequested();
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

我希望当tokenSource.Cancel()被解雇时,作业将输入if并引发Exception。但这是行不通的。

.net c# scheduler quartz-scheduler quartz.net

5
推荐指数
1
解决办法
2256
查看次数

GCRectMake的iOS错误 - 将'int'发送到不兼容类型'CGRect'(又名'struct CGRect')的参数

我是iOS编程的新手.

我正在关注一本指南,这本书正是在意大利语的iOS上.对于第一个应用程序,我必须ViewController.m像这样修改:

#import "ViewController.h"

@implementation ViewController

- (void)didReceiveMemoryWarning{
    [super didReceiveMemoryWarning];
    // Release Any chached data, images, etc that aren't in use.
}    

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
}

- (void)datiDettaglioChiudi:(datiDettaglio *)controller{
    //altre operazioni possibii dopo la dismissModal
    NSLog(@"... di ritorno dal DismissModal...");
    [controller dismissViewControllerAnimated:YES completion:nil];
}

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{
    if([segue.identifier isEqualToString:@"dettaglio"]){
        datiDettaglio *mioController1 = segue.destinationViewController;
        [mioController1 setDelegate:self];
        //aggiunta di una UILabel - qui è …
Run Code Online (Sandbox Code Playgroud)

objective-c uiviewcontroller ios cgrectmake

3
推荐指数
1
解决办法
5967
查看次数