Example usage for android.app ActionBar setTitle

List of usage examples for android.app ActionBar setTitle

Introduction

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

Prototype

public abstract void setTitle(@StringRes int resId);

Source Link

Document

Set the action bar's title.

Usage

From source file:com.jaspersoft.android.jaspermobile.activities.save.fragment.SaveItemFragment.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getBaseActivityComponent().inject(this);

    hasOptionsMenu();//ww w.j  av a  2s .co  m

    ActionBar actionBar = getActivity().getActionBar();
    if (actionBar != null) {
        actionBar.setTitle(R.string.sr_ab_title);
    }
}

From source file:com.mani.volleydemo.JSONObjectRequestActvity.java

@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private void actionBarSetup() {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        ActionBar ab = getActionBar();
        ab.setTitle("JSONRequest");
    }//from w  w w . ja  va2  s .  c  o  m
}

From source file:org.dmfs.webcal.fragments.PagerFragment.java

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

    mProgressBar = (ProgressBar) returnView.findViewById(android.R.id.progress);
    mMessageText = (TextView) returnView.findViewById(android.R.id.message);

    mAdapter = new SectionsPagerAdapter(getChildFragmentManager(), mIcon);

    mViewPager = (ViewPager) returnView.findViewById(R.id.pager);
    mViewPager.setOnPageChangeListener(this);
    mViewPager.setAdapter(mAdapter);/*from w w w. j  av a  2s.co  m*/

    // start loading the pages
    getLoaderManager().initLoader(ID_URL_LOADER, null, this);

    // set the page title and clear the subtitle if any
    ActionBar actionBar = getActivity().getActionBar();
    actionBar.setTitle(mTitle);
    actionBar.setSubtitle(null);

    // load the icon and set it if we get any, otherwise insert a placeholder and set it later
    Drawable icon = ImageProxy.getInstance(this.getActivity()).getImage(mIcon, this);
    if (icon != null) {
        // we need to pre-scale the icon, apparently Android doesn't do that for us
        actionBar.setIcon(BitmapUtils.scaleDrawable(getResources(), (BitmapDrawable) icon, 36, 36));
    } else {
        actionBar.setIcon(new ColorDrawable(getResources().getColor(android.R.color.transparent)));
    }

    return returnView;
}

From source file:name.gumartinm.weather.information.activity.SpecificActivity.java

@Override
public void onResume() {
    super.onResume();

    // 1. Update title.
    final DatabaseQueries query = new DatabaseQueries(this);
    final WeatherLocation weatherLocation = query.queryDataBase();
    if (weatherLocation != null) {
        final ActionBar actionBar = this.getActionBar();
        final String[] array = new String[2];
        array[0] = weatherLocation.getCity();
        array[1] = weatherLocation.getCountry();
        final MessageFormat message = new MessageFormat("{0},{1}", Locale.US);
        final String cityCountry = message.format(array);
        actionBar.setTitle(cityCountry);
    }//from   w  ww.  j a  v  a 2s  . c o m
}

From source file:org.catnut.fragment.HomeTimelineFragment.java

@Override
public void onStart() {
    super.onStart();
    ActionBar bar = getActivity().getActionBar();
    bar.setIcon(R.drawable.ic_title_home);
    bar.setTitle(getString(R.string.home_timeline));
}

From source file:com.codebutler.farebot.activity.CardInfoActivity.java

@Override
protected void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_card_info);
    final ViewPager viewPager = (ViewPager) findViewById(R.id.pager);
    mTabsAdapter = new TabPagerAdapter(this, viewPager);

    final ActionBar actionBar = getActionBar();
    actionBar.setDisplayHomeAsUpEnabled(true);
    actionBar.setTitle(R.string.loading);

    new AsyncTask<Void, Void, Void>() {
        private Exception mException;
        public boolean mSpeakBalanceEnabled;

        @Override//from  ww  w  .j a  v  a  2  s. c o m
        protected Void doInBackground(Void... voids) {
            try {
                Uri uri = getIntent().getData();
                Cursor cursor = getContentResolver().query(uri, null, null, null, null);
                startManagingCursor(cursor);
                cursor.moveToFirst();

                String data = cursor.getString(cursor.getColumnIndex(CardsTableColumns.DATA));

                mCard = Card.fromXml(FareBotApplication.getInstance().getSerializer(), data);
                mTransitData = mCard.parseTransitData();

                SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(CardInfoActivity.this);
                mSpeakBalanceEnabled = prefs.getBoolean("pref_key_speak_balance", false);
            } catch (Exception ex) {
                mException = ex;
            }
            return null;
        }

        @Override
        protected void onPostExecute(Void aVoid) {
            findViewById(R.id.loading).setVisibility(View.GONE);
            findViewById(R.id.pager).setVisibility(View.VISIBLE);

            if (mException != null) {
                if (mCard == null) {
                    Utils.showErrorAndFinish(CardInfoActivity.this, mException);
                } else {
                    Log.e("CardInfoActivity", "Error parsing transit data", mException);
                    showAdvancedInfo(mException);
                    finish();
                }
                return;
            }

            if (mTransitData == null) {
                showAdvancedInfo(new UnsupportedCardException());
                finish();
                return;
            }

            String titleSerial = (mTransitData.getSerialNumber() != null) ? mTransitData.getSerialNumber()
                    : Utils.getHexString(mCard.getTagId(), "");
            actionBar.setTitle(mTransitData.getCardName() + " " + titleSerial);

            Bundle args = new Bundle();
            args.putString(AdvancedCardInfoActivity.EXTRA_CARD,
                    mCard.toXml(FareBotApplication.getInstance().getSerializer()));
            args.putParcelable(EXTRA_TRANSIT_DATA, mTransitData);

            if (mTransitData instanceof UnauthorizedClassicTransitData) {
                mTabsAdapter.addTab(actionBar.newTab(), UnauthorizedCardFragment.class, args);
                return;
            }

            if (mTransitData.getBalanceString() != null) {
                mTabsAdapter.addTab(actionBar.newTab().setText(R.string.balance), CardBalanceFragment.class,
                        args);
            }

            if (mTransitData.getTrips() != null || mTransitData.getRefills() != null) {
                mTabsAdapter.addTab(actionBar.newTab().setText(R.string.history), CardTripsFragment.class,
                        args);
            }

            if (mTransitData.getSubscriptions() != null) {
                mTabsAdapter.addTab(actionBar.newTab().setText(R.string.subscriptions),
                        CardSubscriptionsFragment.class, args);
            }

            if (mTransitData.getInfo() != null) {
                mTabsAdapter.addTab(actionBar.newTab().setText(R.string.info), CardInfoFragment.class, args);
            }

            if (mTabsAdapter.getCount() > 1) {
                actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
            }

            if (mTransitData.hasUnknownStations()) {
                findViewById(R.id.need_stations).setVisibility(View.VISIBLE);
            }

            boolean speakBalanceRequested = getIntent().getBooleanExtra(SPEAK_BALANCE_EXTRA, false);
            if (mSpeakBalanceEnabled && speakBalanceRequested) {
                mTTS = new TextToSpeech(CardInfoActivity.this, mTTSInitListener);
            }

            if (savedInstanceState != null) {
                viewPager.setCurrentItem(savedInstanceState.getInt(KEY_SELECTED_TAB, 0));
            }
        }
    }.execute();
}

From source file:com.burntout.burntout.SendReportActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.send_report);

    ActionBar bar = getActionBar();
    bar.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#1E5791")));
    bar.setTitle("Burnt Out");
    bar.setSubtitle("Report Burnout");
    bar.setDisplayHomeAsUpEnabled(true);

    context = this;
    SharedPreferences sharedPref = context.getSharedPreferences(getString(R.string.pref), Context.MODE_PRIVATE);

    email = sharedPref.getString("email", null);

    Log.d("email", email);

    frontText = (TextView) findViewById(R.id.frontText);
    backText = (TextView) findViewById(R.id.backText);
    reportedLightsCheck = (TextView) findViewById(R.id.reported_lights_text);
    reportPlateNumber = (EditText) findViewById(R.id.report_plate_number);
    message = (EditText) findViewById(R.id.extra_message);
    submitBtn = (Button) findViewById(R.id.report_button);
    pageMarkers = (PageMarkers) findViewById(R.id.pageMarkersReport);
    pageMarkers.setTotalPages(4);/*from  w  w  w  .ja  va2  s  . co m*/
    pageMarkers.makeView(0);

    statePicker = (StatePicker) findViewById(R.id.statepicker_view1);

    reportables = (TappablesHSV) findViewById(R.id.tappablesHSV1);
    reportables.setCommunicator(this);
    reportables.initItems(this);
    reportables.setFeatureItems();
    reportables.addManagers(this);

    reportPlateNumber.clearFocus();
    message.clearFocus();

    addListenerOnSubmit();

}

From source file:org.jorge.lolin1.ui.activities.ChatRoomActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    ActionBar actionBar = getActionBar();
    friendName = null;//from   ww w .  j  ava2  s. com
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(Boolean.TRUE);
        actionBar.setTitle(friendName = getIntent().getStringExtra(ChatOverviewActivity.KEY_FRIEND_NAME));
        try {
            actionBar
                    .setLogo(
                            Drawable.createFromPath(
                                    ProfileCacheableBitmapLoader
                                            .getPathByID(getApplicationContext(),
                                                    FriendManager.getInstance().findFriendByName(friendName)
                                                            .getStatus().getProfileIconId())
                                            .getAbsolutePath()));
        } catch (NullPointerException ex) {
            startActivity(new Intent(getApplicationContext(), ChatOverviewActivity.class));//Clicking notification with app closed
            finish();
            return;
        }
        actionBar.setDisplayUseLogoEnabled(Boolean.TRUE);
    }
    ChatNotificationManager.dismissNotifications(getApplicationContext(), friendName);
    setContentView(R.layout.activity_chat_room);

    final EditText messageContentsTextField = (EditText) findViewById(android.R.id.inputArea);

    messageContentsTextField.setOnEditorActionListener(new TextView.OnEditorActionListener() {
        @Override
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            if (actionId != EditorInfo.IME_ACTION_DONE)
                return Boolean.FALSE;
            String contents = messageContentsTextField.getText().toString();
            if (TextUtils.isEmpty(contents))
                return Boolean.TRUE;
            adapter.add(new ChatMessageWrapper(contents, System.currentTimeMillis()));
            sendMessage(contents, friendName);
            messageContentsTextField.setText("");
            messageContentsTextField.requestFocus();
            return Boolean.TRUE;
        }

        private void sendMessage(String contents, String friendName) {
            new AsyncTask<String, Void, Void>() {
                @Override
                protected Void doInBackground(String... params) {
                    Friend target;
                    ChatMessageWrapper messageWrapper = new ChatMessageWrapper(params[0],
                            System.currentTimeMillis());
                    logString("debug", "Sending message " + params[0] + " to " + params[1]);
                    ChatBundleManager.addMessageToFriendChat(messageWrapper,
                            target = FriendManager.getInstance().findFriendByName(params[1]));
                    scrollListViewToBottom();
                    target.sendMessage(params[0]);
                    return null;
                }
            }.executeOnExecutor(Executors.newSingleThreadExecutor(), contents, friendName);
        }
    });

    conversationListView = (ListView) findViewById(android.R.id.list);
    conversationListView.setChoiceMode(AbsListView.CHOICE_MODE_NONE);

    logString("debug", "Calling adapter constructor");
    adapter = new ChatRoomAdapter(getApplicationContext(),
            FriendManager.getInstance().findFriendByName(friendName));

    if (!TextUtils.isEmpty(friendName))
        conversationListView.setAdapter(adapter);

    scrollListViewToBottom();

    registerLocalBroadcastReceiver();
    scrollListViewToBottom();
}

From source file:com.learnit.LearnIt.activities.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);/* w w  w . j  a  va  2  s .  com*/
    ActionBar actionBar = this.getActionBar();
    if (actionBar != null) {
        actionBar.setTitle("");
    }
    String currentLayout = getString(R.string.layout_current);
    FragmentManager fragmentManager = getFragmentManager();
    _taskScheduler = Utils.getCurrentTaskScheduler(this);
    switch (currentLayout) {
    case LAYOUT_LARGE_LAND:
        _appSectionsPagerAdapter = new AppSectionsPagerAdapter(fragmentManager, this, _taskScheduler);
        //Do some special processing for large screen
        ListOfFragments fragment = (ListOfFragments) getFragmentManager()
                .findFragmentById(R.id.headlines_fragment);
        fragment.getListView().setSelection(0);
        break;
    default:
        // Initialize the view pager
        // Create the adapter that will return a listOfFragments for each of the three primary sections
        // of the app.
        _appSectionsPagerAdapter = new AppSectionsPagerAdapter(fragmentManager, this, _taskScheduler);

        final PagerSlidingTabStrip strip = (PagerSlidingTabStrip) findViewById(R.id.tabs);

        // Set up the ViewPager, attaching the adapter and setting up a listener for when the
        // user swipes between sections.
        _viewPager = (ViewPager) findViewById(R.id.pager);
        _viewPager.setAdapter(_appSectionsPagerAdapter);
        strip.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
            @Override
            public void onPageSelected(int position) {
                _currentItemShown = position;
                Log.d(LOG_TAG, "current position updated");
            }
        });
        strip.setViewPager(_viewPager);
        strip.setBackgroundColor(this.getResources().getColor(R.color.white));
        strip.setUnderlineColor(this.getResources().getColor(R.color.highlight));
        strip.setIndicatorColor(this.getResources().getColor(R.color.highlight));
        DisplayMetrics metrics = this.getResources().getDisplayMetrics();
        float dp = Constants.TAB_SELECTOR_HEIGHT_DP;
        float fpixels = metrics.density * dp;
        int pixels = (int) fpixels;
        strip.setIndicatorHeight(pixels);
        this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
        break;
    }
}

From source file:com.tcity.android.ui.overview.project.ProjectOverviewActivity.java

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

    myRecreating = false;//ww w .  j  a v a 2s.  c  o m
    myProjectId = calculateProjectId();

    setContentView(R.layout.overview_ui);

    ActionBar bar = getActionBar();
    if (bar != null) {
        bar.setTitle(calculateTitle());
        bar.setSubtitle(calculateSubtitle());

        if (!isRootProject(myProjectId)) {
            bar.setDisplayHomeAsUpEnabled(true);
        }
    }

    myLayout = (SwipeRefreshLayout) findViewById(R.id.overview_srlayout);
    myLayout.setColorSchemeResources(R.color.green, R.color.red);
    myLayout.setOnRefreshListener(this);

    myEngine = calculateEngine();
    setListAdapter(myEngine.getAdapter());
}