Example usage for android.view ViewGroup findViewById

List of usage examples for android.view ViewGroup findViewById

Introduction

In this page you can find the example usage for android.view ViewGroup findViewById.

Prototype

@Nullable
public final <T extends View> T findViewById(@IdRes int id) 

Source Link

Document

Finds the first descendant view with the given ID, the view itself if the ID matches #getId() , or null if the ID is invalid (< 0) or there is no matching view in the hierarchy.

Usage

From source file:org.csp.everyaware.fragments.FragmentWizardStep1.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    //ottengo il bundle associato al fragment e leggo i parametri passati
    //Bundle bundle = getArguments();    

    //inflating del layout del fragment
    ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.fragment_wizard_step1, container, false);

    Log.d("FragmentWizardStep1", "onCreateView()");

    mRegisterBtn = (Button) rootView.findViewById(R.id.registerBtn);
    mRegisterBtn.setOnClickListener(new OnClickListener() {
        @Override/*from   w w w . j a  v a 2  s.c  o m*/
        public void onClick(View v) {
            //launch external browser to view official site registration form page
            Intent newIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(Constants.CREATE_LOGIN_URL));
            startActivity(newIntent);
        }
    });

    mIhaveAccountBtn = (Button) rootView.findViewById(R.id.i_have_accountBtn);
    mIhaveAccountBtn.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            FragmentWizardStep2 fragment2 = FragmentWizardStep2.newInstance();
            FragmentTransaction transaction = getActivity().getSupportFragmentManager().beginTransaction()
                    .replace(R.id.anchor_layout, fragment2);
            transaction.commit();

            ManageAccount activity = (ManageAccount) getActivity();
            activity.updateExpl(getResources().getString(R.string.username_psw_exp));
        }
    });

    return rootView;
}

From source file:com.conferenceengineer.android.iosched.ui.SandboxDetailFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.fragment_sandbox_detail, null);
    mName = (TextView) rootView.findViewById(R.id.company_name);
    mLogo = (ImageView) rootView.findViewById(R.id.company_logo);
    mUrl = (TextView) rootView.findViewById(R.id.company_url);
    mDesc = (TextView) rootView.findViewById(R.id.company_desc);
    mSubtitle = (TextView) rootView.findViewById(R.id.company_subtitle);
    return rootView;
}

From source file:com.example.android.scrolltricks.QuickReturnFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.fragment_content, container, false);

    mObservableScrollView = (ObservableScrollView) rootView.findViewById(R.id.scroll_view);
    mObservableScrollView.setCallbacks(this);

    mQuickReturnView = (TextView) rootView.findViewById(R.id.sticky);
    mQuickReturnView.setText(R.string.quick_return_item);
    mPlaceholderView = rootView.findViewById(R.id.placeholder);

    mObservableScrollView.getViewTreeObserver()
            .addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
                @Override//from w  w  w.  j a  va 2  s . com
                public void onGlobalLayout() {
                    onScrollChanged(mObservableScrollView.getScrollY());
                    mMaxScrollY = mObservableScrollView.computeVerticalScrollRange()
                            - mObservableScrollView.getHeight();
                    mQuickReturnHeight = mQuickReturnView.getHeight();
                }
            });

    return rootView;
}

From source file:com.fizz.StickyFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.fragment_content, container, false);

    mObservableScrollView = (ObservableScrollView) rootView.findViewById(R.id.scroll_view);
    mObservableScrollView.setCallbacks(this);

    mStickyView = (TextView) rootView.findViewById(R.id.sticky);
    mStickyView.setText(R.string.sticky_item);
    mPlaceholderView = rootView.findViewById(R.id.placeholder);

    mObservableScrollView.getViewTreeObserver()
            .addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
                @Override/*from  w  ww. jav a  2 s . c  o  m*/
                public void onGlobalLayout() {
                    onScrollChanged(mObservableScrollView.getScrollY());
                }
            });

    getNameNumber();
    return rootView;
}

From source file:com.hacktx.android.fragments.GoogleMapFragment.java

@Nullable
@Override//from  w  ww.j a va2s.c  o  m
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    ViewGroup root = (ViewGroup) inflater.inflate(R.layout.fragment_google_map, container, false);

    setHasOptionsMenu(true);

    setupToolbar((Toolbar) root.findViewById(R.id.toolbar), R.string.fragment_maps_title);

    CameraPosition cameraPosition = new CameraPosition.Builder().target(new LatLng(30.268915, -97.740378))
            .zoom(19).build();

    GoogleMapOptions options = new GoogleMapOptions();
    options.mapType(GoogleMap.MAP_TYPE_NORMAL).compassEnabled(false).rotateGesturesEnabled(false)
            .camera(cameraPosition);

    mMapFragment = SupportMapFragment.newInstance(options);
    FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction();
    fragmentTransaction.add(R.id.fragment_container, mMapFragment);
    fragmentTransaction.commit();

    mMapFragment.getMapAsync(this);

    return root;
}

From source file:ooo.oxo.apps.materialize.SearchPanelController.java

public SearchPanelController(ViewGroup container) {
    this.container = container;

    Context context = container.getContext();

    this.resources = context.getResources();

    this.keyword = (EditText) container.findViewById(R.id.keyword);

    container.findViewById(R.id.close).setOnClickListener(v -> clear());

    this.softInputManager = SoftInputManager.from(keyword);
}

From source file:com.conferenceengineer.android.iosched.ui.ExploreFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.fragment_list_with_empty_container_inset,
            container, false);/*  www  .j  ava  2s  .  c o m*/
    mEmptyView = rootView.findViewById(android.R.id.empty);
    inflater.inflate(R.layout.empty_waiting_for_sync, (ViewGroup) mEmptyView, true);
    return rootView;
}

From source file:com.rubengees.introduction.IntroductionFragment.java

@NonNull
private View initViews(@NonNull LayoutInflater inflater, @NonNull ViewGroup container) {
    ViewGroup root = (ViewGroup) inflater.inflate(R.layout.introduction_fragment, container, false);
    ViewGroup contentContainer = (ViewGroup) root.findViewById(R.id.introduction_fragment_content_container);

    if (slide.getCustomViewBuilder() == null) {
        contentContainer.addView(initDefaultViews(inflater, container));
    } else {//w ww  .j a va2 s.  c o m
        contentContainer.addView(initCustomViews(inflater, container));
    }

    root.setBackgroundColor(slide.getColor());
    root.setTag(slide.getPosition());

    return root;
}

From source file:com.racoon.ampdroid.views.SelectedAlbumsView.java

@SuppressLint("InflateParams")
@Override/*  w w w  . j a  v a2 s  .  c o m*/
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    controller = Controller.getInstance();
    ViewGroup root = (ViewGroup) inflater.inflate(R.layout.ampache_songs, null);
    ListView listview = (ListView) root.findViewById(R.id.songs_listview);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        listview.setFastScrollAlwaysVisible(true);
    }
    if (controller.getServer() != null) {
        ArrayList<String> list = new ArrayList<String>();
        for (Album a : controller.getSelectedAlbums()) {
            list.add(a.toString());
        }
        AlbumArrayAdapter adapter = new AlbumArrayAdapter(getActivity().getApplicationContext(), list,
                controller.getSelectedAlbums());
        listview.setAdapter(adapter);
        registerForContextMenu(listview);

        listview.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, final View view, int position, long id) {
                Album a = controller.getSelectedAlbums().get(position);
                controller.getSelectedSongs().clear();
                for (Song s : controller.findSongs(a)) {
                    controller.getSelectedSongs().add(s);
                }
                // Create new fragment and transaction
                SelectedSongsView newFragment = new SelectedSongsView();
                FragmentTransaction transaction = getActivity().getSupportFragmentManager().beginTransaction();

                // Replace whatever is in the fragment_container view with this fragment,
                // and add the transaction to the back stack
                transaction.replace(R.id.content_frame, newFragment);
                transaction.addToBackStack(null);
                ((MainActivity) getActivity()).setActiveFragment(6);
                // Commit the transaction
                transaction.commit();
            }

        });
    }
    setHasOptionsMenu(true);
    return root;
}

From source file:com.racoon.ampdroid.views.SelectedArtistsView.java

@SuppressLint("InflateParams")
@Override//from w  w w  . j  a va2s. com
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    controller = Controller.getInstance();
    ViewGroup root = (ViewGroup) inflater.inflate(R.layout.ampache_songs, null);
    ListView listview = (ListView) root.findViewById(R.id.songs_listview);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        listview.setFastScrollAlwaysVisible(true);
    }
    if (controller.getServer() != null) {
        ArrayList<String> list = new ArrayList<String>();
        for (Artist a : controller.getSelectedArtists()) {
            list.add(a.toString());
        }
        ArtistArrayAdapter adapter = new ArtistArrayAdapter(getActivity().getApplicationContext(), list,
                controller.getSelectedArtists());
        listview.setAdapter(adapter);
        registerForContextMenu(listview);

        listview.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, final View view, int position, long id) {
                Artist a = controller.getSelectedArtists().get(position);
                controller.getSelectedSongs().clear();
                for (Song s : controller.findSongs(a)) {
                    controller.getSelectedSongs().add(s);
                }
                // Create new fragment and transaction
                SelectedSongsView newFragment = new SelectedSongsView();
                FragmentTransaction transaction = getActivity().getSupportFragmentManager().beginTransaction();

                // Replace whatever is in the fragment_container view with this fragment,
                // and add the transaction to the back stack
                transaction.replace(R.id.content_frame, newFragment);
                transaction.addToBackStack(null);
                ((MainActivity) getActivity()).setActiveFragment(6);
                // Commit the transaction
                transaction.commit();
            }

        });
    }
    setHasOptionsMenu(true);
    return root;
}