Error adding image to a URI - "can not find symbol class fromFile"

0

Well, I can not find out why Android Studio does not recognize the Uri.fromFile() method. I researched in several places but nothing. My code looks like this:

foto.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            Intent irParaCamera = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);

            caminhoArquivo = getExternalFilesDir(null) + "/" + System.currentTimeMillis() + ".png";
            File arquivo = new File(caminhoArquivo);

            Uri localFoto = new Uri.fromFile(arquivo);
            irParaCamera.putExtra(MediaStore.EXTRA_OUTPUT, localFoto);

            startActivityForResult(irParaCamera, 123);
        }
    });

The strangest thing is that Android Studio even suggests that I use this method, but when I use it it does not recognize it. Follow the imports:

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.provider.MediaStore;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageView;
import java.io.File;

Am I doing something wrong? Thanks in advance.

    
asked by anonymous 30.06.2015 / 02:04

1 answer

0

I discovered the error guys. In the excerpt:

Uri localFoto = new Uri.fromFile(arquivo);

There is no "new". It was enough to get it out that worked.

Hugs

    
30.06.2015 / 03:21