public void onClick(View v) {
          if (v == buttonSave) {
            Log.v(TAG, "buttonSave Clicked");
            dialogSave(currMatrix);
          } else if (v == buttonDelete) {
            Log.v(TAG, "buttonDel Clicked");
            if (currMatrix.getId() > 0) {
              dialogDelete(currMatrix);
            } else {
              toastMessage(getString(R.string.unsaved));
            }
          } else if (v == buttonSend) {
            updateMatrixInfo(currMatrix);

            msgBuffer = new StringBuilder("B:");
            msgBuffer.append(currMatrix.getMatrix()).append("\n");

            UploadAsyncTask asyncTask = new UploadAsyncTask();
            asyncTask.execute();
          }
        }
Ejemplo n.º 2
0
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    // Handle action bar item clicks here. The action bar will
    // automatically handle clicks on the Home/Up button, so long
    // as you specify a parent activity in AndroidManifest.xml.
    int id = item.getItemId();

    //noinspection SimplifiableIfStatement
    if (id == R.id.action_save) {
      // Toast.makeText(this, "Save",Toast.LENGTH_LONG).show();
      // save();
      if (validation()) {
        String url = "https://dlcapi.herokuapp.com/api/Produits/" + idProduit;
        UploadAsyncTask uploadAsyncTask = new UploadAsyncTask();
        uploadAsyncTask.execute(url);
      }

      return true;
    }

    return super.onOptionsItemSelected(item);
  }