List of usage examples for android.widget ImageView setImageResource
@android.view.RemotableViewMethod(asyncImpl = "setImageResourceAsync") public void setImageResource(@DrawableRes int resId)
From source file:com.google.firebase.quickstart.analytics.java.ImageFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_main, null); ImageView imageView = view.findViewById(R.id.imageView); imageView.setImageResource(resId); return view;//from w w w .j a va 2 s . c o m }
From source file:com.manuelpeinado.fadingactionbar.demo.SampleFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = mFadingHelper.createView(inflater); if (mArguments != null) { ImageView img = (ImageView) view.findViewById(R.id.image_header); img.setImageResource(mArguments.getInt(ARG_IMAGE_RES)); }// w w w. java2s . c om return view; }
From source file:com.google.firebase.quickstart.analytics.ImageFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_main, null); ImageView imageView = (ImageView) view.findViewById(R.id.imageView); imageView.setImageResource(resId); return view;//from ww w. j av a 2s . com }
From source file:com.google.samples.quickstart.analytics.ImageFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_main, container, false); ImageView imageView = (ImageView) view.findViewById(R.id.imageView); imageView.setImageResource(resId); return view;/*from ww w .ja va2s . co m*/ }
From source file:com.fuzz.emptyhusk.prefab.InlineAdapter.java
@Override public Object instantiateItem(ViewGroup container, int position) { int resId = (position % 3 == 0) ? R.drawable.rectangle_wide_secondary : R.drawable.rectangle_wide_tertiary; ImageView inflated = new ImageView(container.getContext()); inflated.setImageResource(resId); container.addView(inflated);//from w w w . j av a 2 s . c o m viewCache.put(position, inflated); return inflated; }
From source file:com.acrylicgoat.houstonbicyclemuseum.fragment.LandingFragment.java
@Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); ImageView iv = (ImageView) view.findViewById(R.id.landingImage1); iv.setImageResource(R.drawable.launch1); iv.setClickable(true);//from w ww. j a v a2 s . c o m iv.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { //open about us Intent aboutIntent = new Intent(getActivity().getApplicationContext(), AboutUsActivity.class); aboutIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(aboutIntent); } }); ImageView iv2 = (ImageView) view.findViewById(R.id.landingImage2); iv2.setImageResource(R.drawable.launch2); iv2.setClickable(true); iv2.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { //open gallery Intent mainIntent = new Intent(getActivity().getApplicationContext(), ViewPagerActivity.class); mainIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(mainIntent); } }); }
From source file:com.connectsdk.smarthomesampler.dialog.HueFragmentDialog.java
@NonNull @Override//from w w w. j ava 2 s.c om public Dialog onCreateDialog(Bundle savedInstanceState) { Context context = getActivity(); final ImageView image = new ImageView(getActivity()); image.setAdjustViewBounds(true); image.setImageResource(R.drawable.press_smartbridge); return new AlertDialog.Builder(context).setTitle(R.string.press_hue_button).setView(image) .setCancelable(true).create(); }
From source file:com.horizonx.simplesaving.ScreenSlidePageFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout containing a title and body text. ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.fragment_screen_slide_page, container, false); ImageView imageView = (ImageView) rootView.findViewById(R.id.tutorial_page); imageView.setImageResource((Integer) ScreenSlideActivity.getPageElement(mPageNumber)); return rootView; }
From source file:com.airad.zhonghan.PullToRefreshListFragmentActivity.java
/** Called when the activity is first created. */ @Override//w w w . j av a2s . co m public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_ptr_list_fragment); mPullRefreshListFragment = (PullToRefreshListFragment) getSupportFragmentManager() .findFragmentById(R.id.frag_ptr_list); // Get PullToRefreshListView from Fragment mPullRefreshListView = mPullRefreshListFragment.getPullToRefreshListView(); // Set a listener to be invoked when the list should be refreshed. mPullRefreshListView.setOnRefreshListener(this); // You can also just use mPullRefreshListFragment.getListView() ListView actualListView = mPullRefreshListView.getRefreshableView(); mListItems = new LinkedList<String>(); mListItems.addAll(Arrays.asList(mStrings)); mAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, mListItems); ImageView img = new ImageView(this); img.setImageResource(R.drawable.ic_action_search); actualListView.addHeaderView(img); // You can also just use setListAdapter(mAdapter) or // mPullRefreshListView.setAdapter(mAdapter) actualListView.setAdapter(mAdapter); mPullRefreshListFragment.setListShown(true); }
From source file:com.google.android.gms.samples.wallet.ItemDetailsFragment.java
/** * Updates the item details with the item in {@link Constants#ITEMS_FOR_SALE} * at <code>position</code>/*www . j av a 2 s . co m*/ * * @param position The index of the item in {@link Constants#ITEMS_FOR_SALE} * @see Constants#ITEMS_FOR_SALE */ public void setItemId(int position) { mItemId = position; ItemInfo itemInfo = Constants.ITEMS_FOR_SALE[mItemId]; TextView itemName = (TextView) mRoot.findViewById(R.id.text_details_item_name); itemName.setText(itemInfo.name); TextView itemPrice = (TextView) mRoot.findViewById(R.id.text_details_item_price); itemPrice.setText(Util.formatPrice(getActivity(), itemInfo.priceMicros)); ImageView imageView = (ImageView) mRoot.findViewById(R.id.image_details_item_image); imageView.setImageResource(itemInfo.imageResourceId); Button button = (Button) mRoot.findViewById(R.id.button_details_button_add); button.setOnClickListener(this); }