JSON file doesn't work : <p>with my code, this line is underline in red by IDE...why?</p>

<p>THANKS everybody in advance!</p>

<pre><code>String path = Environment.getExternalStorageDirectory()
                .getAbsolutePath() + "/droidText/";
</code></pre>

<p>THIS IS MY CODE:</p>

<pre><code>public String showResult(View v) throws IOException {

        for (Planet p : plAdapter.getBox()) {
            if (p.isSelected()){
                result += "\n" + p.getName()+" "+p.getDistance()+"€"+"q.tà :"+p.getQuantità();
            }
        }


        //Toast.makeText(context, result + "\n" + "Total Amount:=" + totalAmount2 + "€", Toast.LENGTH_LONG).show();

        return result;*/
        String  result = "";

        JsonObject json = new JsonObject();
        for (Planet p : plAdapter.getBox()) {
            if (p.isSelected()){
                json.put("name",p.getName());
                json.put("distance",p.getDistance());
                json.put("quantity",p.getQuantità());
            }
        }
          return json.toString();

        String path = Environment.getExternalStorageDirectory()
                .getAbsolutePath() + "/droidText/";
        FileWriter file=null;
        try {
            file = new FileWriter(path+"filename.json");
            file.write(result);


        }catch(IOException ie){}
        finally{


            file.flush();
            file.close();
        }
        //System.out.println(result);
    }
</code></pre>
