I've made this code where the variable DEVICE
will change if a file exist or not. So i have made this code but the variable DEVICE
is always null
public class MainActivity extends AppCompatActivity{
String DEVICE;
@Override
protected void onCreate(Bundle savedInstanceState) {
apply = (Button) findViewById(R.id.apply);
apply.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
checktypezip(DEVICE);
while (DEVICE == null){
Log.v("Check","Check non completo");
}
}
});
}
public void checktypezip(String string){
String percorso = Environment.getExternalStorageDirectory().getPath()+"/BAC/.unzipfile/";
File normalzip = new File (percorso+"desc.txt");
File flashzip = new File (percorso+"/system/media/bootanimation.zip");
File samsung = new File (percorso+"/bootsamsung.qmg");
File flashsamsung = new File (percorso+"/system/media/bootsamsung.qmg");
String disp;
disp=string;
if (normalzip.exists()){
disp = "Normal";
string=disp;
}
else if (flashzip.exists()){
disp = "Flashnormal";
string=disp;
}
else if (samsung.exists()){
disp = "Samsung";
string=disp;
}
else if (flashsamsung.exists()){
disp = "Samsungflash";
string=disp;
}
else
{
disp = "Unknown";
string=disp;
}
}
}