I'm using Android studio to develop my android app. I have created files i use in android studio in Assets folder in sub folder red_voznje. This is my code
fileLinija = "smbzag";
if(TimeDay == 7) fileLinija += "sub";
else if(TimeDay == 1) fileLinija += "ned";
GetFromTime(fileLinija);
fileLinija = "zagsmb";
if(TimeDay == 7) fileLinija += "sub";
else if(TimeDay == 1) fileLinija += "ned";
GetToTime(fileLinija);
and for here is GetToTime function and GetFromTime is basiclly same I just save resault in TimeMinFromSmb instead of TimeMinToSmb
public void GetToTime(String file){
AssetManager mngr;
String red = null;
int Timemin=0;
int Timeh=0;
try{
mngr = getAssets();
InputStream is = mngr.open(file);
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
do
{
red=br.readLine();
Timeh = Character.getNumericValue(red.charAt(0));
if(Timeh == 9){
break;
}
Timeh *= 10;
Timeh += Character.getNumericValue(red.charAt(1));
Timemin = Character.getNumericValue(red.charAt(3));
Timemin *= 10;
Timemin += Character.getNumericValue(red.charAt(4));
LinijaBusaToSmb = Character.getNumericValue(red.charAt(6));
LinijaBusaToSmb *= 10;
LinijaBusaToSmb += Character.getNumericValue(red.charAt(7));
}while((TimeH>Timeh)||((TimeH == Timeh)&&(Timemin<TimeMin)));//popraviti
if(TimeMin <= Timemin) {
TimeMinSmjerToSmb = Timemin - TimeMin;
TimeHSmjerToSmb = Timeh - TimeH;
}else{
TimeMinSmjerToSmb = 60 - TimeMin + Timemin;
TimeHSmjerToSmb = Timeh - TimeH - 1;
}
}
catch (Exception e){}
}
both smbzag and zagsmb exist in Assets folder but smbzag is not opened stops on creating InputStream from asset manager. What can I do to fix this?
I have deleted all assets and added them in assets directory using windows explorer, and added extension .txt