Fragment getResources - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Fragment getResources method.

This code example shows how to use the following methods:getActivity, getResources
 
	@Override 
	public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
		if (savedInstanceState != null)
			mColorRes = savedInstanceState.getInt("mColorRes");
		int color = getResources().getColor(mColorRes);
		// construct the RelativeLayout 
		RelativeLayout v = new RelativeLayout(getActivity());
		v.setBackgroundColor(color);		
		return v;
	} 
	 
	@Override 
	public void onSaveInstanceState(Bundle outState) {
		super.onSaveInstanceState(outState);
		outState.putInt("mColorRes", mColorRes);
	} 
	 
} 
8
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getActivity, getResources
	    	viewer.setBackgroundResource(matchResourceID(content));
	    } 
	} 
	 
	private int matchResourceID(String content) {
		return getResources().getIdentifier("mt" + content, "drawable", getActivity().getPackageName());
		 
	} 
 
} 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getActivity, getResources
 
	@Override 
	public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
		if (savedInstanceState != null)
			mColorRes = savedInstanceState.getInt("mColorRes");
		int color = getResources().getColor(mColorRes);
		// construct the RelativeLayout 
		RelativeLayout v = new RelativeLayout(getActivity());
		v.setBackgroundColor(color);		
		return v;
	} 
	 
	@Override 
	public void onSaveInstanceState(Bundle outState) {
		super.onSaveInstanceState(outState);
		outState.putInt("mColorRes", mColorRes);
	} 
	 
} 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getActivity, getResources
 
	@Override 
	public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
		if (savedInstanceState != null)
			mColorRes = savedInstanceState.getInt("mColorRes");
		int color = getResources().getColor(mColorRes);
		// construct the RelativeLayout 
		RelativeLayout v = new RelativeLayout(getActivity());
		v.setBackgroundColor(color);		
		return v;
	} 
	 
	@Override 
	public void onSaveInstanceState(Bundle outState) {
		super.onSaveInstanceState(outState);
		outState.putInt("mColorRes", mColorRes);
	} 
	 
} 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getActivity, getResources
 
	@Override 
	public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
		if (savedInstanceState != null)
			mColorRes = savedInstanceState.getInt("mColorRes");
		int color = getResources().getColor(mColorRes);
		// construct the RelativeLayout 
		RelativeLayout v = new RelativeLayout(getActivity());
		v.setBackgroundColor(color);		
		return v;
	} 
	 
	@Override 
	public void onSaveInstanceState(Bundle outState) {
		super.onSaveInstanceState(outState);
		outState.putInt("mColorRes", mColorRes);
	} 
	 
} 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getResources, getView
		return layout;
	} 
 
	private void init(View layout) {
		ImageView imageView = (ImageView) layout.findViewById(android.R.id.icon);
		imageView.setImageDrawable(getResources().getDrawable(time.getPicture()));
		 
		TextView textView = (TextView) layout.findViewById(android.R.id.text1);
		textView.setText(time.getNome());
	} 
	 
	public void updateFragment(Time time) { 
		setTime(time); 
		init(this.getView());
	} 
	 
	public void setTime(Time time) { 
		this.time = time;
	} 
	 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getActivity, getResources
	@SuppressWarnings("deprecation") 
	@Override 
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
 
		LinearLayout layout = new LinearLayout(getActivity());
		layout.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,
				LayoutParams.FILL_PARENT));
		layout.setGravity(Gravity.CENTER);
 
		ImageView img = new ImageView(getActivity());
		int sdk = android.os.Build.VERSION.SDK_INT;
		if (sdk < android.os.Build.VERSION_CODES.JELLY_BEAN) {
			img.setBackgroundDrawable(getResources().getDrawable(
					ICONS[mCurrentPage]));
		} else { 
			img.setBackground(getResources().getDrawable(ICONS[mCurrentPage]));
		} 
 
		layout.addView(img);

4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getResources
 
        loadGirlImage(); 
    } 
 
    private void setDrawableToImageView(int drawableId, int imageViewId) {
        Resources res = getResources();
        Drawable drawable = res.getDrawable(drawableId);
        ImageView imageView = (ImageView) activity.findViewById(imageViewId);
        imageView.setImageDrawable(drawable);
    } 
 
} 
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java

Related Fragment getResources Questions & Answers:

getResources Method Overview
Return getActivity().getResources().
See Code Examples for other Android Fragment Methods: