Code example for DialogFragment

Methods: getActivity, isAdded

0
		m_updateReceiver = null;
	} 
 
	private void updateViews() 
	{ 
		if( m_rocket != null && isAdded() )
		{ 
			m_rocketName.setText( m_rocket.name );
			m_rocketConfiguration.setText( m_rocket.configuration );
 
			if( m_rocketDetail != null )
			{ 
				if( m_rocketImage != null )
				{ 
					ImageLoader imageLoader = new ImageLoader( TMinusApplication
							                                           .getRequestQueue(),  TMinusApplication.getBitmapCache() ); 
					m_rocketImage.setImageUrl( m_rocketDetail.imageUrl, imageLoader );
				} 
 
				if( m_rocketDetail.summary != null )
				{ 
					m_rocketSummary.setText( Html.fromHtml( m_rocketDetail.summary ) );
				} 
			} 
		} 
	} 
 
	private void loadRocket() 
	{ 
		final Activity activity = getActivity();
		final int rocketId = getRocketId();
 
		if( rocketId >= 0 && activity != null )
		{ 
			RocketLoader rocketLoader = new RocketLoader( this, activity );
			rocketLoader.execute( rocketId );
		} 
	} 
 
	public int getRocketId() 
	{ 
		int rocketId = -1;
 
		final Bundle arguments = getArguments();
		if( arguments != null && arguments.containsKey( ARG_ITEM_ID ) )
		{ 
			rocketId = arguments.getInt( ARG_ITEM_ID );
		} 
 
		return rocketId;
	} 
 
	@Override 
	public void rocketLoaded( Rocket rocket )
	{ 
		m_rocket = rocket;
 
		final Activity activity = getActivity();
		if( m_rocket != null && activity != null )
		{ 
			RocketDetailLoader detailLoader = new RocketDetailLoader( activity, this );
			detailLoader.execute( m_rocket.id );