Example usage for android.app Activity setTitle

List of usage examples for android.app Activity setTitle

Introduction

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

Prototype

public void setTitle(int titleId) 

Source Link

Document

Change the title associated with this activity.

Usage

From source file:bbct.android.common.activity.FilterCards.java

@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.filter_cards, container, false);

    // set title/*from w w w  .  j  a v  a  2 s  .  c  o  m*/
    String format = this.getString(R.string.bbct_title);
    String filterCardsTitle = this.getString(R.string.filter_cards_title);
    String title = String.format(format, filterCardsTitle);
    Activity activity = Objects.requireNonNull(getActivity());
    activity.setTitle(title);

    for (int id : CHECKBOXES) {
        View checkBox = view.findViewById(id);
        checkBox.setOnClickListener(this.onCheckBoxClick);
    }

    // restore input fields state
    if (savedInstanceState != null) {
        ArrayList<Integer> enabledFields = savedInstanceState.getIntegerArrayList(INPUT_EXTRA);
        if (enabledFields != null) {
            for (int i : enabledFields) {
                CheckBox cb = view.findViewById(CHECKBOXES[i]);
                cb.setChecked(true);
                EditText et = view.findViewById(TEXT_FIELDS[i]);
                et.setEnabled(true);
            }
        }
    }

    return view;
}

From source file:bbct.android.common.activity.BaseballCardList.java

@Override
public void onResume() {
    super.onResume();
    Activity activity = Objects.requireNonNull(getActivity());
    activity.setTitle(R.string.app_name);
}

From source file:io.mpos.ui.acquirer.view.LoginFragment.java

@Override
public void onAttach(Activity activity) {
    super.onAttach(activity);
    try {//from ww  w  .  j av  a 2  s. co  m
        activity.setTitle(R.string.MPUPrinting);
        mInteractionActivity = (Interaction) activity;
    } catch (ClassCastException e) {
        throw new ClassCastException(activity.toString() + " must implement LoginFragment.Interaction");
    }
}

From source file:com.ultramegatech.ey.ElementDetailsFragment.java

/**
 * Fill Views with element data./*from   w w w . ja  va  2  s.co m*/
 */
private void populateViews() {
    if (mElement == null) {
        return;
    }
    final String name = getString(ElementUtils.getElementName(mElement.number));

    if (!getShowsDialog()) {
        final Activity activity = getActivity();
        if (activity != null) {
            activity.setTitle(getString(R.string.titleElementDetails, name));
        }
    }

    mTxtHeader.setText(name);
    mTxtName.setText(name);

    setBlockBackground();

    getNumber();
    getSymbol();
    getWeight();
    getCategory();
    getGPB();
    getElectronConfiguration();
    getElectrons();
    mTxtDensity.setText(getDensity());
    mTxtMelt.setText(getTemperature(mElement.melt));
    mTxtBoil.setText(getTemperature(mElement.boil));
    mTxtHeat.setText(getHeat());
    mTxtNegativity.setText(getNegativity());
    mTxtAbundance.setText(getAbundance());

    populateIsotopes();
}

From source file:bbct.android.common.activity.BaseballCardDetails.java

@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.card_details, container, false);
    ButterKnife.bind(this, view);
    final Activity activity = Objects.requireNonNull(getActivity());
    String cardDetailsTitle = this.getString(R.string.card_details_title);
    String title = this.getString(R.string.bbct_title, cardDetailsTitle);
    activity.setTitle(title);

    brandText.setOnKeyListener(new View.OnKeyListener() {
        @Override//from   w  ww. jav a  2  s . co m
        public boolean onKey(View v, int keyCode, KeyEvent event) {
            Log.d(TAG, "onKey() in Brand TextView");
            Log.d(TAG, "keyCode = " + keyCode);

            if (event.getAction() == KeyEvent.ACTION_UP && keyCode == KeyEvent.KEYCODE_ENTER) {
                Log.d(TAG, "focus on Year");
                yearText.requestFocus();
                return true;
            }

            return false;
        }
    });

    playerNameText.setOnKeyListener(new View.OnKeyListener() {
        @Override
        public boolean onKey(View v, int keyCode, KeyEvent event) {
            Log.d(TAG, "onKey() in Player Name TextView");
            Log.d(TAG, "keyCode = " + keyCode);

            if (event.getAction() == KeyEvent.ACTION_UP && keyCode == KeyEvent.KEYCODE_ENTER) {
                Log.d(TAG, "focus on Team");
                teamText.requestFocus();
                return true;
            }

            return false;
        }
    });

    teamText.setOnKeyListener(new View.OnKeyListener() {
        @Override
        public boolean onKey(View v, int keyCode, KeyEvent event) {
            Log.d(TAG, "onKey() in Team TextView");
            Log.d(TAG, "keyCode = " + keyCode);

            if (event.getAction() == KeyEvent.ACTION_UP && keyCode == KeyEvent.KEYCODE_ENTER) {
                Log.d(TAG, "hide keyboard");
                InputMethodManager imm = Objects.requireNonNull(
                        (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE));
                imm.hideSoftInputFromWindow(teamText.getWindowToken(), 0);
                playerPositionSpinner.requestFocus();
                return true;
            }

            return false;
        }
    });

    createAdapters(activity);
    populateTextEdits();

    return view;
}

From source file:com.anxpp.blog.fragment.AboutFragment.java

@SuppressLint("SetJavaScriptEnabled")
private void initView() {
    webView = (WebView) getView().findViewById(R.id.webView);
    //      webView.setVisibility(View.GONE);
    webView.setWebChromeClient(new WebChromeClient() {
        public void onProgressChanged(WebView view, int progress) {
            Activity activity = getActivity();
            /**//from w  ww  . j  ava2s.c  o m
             * ?Fragment???
             * I am not sure why are you getting this error, 
             * i think it should be something like NullPointerException. 
             * Try next: 
             *     Evert time you calling getActivity() on Fragment instance you should be sure,
             *     that fragment is actually have this Activity. 
             *     Because when your webview is loading you are calling this function:
             * */
            if (activity == null)
                return;
            activity.setTitle("Loading..." + progress + "%");
            activity.setProgress(progress * 100);
            if (progress == 100) {
                activity.setTitle(R.string.app_name);
                webView.setVisibility(View.VISIBLE);
            }
        }
    });
    webView.setWebViewClient(new WebViewClient() {
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            Toast("shouldOverrideUrlLoading");
            view.loadUrl(url);
            return true;
        }
    });
    //??
    WebSettings webSettings = webView.getSettings();
    //?
    //webSettings.setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
    webSettings.setCacheMode(WebSettings.LOAD_NO_CACHE);
    //?js
    webSettings.setJavaScriptEnabled(true);
    //? ?
    webSettings.setUseWideViewPort(false); //??
    webSettings.setLoadWithOverviewMode(true); // ??
    webView.loadUrl("http://anxpp.com");
    //
    webView.setWebViewClient(new WebViewClient() {
        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            //trueWebViewfalse??
            view.loadUrl(url);
            return true; //false?
        }
    });
    webView.setOnKeyListener(new View.OnKeyListener() {
        @Override
        public boolean onKey(View v, int keyCode, KeyEvent event) {
            if (event.getAction() == KeyEvent.ACTION_DOWN) {
                if (keyCode == KeyEvent.KEYCODE_BACK && webView.canGoBack()) { // ?
                    webView.goBack(); //?
                    return true; //?
                }
            }
            return false;
        }
    });
}

From source file:uk.org.rivernile.edinburghbustracker.android.fragments.general.AddEditFavouriteStopFragment.java

/**
 * {@inheritDoc} //from ww  w  .  jav a2 s  . co m
 */
@Override
public void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    final Bundle args = getArguments();
    // Make sure that arguments exist. If they don't, throw an exception.
    if (args == null)
        throw new IllegalStateException(
                "There were no " + "arguments supplied to AddEditFavouriteStopsFragment.");

    final Activity activity = getActivity();
    sd = SettingsDatabase.getInstance(activity.getApplicationContext());

    // Get the arguments.
    stopCode = args.getString(ARG_STOPCODE);
    stopName = args.getString(ARG_STOPNAME);

    // Check that the stopCode exists.
    if (stopCode == null || stopCode.length() == 0)
        throw new IllegalArgumentException("The stopCode must not be " + "null or blank.");

    // If the stopName doesn't exist, try to get the existing name from
    // the settings database.
    if (stopName == null || stopName.length() == 0)
        stopName = sd.getNameForStop(stopCode);

    // Check to see if it already exists.
    editing = sd.getFavouriteStopExists(stopCode);
    // Set the appropriate title.
    if (editing) {
        activity.setTitle(getString(R.string.addeditstop_title_edit) + " " + stopCode);
    } else {
        activity.setTitle(getString(R.string.addeditstop_title_add) + " " + stopCode);
    }
}

From source file:com.andrewchelladurai.simplebible.ChapterFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_chapter, container, false);

    Activity activity = getActivity();

    mActions = (FloatingActionMenu) activity.findViewById(chapter_detail_verse_actions_bar);
    //        mActions.setClosedOnTouchOutside(true);
    fabShare = (FloatingActionButton) activity.findViewById(R.id.chapter_detail_verse_action_share);
    fabShare.setOnClickListener(this);

    fabBookmark = (FloatingActionButton) activity.findViewById(R.id.chapter_detail_verse_action_bookmark);
    fabBookmark.setOnClickListener(this);

    fabReset = (FloatingActionButton) activity.findViewById(R.id.chapter_detail_verse_action_reset);
    fabReset.setOnClickListener(this);

    init();/*from   w  w w.j  av a  2 s  .c o m*/

    if (isAllSet) {
        String title = mBookItem.getBookName() + " : " + mChapterItem.getLabel();
        activity.setTitle(title);
    }

    RecyclerView recyclerView = (RecyclerView) view.findViewById(R.id.fragment_verse_list);
    recyclerView.setAdapter(mListAdapter);

    refresh();
    return view;
}

From source file:com.ultramegasoft.flavordex2.fragment.EditCatFragment.java

@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    final Activity activity = getActivity();
    if (activity == null) {
        return;/*w  w w. j  a v  a 2s.  com*/
    }

    final Bundle args = getArguments();
    mCatId = args != null ? args.getLong(ARG_CAT_ID) : 0;
    setHasOptionsMenu(true);
    if (mCatId > 0) {
        activity.setTitle(getString(R.string.title_edit_cat));
    }
}

From source file:net.nightwhistler.pageturner.fragment.ReadingFragment.java

@Override
public void parseEntryComplete(String name) {

    if (name != null && !name.equals(this.bookTitle)) {
        this.titleBase = this.bookTitle + " - " + name;
    } else {/*from   w w w . j a  v a 2s .c  o  m*/
        this.titleBase = this.bookTitle;
    }

    Activity activity = getActivity();

    if (activity != null) {

        activity.setTitle(this.titleBase);

        if (this.ttsPlaybackItemQueue.isActive() && this.ttsPlaybackItemQueue.isEmpty()) {
            streamTTSToDisk();
        }

        closeWaitDialog();
    }

}