Example usage for android.widget ImageView setVisibility

List of usage examples for android.widget ImageView setVisibility

Introduction

In this page you can find the example usage for android.widget ImageView setVisibility.

Prototype

@RemotableViewMethod
    @Override
    public void setVisibility(int visibility) 

Source Link

Usage

From source file:edu.berkeley.boinc.attach.BatchConflictListAdapter.java

@Override
public View getView(int position, View convertView, ViewGroup parent) {

    final ProjectAttachWrapper listItem = entries.get(position);

    if (Logging.VERBOSE)
        Log.d(Logging.TAG, "BatchConflictListAdapter.getView for: " + listItem.name + " at position: "
                + position + " with result: " + listItem.result);

    LayoutInflater vi = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View v = vi.inflate(R.layout.attach_project_batch_conflicts_listitem, null);
    TextView name = (TextView) v.findViewById(R.id.name);
    name.setText(listItem.name);/*from   w  w  w  . j  av  a  2 s  .  c om*/
    TextView status = (TextView) v.findViewById(R.id.status);
    ImageView resolveIv = (ImageView) v.findViewById(R.id.resolve_button_image);
    ImageView statusImage = (ImageView) v.findViewById(R.id.status_image);
    ProgressBar statusPb = (ProgressBar) v.findViewById(R.id.status_pb);
    RelativeLayout itemWrapper = (RelativeLayout) v.findViewById(R.id.resolve_item_wrapper);
    if (listItem.result == ProjectAttachWrapper.RESULT_SUCCESS) {
        // success
        status.setVisibility(View.GONE);
        resolveIv.setVisibility(View.GONE);
        statusPb.setVisibility(View.GONE);
        statusImage.setVisibility(View.VISIBLE);
        statusImage.setImageDrawable(activity.getResources().getDrawable(R.drawable.checkb));
    } else if (listItem.result == ProjectAttachWrapper.RESULT_ONGOING
            || listItem.result == ProjectAttachWrapper.RESULT_UNINITIALIZED) {
        // ongoing
        status.setVisibility(View.GONE);
        resolveIv.setVisibility(View.GONE);
        statusImage.setVisibility(View.GONE);
        statusPb.setVisibility(View.VISIBLE);
    } else if (listItem.result == ProjectAttachWrapper.RESULT_READY) {
        // ready
        status.setVisibility(View.VISIBLE);
        status.setText(listItem.getResultDescription());
        resolveIv.setVisibility(View.VISIBLE);
        itemWrapper.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                if (Logging.DEBUG)
                    Log.d(Logging.TAG,
                            "BatchConflictListAdapter: start resolution dialog for: " + listItem.name);
                IndividualCredentialInputFragment dialog = IndividualCredentialInputFragment
                        .newInstance(listItem);
                dialog.show(fmgr, listItem.name);
            }
        });
    } else if (listItem.result == ProjectAttachWrapper.RESULT_CONFIG_DOWNLOAD_FAILED) {
        // download failed, can not continue from here.
        // if user wants to retry, need to go back to selection activity
        status.setVisibility(View.VISIBLE);
        status.setText(listItem.getResultDescription());
        resolveIv.setVisibility(View.GONE);
        statusPb.setVisibility(View.GONE);
        statusImage.setVisibility(View.VISIBLE);
        statusImage.setImageDrawable(activity.getResources().getDrawable(R.drawable.failedb));
    } else {
        // failed
        status.setVisibility(View.VISIBLE);
        status.setText(listItem.getResultDescription());
        resolveIv.setVisibility(View.VISIBLE);
        itemWrapper.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                if (Logging.DEBUG)
                    Log.d(Logging.TAG,
                            "BatchConflictListAdapter: start resolution dialog for: " + listItem.name);
                IndividualCredentialInputFragment dialog = IndividualCredentialInputFragment
                        .newInstance(listItem);
                dialog.show(fmgr, listItem.name);
            }
        });
        statusPb.setVisibility(View.GONE);
        statusImage.setVisibility(View.VISIBLE);
        statusImage.setImageDrawable(activity.getResources().getDrawable(R.drawable.failedb));
    }
    return v;
}

From source file:com.layer.atlas.AtlasMessageComposer.java

private void addAttachmentMenuItem(AttachmentSender sender) {
    LayoutInflater inflater = LayoutInflater.from(getContext());
    LinearLayout menuLayout = (LinearLayout) mAttachmentMenu.getContentView();

    View menuItem = inflater.inflate(R.layout.atlas_message_composer_attachment_menu_item, menuLayout, false);
    ((TextView) menuItem.findViewById(R.id.title)).setText(sender.getTitle());
    menuItem.setTag(sender);/*w  ww. j  a v a 2s . co m*/
    menuItem.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            mAttachmentMenu.dismiss();
            ((AttachmentSender) v.getTag()).requestSend();
        }
    });
    if (sender.getIcon() != null) {
        ImageView iconView = ((ImageView) menuItem.findViewById(R.id.icon));
        iconView.setColorFilter(getResources().getColor(R.color.atlas_cell_attachment_title),
                PorterDuff.Mode.MULTIPLY);
        iconView.setImageResource(sender.getIcon());
        iconView.setVisibility(VISIBLE);
        Drawable d = DrawableCompat.wrap(iconView.getDrawable());
        DrawableCompat.setTint(d, getResources().getColor(R.color.atlas_icon_enabled));
    }
    menuLayout.addView(menuItem);
}

From source file:com.ubikod.capptain.android.sdk.reach.CapptainDefaultNotifier.java

/**
 * This function is called when the notification area view must be prepared, e.g. change texts,
 * icon etc... based on the specified content. This is the responsibility of this method to
 * associate actions to the buttons./*from   w  w w  . j a  v a  2s.  com*/
 * @param content content.
 * @param notifAreaView notification area view.
 * @throws RuntimeException on any error the content will be dropped.
 */
protected void prepareInAppArea(final CapptainReachInteractiveContent content, View notifAreaView)
        throws RuntimeException {
    /* Set icon */
    ImageView iconView = ResourcesUtils.getView(notifAreaView, LAYOUT_NOTIFICATION_ICON);
    if (content.hasNotificationIcon()) {
        iconView.setVisibility(View.VISIBLE);
        iconView.setImageResource(mNotificationIcon);
    } else
        iconView.setVisibility(View.GONE);

    /* Set title and message */
    View textArea = ResourcesUtils.getView(notifAreaView, LAYOUT_NOTIFICATION_TEXT);
    if (content.getNotificationTitle() == null && content.getNotificationMessage() == null)
        textArea.setVisibility(View.GONE);
    else {
        /* Show text area */
        textArea.setVisibility(View.VISIBLE);

        /* Title */
        TextView titleView = ResourcesUtils.getView(notifAreaView, LAYOUT_NOTIFICATION_TITLE);
        if (content.getNotificationTitle() == null)
            titleView.setVisibility(View.GONE);
        else {
            titleView.setVisibility(View.VISIBLE);
            titleView.setText(content.getNotificationTitle());
        }

        /* Message */
        TextView messageView = ResourcesUtils.getView(notifAreaView, LAYOUT_NOTIFICATION_MESSAGE);
        if (content.getNotificationMessage() == null)
            messageView.setVisibility(View.GONE);
        else {
            messageView.setVisibility(View.VISIBLE);
            messageView.setText(content.getNotificationMessage());
        }
    }

    /* Set image */
    ImageView imageView = ResourcesUtils.getView(notifAreaView, LAYOUT_NOTIFICATION_IMAGE);
    Bitmap notificationImage = content.getNotificationImage();
    if (notificationImage == null)
        imageView.setVisibility(View.GONE);
    else {
        imageView.setVisibility(View.VISIBLE);
        imageView.setImageBitmap(notificationImage);
    }

    /* Set intent action */
    final View notificationAreaViewFinal = notifAreaView;
    notifAreaView.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            notificationAreaViewFinal.setVisibility(View.GONE);
            content.actionNotification(mContext, true);
        }
    });

    /*
     * Configure close button if not removed from layout (it was not mandatory in previous Reach SDK
     * version).
     */
    View closeButton = ResourcesUtils.getView(notifAreaView, LAYOUT_NOTIFICATION_CLOSE);
    if (closeButton != null) {
        /* Set close action if closeable */
        if (content.isNotificationCloseable()) {
            closeButton.setVisibility(View.VISIBLE);
            closeButton.setOnClickListener(new OnClickListener() {
                @Override
                public void onClick(View v) {
                    notificationAreaViewFinal.setVisibility(View.GONE);
                    content.exitNotification(mContext);
                }
            });
        }

        /* Otherwise hide the close button */
        else
            closeButton.setVisibility(View.GONE);
    }

    /*
     * This optional view is used to ensure that the close button does not overlap the image or
     * text, this is an invisible area. If we hide the text area in the provided layout, the close
     * button area won't be right aligned, that's why we have both an invisible button and an actual
     * button that is always right aligned. If you know a way to avoid that without breaking other
     * possible layouts (every text or icon is optional), please contact us.
     */
    View closeButtonArea = ResourcesUtils.getView(notifAreaView, LAYOUT_NOTIFICATION_CLOSE_AREA);
    if (closeButtonArea != null)
        if (content.isNotificationCloseable())
            closeButtonArea.setVisibility(View.INVISIBLE);
        else
            closeButtonArea.setVisibility(View.GONE);
}

From source file:com.tencent.wetest.fragment.HomePageFragment.java

public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    View mView = inflater.inflate(R.layout.home, container, false);

    app_select_layout = (LinearLayout) mView.findViewById(R.id.app_select_layout);
    app_select_layout.setOnClickListener(new View.OnClickListener() {
        @Override/*from  ww w .jav  a2s .  c o  m*/
        public void onClick(View v) {
            Intent intent = new Intent(getActivity(), AppListActivity.class);
            getActivity().startActivity(intent);

        }
    });

    root_alert_layout = (LinearLayout) mView.findViewById(R.id.root_alert_layout);
    root_alert_layout.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {

            if (!((WTApplication) WTApplication.getContext()).isRoot()) {
                AlertDialog.Builder root_b = new AlertDialog.Builder(getActivity());
                root_b.setTitle(getResources().getString(R.string.explain));
                root_b.setMessage(getResources().getString(R.string.explain_content));
                root_b.setPositiveButton(getResources().getString(R.string.i_know), null);

                AlertDialog root_d = root_b.create();
                root_d.getWindow().setType(WindowManager.LayoutParams.LAST_SUB_WINDOW);

                if (((MainActivity) getActivity()).isRunning())
                    root_d.show();
            }

        }
    });

    appName = (TextView) mView.findViewById(R.id.appName);

    btnstart = (Button) mView.findViewById(R.id.btn_test_start);
    btnstart.setOnClickListener(onStartClick);

    isRoot = (TextView) mView.findViewById(R.id.isRoot);
    isRoot.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {

            if (!((WTApplication) WTApplication.getContext()).isRoot()) {
                AlertDialog.Builder root_b = new AlertDialog.Builder(getActivity());
                root_b.setTitle(getResources().getString(R.string.explain));
                root_b.setMessage(getResources().getString(R.string.explain_content));
                root_b.setPositiveButton(getResources().getString(R.string.i_know), null);

                AlertDialog root_d = root_b.create();
                root_d.getWindow().setType(WindowManager.LayoutParams.LAST_SUB_WINDOW);

                if (((MainActivity) getActivity()).isRunning())
                    root_d.show();
            }
        }
    });

    avail_para = (TextView) mView.findViewById(R.id.avail_para);

    ImageView img_alert = (ImageView) mView.findViewById(R.id.img_alert);

    if (((WTApplication) WTApplication.getContext()).isRoot()) {
        avail_para.setText(getResources().getString(R.string.home_bottom_title) + " FPS");
        img_alert.setVisibility(View.GONE);
    } else {

        avail_para.setText(getResources().getString(R.string.home_bottom_title));
        img_alert.setVisibility(View.VISIBLE);
    }

    //      avail_para.setOnClickListener(new View.OnClickListener() {
    //         @Override
    //         public void onClick(View v) {
    //
    //            if(!((WTApplication)WTApplication.getContext()).isRoot()) {
    //               AlertDialog.Builder root_b = new AlertDialog.Builder(getActivity());
    //               root_b.setTitle(getResources().getString(R.string.explain));
    //               root_b.setMessage(getResources().getString(R.string.explain_content));
    //               root_b.setPositiveButton(getResources().getString(R.string.i_know), null);
    //
    //               AlertDialog root_d = root_b.create();
    //               root_d.getWindow().setType(WindowManager.LayoutParams.LAST_SUB_WINDOW);
    //
    //               if(((MainActivity)getActivity()).isRunning())
    //                  root_d.show();
    //            }
    //         }
    //      });

    if (((WTApplication) WTApplication.getContext()).isRoot()) {
        Logger.info("Homepage is root");
        isRoot.setText(getResources().getString(R.string.phone_is_root));

    }

    mSetting = ((WTApplication) WTApplication.getContext()).getmSetting();
    if (!((WTApplication) WTApplication.getContext()).isRoot() && mSetting.getBoolean("isFirstSetup", true)) {
        mSetting.edit().putBoolean("isFirstSetup", false).apply();
        isRoot.performClick();
    }
    return mView;
}

From source file:org.secuso.privacyfriendlydicegame.MainActivity.java

public void hints(int position) {

    TextView hint = (TextView) findViewById(R.id.initialTextView);
    TextView initialText = (TextView) findViewById(R.id.initialTextTextView);
    TextView hint2 = (TextView) findViewById(R.id.initialTextView2);
    ImageView background = (ImageView) findViewById(R.id.backgroundImageView);

    Animation anim = new AlphaAnimation(0.0f, 1.0f);

    if (position == 0) {
        hint.setVisibility(View.VISIBLE);
        hint2.setVisibility(View.VISIBLE);
        background.setVisibility(View.VISIBLE);
        initialText.setVisibility(View.VISIBLE);

        anim.setDuration(1000);/* w w w .  ja  v a 2 s . c o  m*/
        anim.setStartOffset(20);
        anim.setRepeatMode(Animation.REVERSE);
        anim.setRepeatCount(Animation.INFINITE);
        hint.startAnimation(anim);
        hint2.startAnimation(anim);

    } else {
        hint.clearAnimation();
        hint2.clearAnimation();
        hint.setVisibility(View.INVISIBLE);
        hint2.setVisibility(View.INVISIBLE);
        background.setVisibility(View.INVISIBLE);
        initialText.setVisibility(View.INVISIBLE);
    }

}

From source file:com.binroot.fatpita.BitmapManager2.java

public void fetchBitmapOnThread(final String urlString, final ImageView imageView,
        final ProgressBar indeterminateProgressBar, final Activity act, final int sample) {
    SoftReference<Bitmap> ref = mCache.get(urlString);
    if (ref != null && ref.get() != null) {
        imageView.setImageBitmap(ref.get());
        return;/*ww  w.j  a v a2  s .c om*/
    }

    final Runnable progressBarShow = new Runnable() {
        public void run() {
            if (indeterminateProgressBar != null) {
                imageView.setVisibility(View.GONE);
                indeterminateProgressBar.setVisibility(View.VISIBLE);
            }
        }
    };
    final Runnable progressBarHide = new Runnable() {
        public void run() {
            if (indeterminateProgressBar != null) {
                indeterminateProgressBar.setVisibility(View.GONE);
                imageView.setVisibility(View.VISIBLE);
            }
        }
    };

    final Handler handler = new Handler() {
        @Override
        public void handleMessage(Message message) {
            if (indeterminateProgressBar != null && act != null)
                act.runOnUiThread(progressBarHide);
            imageView.setImageBitmap((Bitmap) message.obj);
        }
    };

    Thread thread = new Thread() {
        @Override
        public void run() {
            if (indeterminateProgressBar != null && act != null)
                act.runOnUiThread(progressBarShow);
            Bitmap bitmap = fetchBitmap(urlString, sample);
            Message message = handler.obtainMessage(1, bitmap);
            handler.sendMessage(message);
        }
    };
    thread.start();
}

From source file:com.partypoker.poker.engagement.reach.EngagementDefaultNotifier.java

/**
 * This function is called when the notification area view must be prepared, e.g. change texts,
 * icon etc... based on the specified content. This is the responsibility of this method to
 * associate actions to the buttons./*w  w  w .  j a v a  2 s . co  m*/
 * @param content content.
 * @param notifAreaView notification area view.
 * @throws RuntimeException on any error the content will be dropped.
 */
protected void prepareInAppArea(final EngagementReachInteractiveContent content, View notifAreaView)
        throws RuntimeException {
    /* Set icon */
    ImageView iconView = EngagementResourcesUtils.getView(notifAreaView, LAYOUT_NOTIFICATION_ICON);
    if (content.hasNotificationIcon()) {
        iconView.setVisibility(View.VISIBLE);
        iconView.setImageResource(mNotificationIcon);
    } else
        iconView.setVisibility(View.GONE);

    /* Set title and message */
    View textArea = EngagementResourcesUtils.getView(notifAreaView, LAYOUT_NOTIFICATION_TEXT);
    if (content.getNotificationTitle() == null && content.getNotificationMessage() == null)
        textArea.setVisibility(View.GONE);
    else {
        /* Show text area */
        textArea.setVisibility(View.VISIBLE);

        /* Title */
        TextView titleView = EngagementResourcesUtils.getView(notifAreaView, LAYOUT_NOTIFICATION_TITLE);
        if (content.getNotificationTitle() == null)
            titleView.setVisibility(View.GONE);
        else {
            titleView.setVisibility(View.VISIBLE);
            titleView.setText(content.getNotificationTitle());
        }

        /* Message */
        TextView messageView = EngagementResourcesUtils.getView(notifAreaView, LAYOUT_NOTIFICATION_MESSAGE);
        if (content.getNotificationMessage() == null)
            messageView.setVisibility(View.GONE);
        else {
            messageView.setVisibility(View.VISIBLE);
            messageView.setText(content.getNotificationMessage());
        }
    }

    /* Set image */
    ImageView imageView = EngagementResourcesUtils.getView(notifAreaView, LAYOUT_NOTIFICATION_IMAGE);
    Bitmap notificationImage = content.getNotificationImage();
    if (notificationImage == null)
        imageView.setVisibility(View.GONE);
    else {
        imageView.setVisibility(View.VISIBLE);
        imageView.setImageBitmap(notificationImage);
    }

    /* Set intent action */
    final View notificationAreaViewFinal = notifAreaView;
    notifAreaView.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            notificationAreaViewFinal.setVisibility(View.GONE);
            content.actionNotification(mContext, true);
        }
    });

    /*
     * Configure close button if not removed from layout (it was not mandatory in previous Reach SDK
     * version).
     */
    View closeButton = EngagementResourcesUtils.getView(notifAreaView, LAYOUT_NOTIFICATION_CLOSE);
    if (closeButton != null) {
        /* Set close action if closeable */
        if (content.isNotificationCloseable()) {
            closeButton.setVisibility(View.VISIBLE);
            closeButton.setOnClickListener(new OnClickListener() {
                @Override
                public void onClick(View v) {
                    notificationAreaViewFinal.setVisibility(View.GONE);
                    content.exitNotification(mContext);
                }
            });
        }

        /* Otherwise hide the close button */
        else
            closeButton.setVisibility(View.GONE);
    }

    /*
     * This optional view is used to ensure that the close button does not overlap the image or
     * text, this is an invisible area. If we hide the text area in the provided layout, the close
     * button area won't be right aligned, that's why we have both an invisible button and an actual
     * button that is always right aligned. If you know a way to avoid that without breaking other
     * possible layouts (every text or icon is optional), please contact us.
     */
    View closeButtonArea = EngagementResourcesUtils.getView(notifAreaView, LAYOUT_NOTIFICATION_CLOSE_AREA);
    if (closeButtonArea != null)
        if (content.isNotificationCloseable())
            closeButtonArea.setVisibility(View.INVISIBLE);
        else
            closeButtonArea.setVisibility(View.GONE);
}

From source file:de.skubware.opentraining.activity.create_workout.ExerciseTypeDetailFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_exercisetype_detail, container, false);
    ViewGroup rootLayout = (ViewGroup) rootView.findViewById(R.id.fragment_exercisetype_detail_layout);

    // If Image Exists
    if (!mExercise.getImagePaths().isEmpty()) {
        // Create Image View
        ImageView imageView = new ImageView(rootView.getContext());
        imageView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
                ViewGroup.LayoutParams.MATCH_PARENT));
        imageView.setPadding(20, 20, 20, 20);
        rootLayout.addView(imageView);/*w  ww.  ja  v a2 s .c o  m*/
        imageView.setVisibility(View.VISIBLE);

        // set gesture detector
        this.mGestureScanner = new GestureDetector(this.getActivity(),
                new ExerciseDetailOnGestureListener(this, imageView, mExercise));

        //Set Image
        DataHelper data = new DataHelper(getActivity());
        imageView.setImageDrawable(data.getDrawable(mExercise.getImagePaths().get(0).toString()));

        rootView.setOnTouchListener(new View.OnTouchListener() {
            @Override
            public boolean onTouch(View v, MotionEvent event) {
                return mGestureScanner.onTouchEvent(event);
            }
        });
    } else {
        TextView textView = new TextView(rootView.getContext());
        textView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
                ViewGroup.LayoutParams.MATCH_PARENT));
        textView.setGravity(Gravity.CENTER);
        textView.setPadding(10, 10, 10, 10);
        textView.setText(Html.fromHtml(mExercise.getDescription()));
        rootLayout.addView(textView);
    }
    return rootView;
}

From source file:com.inc.playground.playground.MainActivity.java

public void setPlayGroundActionBar() {
    String userLoginId, userFullName, userEmail, userPhoto;
    Bitmap imageBitmap = null;//ww w. j a  va2  s  .c o  m
    GlobalVariables globalVariables;
    final ActionBar actionBar = getActionBar();

    final String MY_PREFS_NAME = "Login";
    SharedPreferences prefs = getSharedPreferences(MY_PREFS_NAME, MODE_PRIVATE);
    globalVariables = ((GlobalVariables) this.getApplication());
    if (prefs.getString("userid", null) != null) {
        userLoginId = prefs.getString("userid", null);
        userFullName = prefs.getString("fullname", null);
        userEmail = prefs.getString("emilid", null);
        userPhoto = prefs.getString("picture", null);
        globalVariables.GetCurrentUser().setPhotoUrl(userPhoto);
        actionBar.setCustomView(R.layout.actionbar_custom_view_home);
        actionBar.setDisplayShowTitleEnabled(true);
        actionBar.setDisplayShowCustomEnabled(true);
        actionBar.setDisplayUseLogoEnabled(true);
        actionBar.setDisplayHomeAsUpEnabled(true);

        ImageView logo_image = (ImageView) findViewById(R.id.img_profile_action_bar);
        logo_image.setBackgroundResource(R.drawable.pg_logo2);
        TextView userName = (TextView) findViewById(R.id.email);
        userName.setText(userFullName.replace("%20", "  "));
        ImageView img_profile = (ImageView) findViewById(R.id.profile_image);
        imageBitmap = globalVariables.GetUserPictureBitMap();
        if (imageBitmap == null) {
            Log.i(TAG, "downloading");
            try {
                imageBitmap = new DownloadImageBitmapTask().execute(userPhoto).get();
            } catch (InterruptedException e) {
                e.printStackTrace();
            } catch (ExecutionException e) {
                e.printStackTrace();
            }

        } else {
            Log.i(TAG, "Image found");
        }
        img_profile.setImageBitmap(imageBitmap);

        ImageView notificationBtn = (ImageView) findViewById(R.id.notification_btn);
        notificationBtn.setVisibility(View.VISIBLE);
        notificationBtn.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                Intent iv = new Intent(MainActivity.this, NotificationsList.class);
                startActivity(iv);
                finish();
            }
        });
        TextView notificationNumber = (TextView) findViewById(R.id.notification__numberTxt);
        if (globalVariables.GetNotifications() != null && globalVariables.GetNotifications().size() != 0) {
            notificationNumber.setText(Integer.toString(globalVariables.GetNotifications().size()));
            notificationNumber.setVisibility(View.VISIBLE);
        } else {
            notificationNumber.setVisibility(View.INVISIBLE);
        }

        TextView loginTxt = (TextView) findViewById(R.id.login_txt);
        ImageView loginImg = (ImageView) findViewById(R.id.login_img);
        globalVariables.SetUserPictureBitMap(imageBitmap); // Make the imageBitMap global to all activities to avoid downloading twice
        loginTxt.setText("Logout");
        loginImg.setImageResource(R.drawable.pg_action_lock_close);
        // Register to notifications
        Intent intent = new Intent(this, RegistrationIntentService.class);
        startService(intent);

    }
}

From source file:eu.trentorise.smartcampus.trentinofamiglia.fragments.poi.PoiDetailsFragment.java

@Override
public void onStart() {
    super.onStart();
    if (getPOI() != null) {
        ImageView certifiedIcon = (ImageView) this.getView().findViewById(R.id.poi_details_icon);
        ImageView bannerCertifiedIcon = (ImageView) this.getView().findViewById(R.id.banner_certified);

        Drawable icon = null;/* w w  w .ja va2  s.  c  om*/
        if (CategoryHelper.CAT_POI_FAMILY_IN_TRENTINO.equals(mPoi.getType())) {
            icon = POIHelper.getDrawablePoiFamilyTrentinoDetail(getActivity(), mPoi);
            bannerCertifiedIcon.setVisibility(View.VISIBLE);
        } else if (CategoryHelper.CAT_POI_FAMILY_AUDIT.equals(mPoi.getType())) {
            icon = POIHelper.getDrawablePoiFamilyAuditDetail(getActivity(), mPoi);
            bannerCertifiedIcon.setVisibility(View.VISIBLE);

        }
        certifiedIcon.setImageDrawable(icon);

        // title
        TextView tv = (TextView) this.getView().findViewById(R.id.poi_details_title);
        tv.setText(mPoi.getTitle());

        /*
         * BUTTONS
         */

        // map
        ImageButton mapBtn = (ImageButton) getView().findViewById(R.id.poidetails_map);

        mapBtn.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                ArrayList<BaseDTObject> list = new ArrayList<BaseDTObject>();
                list.add(mPoi);
                MapManager.switchToMapView(list, mFragment);
            }
        });

        // directions
        ImageButton directionsBtn = (ImageButton) getView().findViewById(R.id.poidetails_directions);
        directionsBtn.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                Address to = Utils.getPOIasGoogleAddress(mPoi);
                Address from = null;
                GeoPoint mylocation = MapManager.requestMyLocation(getActivity());
                if (mylocation != null) {
                    from = new Address(Locale.getDefault());
                    from.setLatitude(mylocation.getLatitudeE6() / 1E6);
                    from.setLongitude(mylocation.getLongitudeE6() / 1E6);
                }
                DTHelper.bringmethere(getActivity(), from, to);
            }
        });

        if (mPoi.getLocation()[0] == 0 && mPoi.getLocation()[1] == 0) {
            mapBtn.setVisibility(View.INVISIBLE);
            directionsBtn.setVisibility(View.GONE);
        }

        /*
         * END BUTTONS
         */

        // description, optional
        tv = (TextView) this.getView().findViewById(R.id.poi_details_descr);
        String customDesc = POIHelper.customDescription(mPoi, getActivity());
        if (customDesc != null && customDesc.length() > 0) {
            tv.setText(Html.fromHtml(customDesc));
        } else {
            ((LinearLayout) this.getView().findViewById(R.id.poidetails)).removeView(tv);
        }

        //         // notes
        //         tv = (TextView) this.getView().findViewById(R.id.poi_details_notes);
        //         ((LinearLayout) this.getView().findViewById(R.id.poidetails)).removeView(tv);

        // location
        tv = (TextView) this.getView().findViewById(R.id.poi_details_loc);
        tv.setText(Html.fromHtml("<a href=\"\">" + Utils.getPOIshortAddress(mPoi) + "</a> "));
        tv.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                ArrayList<BaseDTObject> list = new ArrayList<BaseDTObject>();
                list.add(mPoi);
                MapManager.switchToMapView(list, PoiDetailsFragment.this);
            }
        });

        commentsHandler = new CommentsHandler(getPOI(), getActivity(), getView());

    }
}