title: Getting Java.io.closeable Error in Android
body: <p>I am getting the following error. While running my program. I am unable to understand the problem.
  A resource was acquired at attached stack trace but never released. See java.io.Closeable for information on avoiding resource leaks.</p>
  
  <p><strong>Code</strong></p>
  
  <pre><code>ArrayList&lt;String&gt; selection = new ArrayList&lt;&gt;();
  TextView finaltext = null;
      @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
          finaltext = (TextView)findViewById(R.id.final_result);
          finaltext.setEnabled(false);
  }
  public void selectItem(View view)
  {
      boolean checked = ((CheckBox) view).isChecked();
      switch (view.getId())
      {
          case R.id.fruit_apple:if (checked){selection.add("Apple");}else {selection.remove("Apple");}
          break;
          case R.id.fruit_orange:if (checked){selection.add("Orange");}else {selection.remove("Orange");}
          break;
          case R.id.fruit_grape:if (checked){selection.add("Grapes");}else {selection.remove("Grapes");}
          break;
      }
  }
  </code></pre>
  
  <p><strong>XML</strong>
      </p>
  
  <pre><code>&lt;TextView
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:text="@string/title_message"
      android:textAppearance="?android:textAppearanceLarge"
      android:layout_gravity="center_horizontal"/&gt;
  &lt;CheckBox
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  android:id="@+id/fruit_apple"
  android:text="@string/apple"
  android:onClick="selectItem"/&gt;
  &lt;CheckBox
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:id="@+id/fruit_orange"
      android:text="@string/orange"
      android:onClick="selectItem"
      /&gt;
  &lt;CheckBox
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:id="@+id/fruit_grape"
      android:text="@string/grapes"
      android:onClick="selectItem"/&gt;
  &lt;Button
      android:layout_width="100dp"
      android:layout_height="wrap_content"
      android:text="done"
      android:layout_gravity="center_horizontal"
      android:onClick="finalSelection"/&gt;
  &lt;TextView
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:id="@+id/final_result"
      android:text="Hello World"/&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>