private void initMaps(UserInterface userInterface) { MapView mapView = (MapView) findViewById(R.id.mapview); mapView.setBuiltInZoomControls(true); mapOverlays = mapView.getOverlays(); hashMapOverlayItem = new HashMap<String, MapOverlayItem>(); mMapsPinOrange = this.getResources().getDrawable(R.drawable.maps_pin_orange); int w = mMapsPinOrange.getIntrinsicWidth(); int h = mMapsPinOrange.getIntrinsicHeight(); mMapsPinOrange.setBounds(-w / 2, -h, w / 2, 0); mMapsPinGreen = this.getResources().getDrawable(R.drawable.maps_pin_green); mMapsPinGreen.setBounds( 0, 0, mMapsPinGreen.getIntrinsicWidth(), mMapsPinGreen.getIntrinsicHeight()); overlay = new MapItemnizedOverlay(mMapsPinGreen, this); mapController = mapView.getController(); mapOverlays.add(overlay); mHandler.postDelayed(addMarker(userInterface), 200); if (UserManager.getInstance().thisUser().getGeoPoint() != null) { mHandler.postDelayed(addMarker(UserManager.getInstance().getThisUser()), 200); } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_help_er_call_details); Bundle extras = getIntent().getExtras(); String userID = extras.getString("USER_ID"); UserInterface mUser = UserManager.getInstance().getUserById(userID); if (mUser == null) { throw new NullPointerException( LOGTAG + ": User with ID " + userID + " could not be retrieved from Extras-Bundle at onCreate()"); } TextView name = (TextView) findViewById(R.id.tv_help_ee_name); name.setText(Html.fromHtml(name.getText() + " " + mUser.getName())); TextView age = (TextView) findViewById(R.id.tv_help_ee_age); age.setText(Html.fromHtml(age.getText() + " " + mUser.getAge())); TextView gender = (TextView) findViewById(R.id.tv_help_ee_gender); if (mUser.getGender().equalsIgnoreCase("female")) { gender.setText(Html.fromHtml(gender.getText() + " " + getString(R.string.female))); } else { gender.setText(Html.fromHtml(gender.getText() + " " + getString(R.string.male))); } ImageView picture = (ImageView) findViewById(R.id.iv_help_ee_picture); picture.setImageDrawable( new LayerDrawable( ImageUtility.retrieveDrawables(getApplicationContext(), mUser.getPicture()))); picture.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { setZoomLevel(); } }); mHandler = new Handler(); initMaps(mUser); TaskManager.getInstance().addTaskEventListener(this); }