Here you can find the source of getScenario(Context context, String filename, int widgetid, int defaultScenario)
public static int getScenario(Context context, String filename, int widgetid, int defaultScenario)
//package com.java2s; import android.content.Context; import android.util.Log; import java.io.DataInputStream; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; public class Main { private final static boolean D = false; private final static String TAG = "ScenarioUtil"; public static int getScenario(Context context, String filename, int widgetid, int defaultScenario) { FileInputStream fis = null; DataInputStream dis = null; try {//from w w w . j ava 2 s .c om fis = context.openFileInput(filename); dis = new DataInputStream(fis); String line = null; do { line = dis.readLine(); if (line != null) { String[] strs = line.split(","); if (strs != null && strs.length >= 2) { int wid = Integer.valueOf(strs[0]).intValue(); int sce = Integer.valueOf(strs[1]).intValue(); if (D) { Log.d(TAG, "getScenario" + wid + "=>" + sce); } if (wid == widgetid) { if (D) { Log.d(TAG, "getScenario return " + wid + "=>" + sce); } return sce; } } } } while (line != null); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (NumberFormatException e) { e.printStackTrace(); } finally { if (dis != null) { try { dis.close(); } catch (IOException e) { e.printStackTrace(); } } if (fis != null) { try { fis.close(); } catch (IOException e) { e.printStackTrace(); } } } return defaultScenario; } }