Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void OpenCategroyDialogBox() {
- LayoutInflater layoutInflater = LayoutInflater.from(this);
- View promptView = layoutInflater.inflate(R.layout.addnewcategory, null);
- final AlertDialog.Builder alert = new AlertDialog.Builder(this);
- alert.setTitle("Dodaj link do serialu");
- alert.setView(promptView);
- final EditText input = (EditText) promptView
- .findViewById(R.id.etCategory);
- final EditText input2 = (EditText) promptView
- .findViewById(R.id.etCategory2);
- input.requestFocus();
- input.setHint("Podaj link");
- input.setTextColor(Color.BLACK);
- input2.setHint("Podaj nazwę");
- input2.setTextColor(Color.BLACK);
- alert.setPositiveButton("OK", new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int whichButton) {
- String newCategoryName = input.getText().toString();
- String newCategoryName2 = input2.getText().toString();
- // Do something with value!
- if (newCategoryName.equals("") || newCategoryName2.equals("") ) {
- //input.setError("Name Required");
- OpenCategroyDialogBox();
- } else {
- ZarzadcaBazy zb = new ZarzadcaBazy(getApplicationContext());
- zb.dodajSerial(newCategoryName2,newCategoryName,"");
- pobierzDaneZbazy(zb);
- Toast.makeText(getApplicationContext(),
- "Dodano", Toast.LENGTH_SHORT).show();
- }
- }
- });
- alert.setNegativeButton("ANULUJ",
- new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int whichButton) {
- // Canceled.
- // Toast.makeText(getApplicationContext(),
- // "Ok Clicked", Toast.LENGTH_SHORT).show();
- }
- });
- // create an alert dialog
- AlertDialog alert1 = alert.create();
- alert1.show();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement