List of usage examples for android.view View findViewById
@Nullable public final <T extends View> T findViewById(@IdRes int id)
From source file:com.manning.androidhacks.hack030.view.CountryView.java
public CountryView(Context context, AttributeSet attrs) { super(context, attrs); LayoutInflater inflater = LayoutInflater.from(context); View v = inflater.inflate(R.layout.country_view, this, true); mTitle = (TextView) v.findViewById(R.id.country_view_title); mCheckBox = (CheckBox) v.findViewById(R.id.country_view_checkbox); }
From source file:net.naonedbus.fragment.impl.WebViewFragment.java
@Override protected void bindView(final View view, final Bundle savedInstanceState) { try {/*from w w w . j a v a 2 s. c om*/ final WebView wv = (WebView) view.findViewById(R.id.webView); wv.setBackgroundColor(getResources().getColor(R.color.activity_background_light)); final int rawId = getArguments().getInt(PARAM_RAW_ID); final String content = IOUtils.toString(getResources().openRawResource(rawId), ENCODING); // Problme d'encodage avec le loadData. wv.loadDataWithBaseURL("fake://not/needed", content, "text/html", ENCODING, ""); } catch (final NotFoundException e) { Log.e(LOG_TAG, "Erreur de chargement des notes de versions", e); } catch (final IOException e) { Log.e(LOG_TAG, "Erreur de chargement des notes de versions", e); } }
From source file:com.example.util.Utils.java
/** * Show toast information//from w w w. j av a 2 s. co m * * @param context * application context * @param text * the information which you want to show * @return show toast dialog */ public static void makeEventToast(Context context, String text, boolean isLongToast) { Toast toast = null; if (isLongToast) { toast = Toast.makeText(context, "", Toast.LENGTH_LONG); } else { toast = Toast.makeText(context, "", Toast.LENGTH_SHORT); } View v = LayoutInflater.from(context).inflate(R.layout.toast_view, null); TextView textView = (TextView) v.findViewById(R.id.text); textView.setText(text); toast.setView(v); toast.show(); }
From source file:net.naonedbus.fragment.impl.VersionsFragment.java
@Override protected void bindView(final View view, final Bundle savedInstanceState) { try {/* ww w. j a v a 2s . c om*/ final WebView wv = (WebView) view.findViewById(R.id.webView); wv.setBackgroundColor(getResources().getColor(R.color.activity_background_light)); final String content = IOUtils.toString(getResources().openRawResource(R.raw.version), ENCODING); // Problme d'encodage avec le loadData. wv.loadDataWithBaseURL("fake://not/needed", content, "text/html", ENCODING, ""); } catch (final NotFoundException e) { Log.e(LOG_TAG, "Erreur de chargement des notes de versions", e); } catch (final IOException e) { Log.e(LOG_TAG, "Erreur de chargement des notes de versions", e); } // if (mUpgradeError) { // InfoDialogUtils.show(this, R.string.error_title_upgrade, // R.string.error_summary_upgrade); // } }
From source file:fr.cph.chicago.core.adapter.PopupBusDetailsFavoritesAdapter.java
@Override public final View getView(final int position, final View convertView, final ViewGroup parent) { final LayoutInflater vi = (LayoutInflater) parent.getContext() .getSystemService(Context.LAYOUT_INFLATER_SERVICE); final View rowView = vi.inflate(R.layout.popup_bus_cell_0, parent, false); final TextView textView = (TextView) rowView.findViewById(R.id.label); final String toDisplay = values.get(position).getStopName() + " (" + WordUtils.capitalize(values.get(position).getBound().toLowerCase()) + ")"; textView.setText(toDisplay);//from ww w. j a va 2 s . c o m return rowView; }
From source file:zjut.soft.finalwork.fragment.PageFragment1.java
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.page1, null); tv = (TextView) view.findViewById(R.id.page1_textview); mHandler = new Handler(); return view;/* ww w . j av a 2s. c om*/ }
From source file:com.google.cast.samples.games.spritedemo.SpriteDemoFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { mJsonMessage = new JSONObject(); try {//from w w w .j ava 2s. c om mJsonMessage.put("type", 1); } catch (JSONException e) { Log.e(TAG, "Error creating JSON message", e); } // Inflate the layout for this fragment. View view = inflater.inflate(R.layout.spritedemo_fragment, container, false); mAddSpriteButton = (Button) view.findViewById(R.id.button_add_sprite); mAddSpriteButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { CastConnectionManager manager = SpritedemoApplication.getInstance().getCastConnectionManager(); manager.getGameManagerClient().sendGameMessage(mJsonMessage); } }); return view; }
From source file:com.skobka.tram.ui.adapter.RouteListAdapter.java
@Override public View getView(int position, View convertView, ViewGroup parent) { View view = createView(R.layout.route_item, convertView, parent); Route route = this.getItem(position); ((TextView) view.findViewById(R.id.routeItemTitle)).setText(route.getFullTitle()); ((TextView) view.findViewById(R.id.routeItemDays)).setText(getRouteDays(route)); ((TextView) view.findViewById(R.id.routeItemDirections)).setText(getRouteDirections(route)); return view;/*from w ww.j a va 2 s.co m*/ }
From source file:com.example.fabian.matchit.FragmentTabsProduct.java
@Override public void onViewCreated(View view, Bundle savedInstanceState) { mViewPager = (ViewPager) view.findViewById(R.id.viewpager); mViewPager.setAdapter(new SamplePagerAdapter()); mSlidingTabLayout = (SlidingTabLayout) view.findViewById(R.id.sliding_tabs); mSlidingTabLayout.setViewPager(mViewPager); }
From source file:com.nextgis.woody.fragment.PhotoFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_empty, container, false); LinearLayout layout = (LinearLayout) view.findViewById(R.id.photo_holder); IFormControl control = (PhotoGallery) getActivity().getLayoutInflater() .inflate(com.nextgis.maplibui.R.layout.formtemplate_photo, layout, false); MapBase mapBase = MapBase.getInstance(); VectorLayer layer = (VectorLayer) mapBase.getLayerByName(Constants.KEY_MAIN); ((PhotoGallery) control).init(layer, mFeatureId); try {/*from www. j a va2s .com*/ control.init(null, null, null, null, null); } catch (JSONException e) { e.printStackTrace(); } control.addToLayout(layout); return view; }