Code example for Intent

Methods: getActivitysetFlags

0
    protected final PendingIntent mIntent;
    protected final Context mContext;
 
    protected NotificationBuilder(Context context) {
        mContext = context;
        final Intent actintent = new Intent(mContext, NowPlayingActivity.class);
        actintent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_REORDER_TO_FRONT | Intent.FLAG_ACTIVITY_PREVIOUS_IS_TOP);
        mIntent = PendingIntent.getActivity(mContext, 0, actintent, 0);
    } 
 
    /** 
     * Create a simple notification. Subclasses may take advantage of newer APIs. 
     * @param title 
     * @param text 
     * @param icon The id of a drawable to be used as the small icon. Will display on all platforms. 
     * @param thumb A bitmap representing the currently playing item. Ignored on lower API levels. 
     * @return 
     */ 
    public Notification build(String title, String text, int icon, Bitmap thumb) {
        Notification notification = new Notification(icon, title, System.currentTimeMillis());
        notification.setLatestEventInfo(mContext, title, text, mIntent);