I'm developing an app in which I'm sending a .txt file from one end by attaching it with gmail. Everytime this file is sent, its name is data.txt. When this file is downloaded at the other end, on the first download its name is the same, i.e. data.txt. However, when another file is sent with the same name, the name of the file at the receiveing end becomes data-1.txt, data-2.txt etc. And because of this, I'm not able to read the proper file. Please could someone give me some suggestions to solve this problem? The sending and receiving code is given below: SEND

```
  bSend.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            String fileName = "data";
            String toWrite = enterText.getText().toString();
            FileOutputStream fos;
            try {
                String path = Environment.getExternalStorageDirectory().toString();
                Log.v("path", path);
                File myFile = new File("" + path + "/" + fileName + ".txt");
                myFile.createNewFile();
                FileOutputStream fOut = new FileOutputStream(myFile);
                OutputStreamWriter myOutWriter = new OutputStreamWriter(fOut);
                myOutWriter.append(toWrite);
                Log.v("file written", toWrite);
                myOutWriter.close();
                fOut.close();
                Uri u1 = null;
                u1 = Uri.fromFile(myFile);

                Intent sendIntent = new Intent(Intent.ACTION_SEND);
                sendIntent.putExtra(Intent.EXTRA_SUBJECT, "MPPT Configuration Data");
                sendIntent.putExtra(Intent.EXTRA_STREAM, u1);
                sendIntent.setType("text/html");
                startActivity(sendIntent);

            } catch (IOException e1) {
                e1.printStackTrace();
            }

        }
    });

```

READ:

```
  bRead.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            String fileName = "data";
            StringBuffer stringBuffer = new StringBuffer();
            String aDataRow = "";
            String aBuffer = "";
            try {

                    File myFile = new File("/storage/sdcard0/download/" + fileName + ".txt");
                    FileInputStream fIn = new FileInputStream(myFile);
                    BufferedReader myReader = new BufferedReader(
                            new InputStreamReader(fIn));
                    while ((aDataRow = myReader.readLine()) != null) {
                        aBuffer += aDataRow + "\n";
                    }
                    myReader.close();
                    Log.v("read data", "" + aBuffer);
                    tvData.setText(aBuffer);

            }catch (IOException e2) {
                e2.printStackTrace();
            }
        }
    });

```