Example usage for android.app Activity getTitle

List of usage examples for android.app Activity getTitle

Introduction

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

Prototype

public final CharSequence getTitle() 

Source Link

Usage

From source file:Main.java

public static String getBreadcrumbs(final Activity activity) {
    Activity currentActivity = activity;
    ArrayList<String> breadcrumbs = new ArrayList<>();

    while (currentActivity != null) {
        breadcrumbs.add(currentActivity.getTitle().toString());
        currentActivity = currentActivity.getParent();
    }//from   ww  w .  j  a v a 2s  . c o m
    return joinSlash(breadcrumbs);
}

From source file:Main.java

private static void shareAct(Activity act, String fileName, String text) {

    Uri uri = null;/*from   w  w  w. j  a  va 2 s.c o  m*/

    try {
        FileInputStream input = act.openFileInput(fileName);
        Bitmap bitmap = BitmapFactory.decodeStream(input);
        uri = Uri.parse(MediaStore.Images.Media.insertImage(act.getContentResolver(), bitmap, null, null));
        input.close();
    } catch (Exception e) {
        e.printStackTrace();
    }

    Intent shareIntent = new Intent(Intent.ACTION_SEND);
    shareIntent.putExtra(Intent.EXTRA_STREAM, uri);
    shareIntent.setType("image/jpeg");
    act.startActivity(Intent.createChooser(shareIntent, act.getTitle()));
}

From source file:edu.stanford.mobisocial.dungbeetle.ui.MusubiBaseActivity.java

/**
 * Use the activity label to set the text in the activity's title text view.
 * The argument gives the name of the view.
 * <p>/*from w  w w.  j a va 2 s.c  o  m*/
 * This method is needed because we have a custom title bar rather than the
 * default Android title bar. See the theme definitons in styles.xml.
 * 
 * @param title The text to display, or null to use the activity's label.
 * @return void
 */
public static void doTitleBar(Activity activity, String title) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        View titleBar = activity.findViewById(R.id.dashboardTitleBar);
        if (titleBar != null) {
            titleBar.setVisibility(View.GONE);
        }
    } else {
        // Dashboard title bar
        TextView tv = (TextView) activity.findViewById(R.id.title_text);
        if (tv == null) {
            return;
        }
        if (title == null) {
            tv.setText(activity.getTitle());
        } else {
            tv.setText(title);
        }
    }
}

From source file:com.yanzhenjie.album.mvp.ActivitySource.java

@Override
void setActionBar(Toolbar actionBar) {
    this.mActionBar = actionBar;

    Activity activity = getHost();
    if (mActionBar != null) {
        setTitle(activity.getTitle());
        mActionBar.setOnMenuItemClickListener(new Toolbar.OnMenuItemClickListener() {
            @Override//from w w  w .  ja  v a2  s.  c om
            public boolean onMenuItemClick(MenuItem item) {
                if (mMenuItemSelectedListener != null) {
                    mMenuItemSelectedListener.onMenuClick(item);
                }
                return true;
            }
        });
        mActionBar.setNavigationOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (mMenuItemSelectedListener != null) {
                    mMenuItemSelectedListener.onHomeClick();
                }
            }
        });
        mActionBarIcon = mActionBar.getNavigationIcon();
    }
}

From source file:pct.droid.tv.fragments.PTVMediaGridFragment.java

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

    Activity activity = getActivity();
    setTitle(StringUtils.capWords((String) activity.getTitle()));

    if (activity instanceof Callback && mCallback == null) {
        mCallback = (Callback) getActivity();
    }/*from   ww  w.ja v a  2 s  . c o  m*/

    switch (mCallback.getType()) {
    case MOVIE:
        mProvider = new YTSProvider();
        break;
    case SHOW:
        mProvider = new EZTVProvider();
        break;
    }

    loadItems();
}

From source file:butter.droid.tv.fragments.TVMediaGridFragment.java

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

    Activity activity = getActivity();
    setTitle(StringUtils.capWords((String) activity.getTitle()));

    if (activity instanceof Callback && mCallback == null) {
        mCallback = (Callback) getActivity();
    }/* w  w w . ja v  a2 s. c  om*/

    switch (mCallback.getType()) {
    case MOVIE:
        mProvider = new MoviesProvider();
        break;
    case SHOW:
        mProvider = new TVProvider();
        break;
    }

    loadItems();
}

From source file:com.google.android.testing.nativedriver.server.AndroidNativeDriver.java

/**
 * Returns title of the activity. Provided to override final method
 * {@link Activity#getTitle()}./*from  ww w.j a  v a2  s. c  o  m*/
 */
protected CharSequence getActivityTitle(Activity activity) {
    return activity.getTitle();
}