Olá Pessoal,
Estou fazendo uma classe que vai gravar e buscar as fotos no SDcard. Porém está ocorrendo erros de sintaxe que não estou entendendo o porquê.
package medicapp.application.tcc;
import java.io.File;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Environment;
import android.widget.ImageView;
public class SdCard {
private DBAdapter db;
private Bitmap bm = null;
private boolean mExternalStorageAvailable = false;
private boolean mExternalStorageWriteable = false;
private String state = Environment.getExternalStorageState();
if (Environment.MEDIA_MOUNTED.equals(state)) {
// We can read and write the media
mExternalStorageAvailable = mExternalStorageWriteable = true;
} else if (Environment.MEDIA_MOUNTED_READ_ONLY.equals(state)) {
// We can only read the media
mExternalStorageAvailable = true;
mExternalStorageWriteable = false;
} else {
// Something else is wrong. It may be one of many other states, but all we need
// to know is we can neither read nor write
mExternalStorageAvailable = mExternalStorageWriteable = false;
}
public Bitmap getPicture(int iPatient) {
if (mExternalStorageAvailable = mExternalStorageWriteable = true) {
String column = "image";
String pathPicture = db.queryPatient(iPatient, column);
File file = new File(pathPicture);
if (file.exists()){
bm = BitmapFactory.decodeFile(file.getPath());
return bm;
}else{
return null;
}
}
}
}
Na linha 15 “private String state = Environment.getExternalStorageState();” está pedindo um abre-chaves.
Na lina 30 “public Bitmap getPicture(int iPatient) {” está pedindo dois ; (ponto e vírgula)
Na linha 52, no fecha chaves, está pedindo outro fecha chaves, mas está certo.
Alguém pode me ajudar?