@Override
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    // TODO Auto-generated method stub
    switch (requestCode) {
      case CSV_RESULT:
        if (resultCode == RESULT_OK) {

          String FilePath = data.getData().getPath();

          String FileName = data.getData().getLastPathSegment();
          // int lastPos = FilePath.length() - FileName.length();
          // String Folder = FilePath.substring(0, lastPos);

          okbt.setEnabled(true);
          filename.setText("File Name: \n" + FileName + "\n");
          obj = new ReadCVS();
          obj.run(FilePath, getBaseContext());
          // filename.setText(obj..toString());
          Toast.makeText(this, FilePath, Toast.LENGTH_SHORT).show();
          FName = obj.retFName();
          FSN = obj.retSN();
          FID = obj.retFID();
          // Toast.makeText(this,FName.get(1),Toast.LENGTH_SHORT ).show();//test
        }
    }
  }
Example #2
0
  public static void main(String[] args) {

    ReadCVS obj = new ReadCVS();
    try {
      obj.run();
    } catch (IOException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
  }
  public static List<Index> getIndex() {
    List<Index> listIndex = new ArrayList<>();

    for (Map<String, String> line : ReadCVS.run(pathTowns)) {

      DBObject town =
          new BasicDBObject()
              .append("townName", line.get("TOWNNAME"))
              .append(
                  "location",
                  Arrays.asList(Double.valueOf(line.get("X")), Double.valueOf(line.get("Y"))));

      listIndex.add(new Index.Builder(town).id(line.get("OBJECTID")).build());
    }
    return listIndex;
  }