Example usage for android.app Dialog setTitle

List of usage examples for android.app Dialog setTitle

Introduction

In this page you can find the example usage for android.app Dialog setTitle.

Prototype

public void setTitle(@StringRes int titleId) 

Source Link

Document

Set the title text for this dialog's window.

Usage

From source file:it.unicaradio.android.activities.MainActivity.java

private void showUpdatesDialog() {
    final Dialog dialog = new Dialog(this);
    dialog.setContentView(R.layout.popup);
    dialog.setTitle(R.string.application_updated);
    dialog.setCancelable(true);//from   ww  w .  jav a  2 s.c o m

    TextView textView = (TextView) dialog.findViewById(R.id.updatesText);
    textView.setText(R.string.updates);

    Button button = (Button) dialog.findViewById(R.id.updatesButton);
    button.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            dialog.hide();
        }
    });
    dialog.show();
}

From source file:com.idt.ontomedia.geoconsum.BaseActivity.java

private Dialog setDialogWithCheck(int _id) {
    final Dialog dialog = new Dialog(this);

    dialog.setContentView(R.layout.dialog_with_check);

    TextView textViewInfo = (TextView) dialog.findViewById(R.id.text_layout);
    CheckBox checkBox = (CheckBox) dialog.findViewById(R.id.checkBox1);

    switch (_id) {
    case DIALOG_ABOUT_ID: {
        dialog.setTitle(getResources().getString(R.string.dialog_title_about) + " "
                + getResources().getString(R.string.app_name));
        dialog.setCancelable(true);//  w  w w. java2 s .co m

        checkBox.setVisibility(View.GONE);

        ImageView imageViewBanner = (ImageView) dialog.findViewById(R.id.imageViewBanner);
        imageViewBanner.setImageDrawable(getResources().getDrawable(R.drawable.logo_idt));
        imageViewBanner.setVisibility(View.VISIBLE);

        textViewInfo.setText(R.string.dialog_text_about);
    }
    case DIALOG_WARNING_ID: {
        dialog.setTitle(getResources().getString(R.string.dialog_title_warning));
        dialog.setCancelable(false);

        textViewInfo.setText(R.string.dialog_text_warning);

        checkBox.setOnCheckedChangeListener(new OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton _buttonView, boolean _isChecked) {
                SharedPreferences sharedPreferences = PreferenceManager
                        .getDefaultSharedPreferences(getBaseContext());
                SharedPreferences.Editor editor = sharedPreferences.edit();
                editor.putBoolean(DialogPreferenceActivity.PREF_DIALOG_CHECK, _isChecked);
                editor.commit();
            }
        });
    }
    }

    Button acceptButton = (Button) dialog.findViewById(R.id.button1);
    acceptButton.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            dialog.cancel();
        }

    });

    return dialog;
}

From source file:com.adwardstark.lyricswithmusixmatchapi.MainActivity.java

@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_settings) {
        // create a Dialog component
        final Dialog dialog = new Dialog(this);
        //tell the Dialog to use the dialog.xml as it's layout description
        dialog.setContentView(R.layout.aboutdialog);
        dialog.setTitle("About Developer");
        dialog.show();/*from  ww w  . j  av  a2 s.c  o  m*/
        return true;
    }

    return super.onOptionsItemSelected(item);
}

From source file:me.isassist.isa.MainActivity.java

@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();

    if (id == R.id.action_refresh) {
        if (!isNetworkAvailable()) {
            Toast.makeText(this, "No internet connection available!", Toast.LENGTH_LONG).show();
            return true;
        }/* www. j  a  v  a  2 s  . co  m*/
        showLoadingFragment("Updating\nThis can take a while\n Please wait!");
        DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
        if (drawer.isDrawerOpen(GravityCompat.START)) {
            drawer.closeDrawer(GravityCompat.START);
        }

        for (Bihapi b : Bihapi.values())
            new FetchAPI(this, this, b, FetchAPI.FetchType.INTERNET).execute();
        return true;
    } else if (id == R.id.action_about) {
        final Dialog dialog = new Dialog(this);
        dialog.setContentView(R.layout.about_dialog);
        dialog.setTitle("About");

        TextView text = (TextView) dialog.findViewById(R.id.licensesText);
        text.setText(Html.fromHtml(
                "Building, Tall, Trading, Human graphics by <a href=\"http://www.freepik.com/\">Freepik</a> and Building graphic by <a href=\"http://www.unocha.org\">Ocha</a> and Haw Gestures Stroke graphic by <a href=\"http://yanlu.de\">Yannick</a> from <a href=\"http://www.flaticon.com/\">Flaticon</a> are licensed under <a href=\"http://creativecommons.org/licenses/by/3.0/\" title=\"Creative Commons BY 3.0\">CC BY 3.0</a>.Park graphic by <a href=\"http://www.freepik.com\">Freepik</a> from <a href=\"http://www.flaticon.com/\">Flaticon</a> is licensed under <a href=\"http://creativecommons.org/licenses/by/3.0/\" title=\"Creative Commons BY 3.0\">CC BY 3.0</a>. Made with <a href=\"http://logomakr.com\" title=\"Logo Maker\">Logo Maker</a>"));

        dialog.show();
        return true;
    }
    return super.onOptionsItemSelected(item);
}

From source file:com.adithya321.sharesanalysis.fragments.PurchaseShareFragment.java

private void setRecyclerViewAdapter() {
    sharesList = databaseHandler.getShares();
    purchaseList = databaseHandler.getPurchases();

    if (sharesList.size() < 1) {
        emptyTV.setVisibility(View.VISIBLE);
        arrow.setVisibility(View.VISIBLE);
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            if (getResources().getConfiguration().orientation == 1) {
                arrow.setBackground(getResources().getDrawable(R.drawable.curved_line_vertical));
            } else {
                arrow.setBackground((getResources().getDrawable(R.drawable.curved_line_horizontal)));
            }/*from   w  w w .  j  ava2 s .  co m*/
        }
    } else {
        emptyTV.setVisibility(View.GONE);
        arrow.setVisibility(View.GONE);
    }

    PurchaseShareAdapter purchaseAdapter = new PurchaseShareAdapter(getContext(), purchaseList);
    purchaseAdapter.setOnItemClickListener(new PurchaseShareAdapter.OnItemClickListener() {
        @Override
        public void onItemClick(View itemView, int position) {
            final Purchase purchase = purchaseList.get(position);

            final Dialog dialog = new Dialog(getContext());
            dialog.setTitle("Edit Share Purchase");
            dialog.setContentView(R.layout.dialog_add_share_purchase);
            dialog.getWindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT,
                    WindowManager.LayoutParams.WRAP_CONTENT);
            dialog.show();

            RadioButton newRB = (RadioButton) dialog.findViewById(R.id.radioBtn_new);
            RadioButton existingRB = (RadioButton) dialog.findViewById(R.id.radioBtn_existing);
            AutoCompleteTextView name = (AutoCompleteTextView) dialog.findViewById(R.id.share_name);
            newRB.setVisibility(View.GONE);
            existingRB.setChecked(true);
            name.setVisibility(View.GONE);

            final Spinner spinner = (Spinner) dialog.findViewById(R.id.existing_spinner);
            ArrayList<String> shares = new ArrayList<>();
            int pos = 0;
            for (int i = 0; i < sharesList.size(); i++) {
                shares.add(sharesList.get(i).getName());
                if (sharesList.get(i).getName().equals(purchase.getName()))
                    pos = i;
            }
            ArrayAdapter<String> spinnerAdapter = new ArrayAdapter<>(getContext(),
                    android.R.layout.simple_spinner_item, shares);
            spinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
            spinner.setAdapter(spinnerAdapter);
            spinner.setSelection(pos);
            spinner.setVisibility(View.VISIBLE);

            final EditText quantity = (EditText) dialog.findViewById(R.id.no_of_shares);
            final EditText price = (EditText) dialog.findViewById(R.id.buying_price);
            quantity.setText(String.valueOf(purchase.getQuantity()));
            price.setText(String.valueOf(purchase.getPrice()));

            Calendar calendar = Calendar.getInstance();
            calendar.setTime(purchase.getDate());
            year_start = calendar.get(Calendar.YEAR);
            month_start = calendar.get(Calendar.MONTH) + 1;
            day_start = calendar.get(Calendar.DAY_OF_MONTH);
            final Button selectDate = (Button) dialog.findViewById(R.id.select_date);
            selectDate.setText(new StringBuilder().append(day_start).append("/").append(month_start).append("/")
                    .append(year_start));
            selectDate.setOnClickListener(PurchaseShareFragment.this);

            Button addPurchaseBtn = (Button) dialog.findViewById(R.id.add_purchase_btn);
            addPurchaseBtn.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Purchase p = new Purchase();
                    p.setId(purchase.getId());

                    String stringStartDate = year_start + " " + month_start + " " + day_start;
                    DateFormat format = new SimpleDateFormat("yyyy MM dd", Locale.ENGLISH);
                    try {
                        Date date = format.parse(stringStartDate);
                        p.setDate(date);
                    } catch (Exception e) {
                        Toast.makeText(getActivity(), "Invalid Date", Toast.LENGTH_SHORT).show();
                        return;
                    }

                    try {
                        p.setQuantity(Integer.parseInt(quantity.getText().toString()));
                    } catch (Exception e) {
                        Toast.makeText(getActivity(), "Invalid Number of Shares", Toast.LENGTH_SHORT).show();
                        return;
                    }

                    try {
                        p.setPrice(Double.parseDouble(price.getText().toString()));
                    } catch (Exception e) {
                        Toast.makeText(getActivity(), "Invalid Buying Price", Toast.LENGTH_SHORT).show();
                        return;
                    }

                    p.setType("buy");
                    p.setName(spinner.getSelectedItem().toString());
                    databaseHandler.updatePurchase(p);
                    setRecyclerViewAdapter();
                    dialog.dismiss();
                }
            });
        }
    });
    sharePurchasesRecyclerView.setHasFixedSize(true);
    sharePurchasesRecyclerView.setAdapter(purchaseAdapter);
    sharePurchasesRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
}

From source file:tm.android.chronos.activity.Chronos.java

@SuppressWarnings({ "unchecked", "WeakerAccess" })
public void onClick(View view) {

    switch (view.getId()) {
    case R.id.btn_StopwatchAcitvity:
        Intent intent = new Intent(getBaseContext(), ChronometerActivity.class);
        startActivity(intent);//  w ww  .  ja v a 2 s  .  com
        break;
    case R.id.btn_timerActivity:
        Intent intent3 = new Intent(getBaseContext(), TimerActivity.class);
        startActivity(intent3);
        break;
    case R.id.btn_alarmActivity:
        Intent intent1 = new Intent(this, AlarmActivity.class);
        startActivity(intent1);
        break;
    case R.id.btn_metronomeActivity:
        //                Intent intent2 = new Intent(this, MetronomeActivity.class);
        //                startActivity(intent2);
        //                break;
    default:
        Dialog dialog = new Dialog(this);
        TextView textView = new TextView(this);
        textView.setText("Not yet implemented !\nComing soon.");
        //textView.setTextAppearance(android.R.style.TextAppearance_Large);
        dialog.setContentView(textView);
        dialog.setTitle("Message-oup!!!");
        dialog.show();
    }

}

From source file:com.yammy.meter.MainActivity.java

private void showAlert() {
    final Dialog myDialog = new Dialog(this);
    myDialog.setContentView(R.layout.isvo_dialog_low_oil);
    myDialog.setCancelable(true);//w  w  w .ja  va 2 s  .  c  om
    myDialog.setTitle("Peringatan!");
    Button batal = (Button) myDialog.findViewById(R.id.dialog_low_oil_cancel);
    Button cari = (Button) myDialog.findViewById(R.id.dialog_low_oil_cari);
    myDialog.show();
    cari.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent i = new Intent(MainActivity.this, MainCari.class);
            startActivity(i);
        }
    });
    batal.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            myDialog.cancel();
        }
    });
}

From source file:com.commonsware.android.arXiv.arXiv.java

private boolean applyMenuChoice(MenuItem item) {
    switch (item.getItemId()) {
    case ABOUT_ID:
        String str = getString(R.string.about_text);
        TextView wv = new TextView(this);
        wv.setPadding(16, 0, 16, 16);//from  w w w  .j  a va2s.  co  m
        wv.setText(str);

        ScrollView scwv = new ScrollView(this);
        scwv.addView(wv);

        Dialog dialog = new Dialog(this) {
            public boolean onKeyDown(int keyCode, KeyEvent event) {
                if (keyCode != KeyEvent.KEYCODE_DPAD_LEFT)
                    this.dismiss();
                return true;
            }
        };
        dialog.setTitle(R.string.about_arxiv_droid);
        dialog.addContentView(scwv, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,
                LinearLayout.LayoutParams.MATCH_PARENT));
        dialog.show();
        return (true);
    case HISTORY_ID:
        Intent myIntent = new Intent(this, DownloadsActivity.class);
        startActivity(myIntent);
        return (true);
    case PREF_ID:
        if (Build.VERSION.SDK_INT >= 11) {
            startActivity(new Intent(this, EditPreferences.class));
        } else {
            startActivity(new Intent(this, EditPreferencesCompat.class));
        }
        return (true);
    case DONATE_ID:
        Intent goToMarket = new Intent(Intent.ACTION_VIEW,
                Uri.parse("market://details?id=com.jd.android.arXiv"));
        try {
            startActivity(goToMarket);
        } catch (Exception ef) {
            Toast.makeText(this, "Market Not Installed", Toast.LENGTH_SHORT).show();
        }
        return (true);
    case SEARCH_ID:
        Intent search = new Intent(this, SearchWindow.class);
        startActivity(search);
        return (true);
    }
    return (false);
}

From source file:com.mEmoZz.qrgen.MainActivity.java

public void mCore() {

    Toast.makeText(getApplicationContext(), "Generating code...", Toast.LENGTH_SHORT).show();

    new CountDownTimer(3000, 1000) {
        public void onTick(long millisUntilFinished) {
        }//ww w .ja  v  a2  s. c  om

        public void onFinish() {
            Button yupBtn, delBtn, shareBtn;

            Toast.makeText(getApplicationContext(), "Success", Toast.LENGTH_SHORT).show();

            final Dialog dialog = new Dialog(MainActivity.this);
            dialog.setContentView(R.layout.dialog);

            dialog.setTitle("Want to save?");

            iv = (ImageView) dialog.findViewById(R.id.iv);
            iv.setImageBitmap(bm);

            shareBtn = (Button) dialog.findViewById(R.id.shareBtn);
            shareBtn.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    shareIt();
                }
            });

            yupBtn = (Button) dialog.findViewById(R.id.btn1);
            yupBtn.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {

                    mStream();

                    dialog.dismiss();
                }
            });

            delBtn = (Button) dialog.findViewById(R.id.btn2);
            delBtn.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    dialog.dismiss();

                    Toast.makeText(getApplicationContext(), "Deleted!", Toast.LENGTH_SHORT).show();
                }
            });

            dialog.show();
            dialog.setCancelable(false);
            keepDialog(dialog);
        }
    }.start();

}

From source file:com.xxjwd.sjbg.MainActivity.java

 private void doShowDownloadDialog() {
   Dialog builder = new Dialog(this);
    //builder.requestWindowFeature(Window.FEATURE_NO_TITLE);
   builder.setTitle("???");
    builder.getWindow().setBackgroundDrawable(
        new ColorDrawable(android.graphics.Color.TRANSPARENT));
    builder.setOnDismissListener(new DialogInterface.OnDismissListener() {
        @Override/*from  w  w w  .j av a2s  .c o  m*/
        public void onDismiss(DialogInterface dialogInterface) {
            //nothing;
        }
    });

    ImageView imageView = new ImageView(this);
    imageView.setImageResource(R.drawable.erweima);
   imageView.setOnLongClickListener(new OnLongClickListener()
   {

      @Override
      public boolean onLongClick(View v) {
         // TODO Auto-generated method stub
         Intent intent = new Intent();        
           intent.setAction("android.intent.action.VIEW");    
           Uri content_url = Uri.parse("http://61.163.45.215:808/sjbg/download.html");   
           intent.setData(content_url);  
           startActivity(intent);
         return true;
      }
   }
   );
    builder.addContentView(imageView, new RelativeLayout.LayoutParams(
            ViewGroup.LayoutParams.WRAP_CONTENT, 
            ViewGroup.LayoutParams.WRAP_CONTENT));
    builder.show();
      
}