// Esse método trata os retornos
  @Override
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {

    Bundle parametros = null;

    if (data != null) parametros = data.getExtras();
    if (requestCode == ExemploParametros) {
      switch (resultCode) {
        case RESULT_OK:
          if (parametros != null) {

            String valor = parametros.getString("VALOR");
            AlertDialog.Builder dlg = new AlertDialog.Builder(this);
            dlg.setMessage("O valor do parametro é: " + valor);
            dlg.setNeutralButton("OK", null);
            dlg.show();
          }

          break;

        case RESULT_CANCELED:
          AlertDialog.Builder dlg = new AlertDialog.Builder(this);
          dlg.setMessage("Operação cancelada");
          dlg.setNeutralButton("OK", null);
          dlg.show();

          break;
      }
    }
  }
  public static Dialog createExternalStorageWarningDialog(final Context ctx, boolean finish) {

    AlertDialog.Builder builder = new AlertDialog.Builder(ctx);

    builder
        .setMessage(ctx.getResources().getString(R.string.no_external_storage))
        .setCancelable(false);
    if (finish) {

      builder.setNeutralButton(
          R.string.ok,
          new DialogInterface.OnClickListener() {

            @Override
            public void onClick(DialogInterface dialog, int which) {
              ((Activity) ctx).finish();
            }
          });

    } else {
      builder.setNeutralButton(
          R.string.ok,
          new DialogInterface.OnClickListener() {

            @Override
            public void onClick(DialogInterface dialog, int which) {}
          });
    }

    return builder.create();
  }
  public static Dialog createFromException(
      Exception e, String title, final Context ctx, boolean finish) {
    AlertDialog.Builder builder = new AlertDialog.Builder(ctx);

    builder.setCancelable(false);
    if (title == null) {
      builder.setTitle(R.string.dialog_error_title);
    } else {
      builder.setTitle(title);
    }
    builder.setMessage(e.getLocalizedMessage());

    if (finish) {
      builder.setNeutralButton(
          R.string.ok,
          new DialogInterface.OnClickListener() {

            @Override
            public void onClick(DialogInterface dialog, int which) {
              ((Activity) ctx).finish();
            }
          });
    } else {
      builder.setNeutralButton(
          R.string.ok,
          new DialogInterface.OnClickListener() {

            @Override
            public void onClick(DialogInterface dialog, int which) {}
          });
    }

    return builder.create();
  }
Example #4
0
  public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
    if (arg2 == 0) {
      AlertDialog.Builder raumDialog = new AlertDialog.Builder(this);
      raumDialog.setTitle("Informationen zum Raum " + nummer);
      raumDialog.setMessage("Hier stehen alle Informationen zum Raum.");
      raumDialog.setNeutralButton(
          "ok",
          new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface arg0, int arg1) {}
          });
      raumDialog.show();
    }

    if (arg2 == 1) {
      AlertDialog.Builder raumDialog = new AlertDialog.Builder(this);
      raumDialog.setTitle("" + nummer);
      raumDialog.setIcon(R.drawable.raum_foto);
      raumDialog.setNeutralButton(
          "ok",
          new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface arg0, int arg1) {}
          });
      raumDialog.show();
    }

    if (arg2 == 2) {
      Intent intent = new Intent(CamNavSicht.this, WebSicht.class);
      startActivity(intent);
    }
    if (arg2 == 3) {
      flip.setDisplayedChild(2);
    }
  }
  public void onClick(View view) {
    final Context context = view.getContext();

    AlertDialog.Builder dialog = new AlertDialog.Builder(context);
    final EditText input = new EditText(context);
    input.setText(String.valueOf(degrees));
    input.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL);
    input.setSelectAllOnFocus(true);
    dialog.setView(input);
    dialog.setOnCancelListener((OnCancelListener) context);
    dialog.setPositiveButton(
        context.getString(R.string.ok),
        new DialogInterface.OnClickListener() {
          public void onClick(DialogInterface dialog, int which) {
            try {
              degrees = Double.parseDouble(input.getText().toString());
            } catch (NumberFormatException exception) {
              Toast.makeText(context, R.string.error_no_number_entered, Toast.LENGTH_SHORT).show();
            }
            dialog.cancel();
          }
        });
    dialog.setNeutralButton(
        context.getString(R.string.cancel_button),
        new DialogInterface.OnClickListener() {
          public void onClick(DialogInterface dialog, int which) {
            dialog.cancel();
          }
        });

    AlertDialog finishedDialog = dialog.create();
    finishedDialog.setOnShowListener(Utils.getBrickDialogOnClickListener(context, input));

    finishedDialog.show();
  }
  public void photoNameInputAlert() {
    AlertDialog.Builder alert = new AlertDialog.Builder(this);
    alert.setTitle(getString(R.string.app_name));

    answerText = new EditText(this);
    answerText.setHint("Answer Here");
    answerText.setTextSize(20);
    answerText.setWidth(ViewGroup.LayoutParams.MATCH_PARENT);
    answerText.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT);

    alert.setView(answerText);

    alert.setPositiveButton(
        "Okay",
        new DialogInterface.OnClickListener() {
          public void onClick(DialogInterface dialog, int whichButton) {
            checkAnswer(answerText.getText().toString());
          }
        });
    alert.setNegativeButton(
        "Cancel",
        new DialogInterface.OnClickListener() {
          public void onClick(DialogInterface dialog, int whichButton) {
            // Canceled.
          }
        });
    alert.setNeutralButton(
        "Say It!",
        new DialogInterface.OnClickListener() {
          public void onClick(DialogInterface dialog, int whichButton) {
            startVoiceRecognitionActivity();
          }
        });
    alert.show();
  }
  @Override
  public boolean onKeyDown(int keyCode, KeyEvent event) {
    if (keyCode == KeyEvent.KEYCODE_BACK) {
      AlertDialog.Builder adb = new AlertDialog.Builder(this);
      adb.setCancelable(true);

      adb.setNeutralButton(
          "Yes",
          new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface arg0, int arg1) {
              // TODO Auto-generated method stub
              // CODE TO EXTEND RESERVATION
              finish();
            }
          });

      adb.setMessage("Do you Want to Exit");
      adb.show();

      adb.setNegativeButton(
          "No",
          new DialogInterface.OnClickListener() {

            @Override
            public void onClick(DialogInterface arg0, int arg1) {
              // TODO Auto-generated method stub

            }
          });
      return true;
    }
    return super.onKeyDown(keyCode, event);
  }
  @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.aboutus) {

      AlertDialog.Builder builder1 = new AlertDialog.Builder(this);
      builder1.setTitle("Test Information");
      builder1.setMessage(
          "Organic Chemistry quiz is an Interactive Quiz App for Testing your Knowledge in Organic chemistry. There are so many categories and each category will have a bunch of exciting questions .Each Quiz will have variable number questions and you will have only 60 seconds to answer each question. Each correct answer carries 4 points and a wrong answer will have negative marking of 1 point.Click on the OK button to continue to the Quiz!!");
      builder1.setCancelable(true);
      builder1.setNeutralButton(
          android.R.string.ok,
          new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int id) {
              dialog.cancel();
            }
          });

      AlertDialog alert11 = builder1.create();
      alert11.show();
      return true;
    }

    return super.onOptionsItemSelected(item);
  }
 @Override
 public void onBackPressed() {
   Fragment fragment =
       getSupportFragmentManager().findFragmentById(R.id.fragmentTransatctionEditor);
   if (fragment instanceof TransactionEditFragment) {
     final TransactionEditFragment editFragment = (TransactionEditFragment) fragment;
     if (editFragment.shouldSave()) {
       AlertDialog.Builder builder = new Builder(TransactionEditorActivity.this);
       builder.setTitle("Save changes");
       builder.setMessage("Do you want to save the changes of the editor?");
       builder.setNeutralButton(R.string.cancel, null);
       builder.setNegativeButton(
           R.string.close,
           new DialogInterface.OnClickListener() {
             @Override
             public void onClick(DialogInterface dialog, int which) {
               finish();
             }
           });
       builder.setPositiveButton(
           R.string.save,
           new DialogInterface.OnClickListener() {
             @Override
             public void onClick(DialogInterface dialog, int which) {
               editFragment.saveEditor();
               finish();
             }
           });
       builder.create().show();
       return;
     }
   }
   super.onBackPressed();
 }
Example #10
0
  // 处理键盘事件
  public boolean onKeyDown(int keyCode, KeyEvent event) {
    // TODO Auto-generated method stub

    if (keyCode == KeyEvent.KEYCODE_BACK) {
      AlertDialog.Builder builder = new AlertDialog.Builder(this);
      builder.setTitle("提示");
      builder.setMessage("确定要退出程序?");
      builder.setPositiveButton(
          "确定",
          new DialogInterface.OnClickListener() {

            @Override
            public void onClick(DialogInterface dialog, int which) {
              // TODO Auto-generated method stub
              dialog.dismiss();
              finish();
            }
          });
      builder.setNeutralButton(
          "取消",
          new DialogInterface.OnClickListener() {

            @Override
            public void onClick(DialogInterface dialog, int which) {
              // TODO Auto-generated method stub
              dialog.dismiss();
            }
          });
      builder.show();
      return true;
    } else {

      return super.onKeyDown(keyCode, event);
    }
  }
  private void showErrorDialog(
      final String title,
      final String message,
      final String techInfo,
      final boolean showingTechInfo) {
    String m = message;
    if (showingTechInfo && techInfo != null) m += ". " + techInfo;

    AlertDialog.Builder builder =
        new AlertDialog.Builder(MainActivity.this)
            .setIcon(R.drawable.irma_error)
            .setTitle(title)
            .setMessage(m)
            .setPositiveButton(R.string.dismiss, null);

    if (techInfo != null) {
      int buttonText = showingTechInfo ? R.string.lessinfo : R.string.techinfo;
      builder.setNeutralButton(
          buttonText,
          new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialogInterface, int i) {
              showErrorDialog(title, message, techInfo, !showingTechInfo);
            }
          });
    }

    builder.show();
  }
  /**
   * On click for enter button, checks whether a patient is currently in the ER. If not, raises
   * MissingPatientException and catches it.
   */
  public void patientView(View view) {
    // Specifies the next Activity to move to: PatientView.
    Intent intent = new Intent(this, PatientView.class);

    // Gets health card from the text view
    EditText healthCardText = (EditText) findViewById(R.id.health_card_field);
    String healthCard = healthCardText.getText().toString();
    Patient selectedPatient = null;
    try {
      // Get patient object from ER collection of patient's
      selectedPatient = nurse.lookup_patient(healthCard, er);
      // store nurse and current patient object for next activity
      intent.putExtra("patientKey", selectedPatient);
      intent.putExtra("nurseKey", nurse);
      intent.putExtra("user", user);
      startActivity(intent); // Starts DisplayActivity.
      this.finish();
    } catch (MissingPatientException e) {
      // Display alert dialog
      AlertDialog.Builder dialog = new AlertDialog.Builder(this);
      dialog.setTitle("Missing Patient");
      dialog.setMessage(e.getMessage());
      dialog.setNeutralButton("Ok", null);
      dialog.create().show();
    }
  }
 @Override
 public void onListItemClick(ListView l, View v, int position, long id) {
   selectedInbox = position;
   AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
   builder.setPositiveButton(
       R.string.app_discoveryinbox_approve,
       new DialogInterface.OnClickListener() {
         public void onClick(DialogInterface dialog, int id) {
           sendInboxApprove(mDiscoveryInboxAdapter.getItem(selectedInbox).getThingUID());
         }
       });
   builder.setNeutralButton(
       R.string.app_discoveryinbox_ignore,
       new DialogInterface.OnClickListener() {
         public void onClick(DialogInterface dialog, int id) {
           sendInboxIgnore(mDiscoveryInboxAdapter.getItem(selectedInbox).getThingUID());
         }
       });
   builder.setNegativeButton(
       R.string.app_discoveryinbox_delete,
       new DialogInterface.OnClickListener() {
         public void onClick(DialogInterface dialog, int id) {
           sendInboxDelete(mDiscoveryInboxAdapter.getItem(selectedInbox).getThingUID());
         }
       });
   builder.setCancelable(true);
   builder.setTitle(R.string.app_discoveryinbox_deviceaction);
   builder.show();
 }
 public void showMessage(String Title, String Text) {
   AlertDialog.Builder message = new AlertDialog.Builder(RegisterTime.this);
   message.setTitle(Title);
   message.setMessage(Text);
   message.setNeutralButton("Ok", null);
   message.show();
 }
  protected void showNamespaceSelectDialog() {
    int count = namespaceList.size();
    boolean[] selected = new boolean[count];
    CharSequence[] namespacesArray = new CharSequence[count];

    for (int i = 0; i < count; i++) {
      selected[i] = enabledNamespaces.contains(namespaceList.get(i));
      namespacesArray[i] = namespaceList.get(i);
    }

    DialogInterface.OnMultiChoiceClickListener coloursDialogListener =
        new DialogInterface.OnMultiChoiceClickListener() {
          @Override
          public void onClick(DialogInterface dialog, int which, boolean isChecked) {
            synchronized (lockObj) {
              if (isChecked) enabledNamespaces.add(namespaceList.get(which));
              else enabledNamespaces.remove(namespaceList.get(which));
            }
          }
        };

    AlertDialog.Builder builder = new AlertDialog.Builder(serverConnection.getContext());
    builder.setTitle("Select Namespaces");
    builder.setMultiChoiceItems(namespacesArray, selected, coloursDialogListener);
    builder.setNeutralButton("Ok", null);

    AlertDialog dialog = builder.create();
    dialog.show();
  }
  public void stationDetailDialog(String nom, int index) {

    AlertDialog.Builder ad = new AlertDialog.Builder(this);
    ad.setTitle(nom);
    ad.setMessage(gpStation.getLatitudeE6() / 1E6 + " - " + gpStation.getLongitudeE6() / 1E6);
    ad.setNeutralButton(
        android.R.string.ok,
        new android.content.DialogInterface.OnClickListener() {
          public void onClick(DialogInterface dialog, int arg1) {
            mController.animateTo(gpStation);
          }
        });

    ad.setPositiveButton(
        "Go there",
        new android.content.DialogInterface.OnClickListener() {
          public void onClick(DialogInterface dialog, int arg1) {
            new Thread(
                    new Runnable() {
                      public void run() {
                        goThere();
                      }
                    })
                .start();
          }
        });
    ad.show();
  }
  public void alertboxNeutral(String title, String message, String positive, String neutral) {

    AlertDialog.Builder alertbox = new AlertDialog.Builder(AddCityActivity.this);

    alertbox.setTitle(title);

    alertbox.setMessage(message);

    alertbox.setPositiveButton(
        positive,
        new DialogInterface.OnClickListener() {

          public void onClick(DialogInterface dialog, int id) {

            Intent i = new Intent(AddCityActivity.this, HomeActivity.class);

            startActivity(i);
          }
        });

    alertbox.setNeutralButton(
        neutral,
        new DialogInterface.OnClickListener() {

          public void onClick(DialogInterface dialog, int id) {

            EditText ed = (EditText) findViewById(R.id.cityname);

            ed.setText("");
          }
        });

    alertbox.show();
  }
 private void showCameraDialog() {
   AlertDialog.Builder builder = new AlertDialog.Builder(this);
   builder.setTitle("提示");
   builder.setMessage("选择拍照方式...");
   builder.setPositiveButton(
       "拍照",
       new DialogInterface.OnClickListener() {
         @Override
         public void onClick(DialogInterface dialogInterface, int i) {
           if (SystemUtil.isHasSdCard()) {
             // 指定照片保存路径(SD卡),image.jpg为一个临时文件,每次拍照后这个图片都会被替换
             Uri imageUri =
                 Uri.fromFile(new File(Environment.getExternalStorageDirectory(), "image.jpg"));
             Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
             intent.putExtra(MediaStore.EXTRA_OUTPUT, imageUri);
             startActivityForResult(intent, START_SYSTEM_CAMERA);
           } else {
             Toast.makeText(DisImgActivity.this, "未检查到sd卡!", Toast.LENGTH_SHORT).show();
           }
         }
       });
   builder.setNegativeButton(
       "相册",
       new DialogInterface.OnClickListener() {
         @Override
         public void onClick(DialogInterface dialogInterface, int i) {
           Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
           intent.addCategory(Intent.CATEGORY_OPENABLE);
           intent.setType("image/*");
           startActivityForResult(intent, LOCAL_PIC);
         }
       });
   builder.setNeutralButton("取消", null).show();
 }
Example #19
0
 public static void showEulaBasic(Activity activity) {
   final AlertDialog.Builder builder = new AlertDialog.Builder(activity);
   builder.setTitle(R.string.DLG_eula_title);
   builder.setMessage(AndroidUtilities.readFile(activity, R.raw.eula));
   builder.setNeutralButton(android.R.string.ok, null);
   builder.show();
 }
Example #20
0
  @Override
  public Dialog onCreateDialog(Bundle savedInstanceState) {
    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    LayoutInflater inflater = getActivity().getLayoutInflater();
    final View view = (View) inflater.inflate(R.layout.dialog_tox_id, null);
    builder.setView(view);
    builder.setNeutralButton(
        getString(R.string.button_ok),
        new Dialog.OnClickListener() {
          public void onClick(DialogInterface dialogInterface, int ID) {
            mListener.onDialogClick(DialogToxID.this);
          }
        });

    /* Generate or load QR image of Tox ID */
    File file = new File(Environment.getExternalStorageDirectory().getPath() + "/Antox/");
    if (!file.exists()) {
      file.mkdirs();
    }

    File noMedia =
        new File(Environment.getExternalStorageDirectory().getPath() + "/Antox/", ".nomedia");
    if (!noMedia.exists()) {
      try {
        noMedia.createNewFile();
      } catch (IOException e) {
        e.printStackTrace();
      }
    }

    file = new File(Environment.getExternalStorageDirectory().getPath() + "/Antox/userkey_qr.png");
    SharedPreferences pref =
        PreferenceManager.getDefaultSharedPreferences(getActivity().getApplicationContext());
    generateQR(pref.getString("tox_id", ""));
    Bitmap bmp = BitmapFactory.decodeFile(file.getAbsolutePath());

    ImageButton qrCode = (ImageButton) view.findViewById(R.id.qr_image);
    qrCode.setImageBitmap(bmp);
    qrCode.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            Intent shareIntent = new Intent();
            shareIntent.setAction(Intent.ACTION_SEND);
            shareIntent.putExtra(
                Intent.EXTRA_STREAM,
                Uri.fromFile(
                    new File(
                        Environment.getExternalStorageDirectory().getPath()
                            + "/Antox/userkey_qr.png")));
            shareIntent.setType("image/jpeg");
            view.getContext()
                .startActivity(
                    Intent.createChooser(
                        shareIntent, getResources().getString(R.string.share_with)));
          }
        });

    return builder.create();
  }
Example #21
0
  public void showAboutDialog() {

    final TextView message = new TextView(this);
    final SpannableString spannableString =
        new SpannableString(getString(R.string.dialog_about_body));
    Linkify.addLinks(spannableString, Linkify.ALL);
    message.setText(spannableString);
    message.setMovementMethod(LinkMovementMethod.getInstance());

    AlertDialog.Builder dialog = new AlertDialog.Builder(this);
    dialog.setIcon(R.drawable.about);
    dialog.setTitle(getString(R.string.dialog_about_title));
    dialog.setMessage(spannableString);
    // dialog.setView(message);
    dialog.setNeutralButton(
        getString(R.string.dialog_ack),
        new DialogInterface.OnClickListener() {
          @Override
          public void onClick(DialogInterface dialog, int which) {
            dialog.dismiss();
          }
        });
    AlertDialog alertDialog = dialog.show();
    ((TextView) alertDialog.findViewById(android.R.id.message))
        .setMovementMethod(LinkMovementMethod.getInstance());
  }
Example #22
0
 @Override
 protected Dialog onCreateDialog(int id) { // Dialog preference
   Dialog dialog = null;
   switch (id) {
     case 0:
       {
         mProgressDialog = new ProgressDialog(this);
         mProgressDialog.setMessage("회원가입을 요청 중입니다...");
         mProgressDialog.setIndeterminate(true);
         mProgressDialog.setCancelable(true);
         return mProgressDialog;
       }
     case 1:
       {
         AlertDialog.Builder builder = new AlertDialog.Builder(this);
         builder.setTitle("Error");
         builder.setMessage("중복된 메일입니다.");
         builder.setNeutralButton(
             "OK",
             new DialogInterface.OnClickListener() {
               @Override
               public void onClick(DialogInterface dialog, int which) {
                 dialog.dismiss();
               }
             });
         AlertDialog errorAlert = builder.create();
         return errorAlert;
       }
   }
   return null;
 }
 void alert(String message) {
   AlertDialog.Builder bld = new AlertDialog.Builder(this);
   bld.setMessage(message);
   bld.setNeutralButton("OK", null);
   Log.d(TAG, "Showing alert dialog: " + message);
   bld.create().show();
 }
Example #24
0
  public void getMensage(String title, String mensage) {

    AlertDialog.Builder mensagem = new AlertDialog.Builder(CopaAdvisorActivity.this);
    mensagem.setTitle(title);
    mensagem.setMessage(mensage);
    mensagem.setNeutralButton("Fechar", null);
    mensagem.show();
  }
 private void showMessage(String caption, String title) {
   AlertDialog.Builder bilder = new AlertDialog.Builder(MostrarLista02.this);
   bilder.setMessage(caption);
   bilder.setNeutralButton("Ok", null);
   AlertDialog alert = bilder.create();
   alert.setTitle(title);
   alert.show();
 }
 private void messageBox(String titulo, String mensagem) {
   AlertDialog.Builder dialogo = new AlertDialog.Builder(this);
   dialogo.setTitle(titulo);
   dialogo.setMessage(mensagem);
   dialogo.setNeutralButton("OK", null);
   dialogo.setIcon(R.drawable.icon);
   dialogo.show();
 }
Example #27
0
  /**
   * Helper to create simple alert dialog to display message
   *
   * @param msg message to display in alert dialog
   * @return the alert dialog
   */
  private AlertDialog createSimpleDialog(String msg) {
    // CPSC 210 Students; You should not need to modify this method
    AlertDialog.Builder dialogBldr = new AlertDialog.Builder(getActivity());
    dialogBldr.setMessage(msg);
    dialogBldr.setNeutralButton(R.string.ok, null);

    return dialogBldr.create();
  }
  public void SuccesfullMessage(String errMsg) // Alert used to show error
      {
    AlertDialog.Builder builder = new AlertDialog.Builder(this);

    builder.setMessage(errMsg).setCancelable(false);

    builder.setNeutralButton(
        "Ok",
        new DialogInterface.OnClickListener() {
          @Override
          public void onClick(DialogInterface dialog, int which) {
            dialog.cancel();

            count = myPrefs.getInt("count", 0);

            count = count + 1;

            prefsEditor.putInt("count", count).commit();

            System.out.println("COUNT " + forItemCode + count);

            base64 = "";

            if (llForAdding.getVisibility() == View.VISIBLE) {
              listForClothes =
                  database.getItems(
                      "Clothes"); // database method to fetch result for clothes section

              gAdapter = new GridAdapter(listForClothes); // adapter to show the result

              gridClothes.setAdapter(gAdapter);

              llForAdding.setVisibility(View.GONE);

              llForDisplay.setVisibility(View.VISIBLE);

              tvAddItem.setVisibility(View.VISIBLE);
            }

            edTitle.setText("");

            edColor.setText("");

            edDateOfPurchase.setText("");

            edLastAccessedDate.setText("");

            edBrand.setText("");
          }
        });

    AlertDialog settingsErrDialog = builder.create();

    try {
      settingsErrDialog.show();
    } catch (Exception e) {
    }
  }
Example #29
0
  private void startScan() {
    log(hrProvider.getProviderName() + ".startScan()");
    updateView();
    deviceAdapter.deviceList.clear();
    hrProvider.startScan();
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setTitle("Scanning");
    builder.setPositiveButton(
        "Connect",
        new DialogInterface.OnClickListener() {
          public void onClick(DialogInterface dialog, int which) {
            log(hrProvider.getProviderName() + ".stopScan()");
            hrProvider.stopScan();
            connect();
            updateView();
            dialog.dismiss();
          }
        });
    if (hrProvider.isBondingDevice()) {
      builder.setNeutralButton(
          "Pairing",
          new DialogInterface.OnClickListener() {

            @Override
            public void onClick(DialogInterface dialog, int which) {
              dialog.cancel();
              Intent i = new Intent(Settings.ACTION_BLUETOOTH_SETTINGS);
              startActivityForResult(i, 123);
            }
          });
    }
    builder.setNegativeButton(
        "Cancel",
        new DialogInterface.OnClickListener() {
          public void onClick(DialogInterface dialog, int which) {
            log(hrProvider.getProviderName() + ".stopScan()");
            hrProvider.stopScan();
            load();
            open();
            dialog.dismiss();
            updateView();
          }
        });

    builder.setSingleChoiceItems(
        deviceAdapter,
        -1,
        new DialogInterface.OnClickListener() {
          @Override
          public void onClick(DialogInterface arg0, int arg1) {
            HRDeviceRef hrDevice = deviceAdapter.deviceList.get(arg1);
            btAddress = hrDevice.getAddress();
            btName = hrDevice.getName();
          }
        });
    builder.show();
  }
Example #30
0
  public void onCreate(Bundle savedInstanceState) {
    Log.d("G33", "Entered Firstdisplay");
    super.onCreate(savedInstanceState);
    setContentView(R.layout.blank);
    String sender = "TEAM LOCATE FRIENDS INSTANTLY";
    Date d = new Date();
    String mes =
        "Thank you for installing Locate Friends Instantly."
            + " Imagine an application, which when you open, "
            + "you get to know about where are all your friends, relatives, etc, "
            + "and the information is so accurate that you can feel that you are seeing everyone. "
            + "You can plan your visit or can know "
            + "which friend is nearest to you. You can track you lost mobile and much much more. You have to use it to beleive it."
            + "Its superfast and you never get any stale information. And its the only application which achieve this by "
            + "making peer to peer direct connection with the other user's phone so you always get the fastest and most reliable information for free. "
            + " Also you can always send unlimited messages which are delivered at lightning speed."
            + "All you need is to just ask your friend to get the Applcation too so that you can add him/her "
            + "(Market search text : “Locate Friends Instnatly com.visd”). Now you have the Power never ever before. "
            + "Thank you, Team Locate Frineds Instantly";
    SQLiteDatabase db = openOrCreateDatabase("GiraffeDBv2", 0, null);
    db.execSQL(
        "CREATE TABLE IF NOT EXISTS Messages "
            + "(Party TEXT, Tim TEXT, Body TEXT, Flag TEXT, Misc4 TEXT);");
    Cursor c = db.rawQuery("SELECT * FROM Messages;", null);
    int icc = c.getCount();
    if (icc > 99) {
      Log.d("G31", "entere jutss to delete from firstdispaly !");
      c.moveToFirst();
      String tlu = c.getString(c.getColumnIndex("Tim"));
      db.delete("Messages", "Tim = " + "'" + tlu + "'", null);
    }
    c.close();

    //  String s = [[arrs[0] stringWithFormat:@"CREATE Table '%@' ('Name' 'char(50)','ID'
    // 'integer')",theString]UTF8String];
    String arrs0 = mes.toString().replace("'", "''");

    db.execSQL(
        "INSERT INTO Messages VALUES ('" + sender + "','" + d + "','" + arrs0 + "','FALSE','');");
    db.close();

    AlertDialog.Builder alertbox =
        new AlertDialog.Builder((new ContextThemeWrapper(this, R.style.AlertDialogCustom)));

    alertbox.setTitle(sender);
    alertbox.setMessage(mes);
    alertbox.setCancelable(false);
    alertbox.setNeutralButton(
        "Ok",
        new DialogInterface.OnClickListener() {
          public void onClick(DialogInterface dialog, int arg1) {
            dialog.dismiss();
            finish();
          }
        });
    alertbox.show();
  }