Advertisement
AmidamaruZXC

Untitled

May 19th, 2020
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.98 KB | None | 0 0
  1. public class ScrabbleApp extends Application {
  2.  
  3.     public static ArrayList<String> dictionary;
  4.  
  5.     @Override
  6.     public void onCreate() {
  7.         super.onCreate();
  8.  
  9.         initDictionary();
  10.  
  11.     }
  12.  
  13.     private void initDictionary(){
  14.         dictionary = new ArrayList<>();
  15.         BufferedReader bufferedReader = null;
  16.         try {
  17.             bufferedReader = new BufferedReader(new InputStreamReader
  18.                     (getResources().openRawResource(R.raw.russian), StandardCharsets.UTF_8));
  19.             String line;
  20.             while ((line = bufferedReader.readLine()) != null) {
  21.                 dictionary.add(line);
  22.             }
  23.         } catch (IOException e) {
  24.             e.printStackTrace();
  25.         } finally {
  26.             if (bufferedReader != null) {
  27.                 try {
  28.                     bufferedReader.close();
  29.                 } catch (IOException e) {
  30.                     e.printStackTrace();
  31.                 }
  32.             }
  33.         }
  34.     }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement