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:com.jvacx.appcoes.auth.fragments.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);

    TypedArray bgs = getResources().obtainTypedArray(R.array.bgs);
    View view = rootView.findViewById(R.id.imgBackground);
    view.setBackground(bgs.getDrawable(getPageNumber()));

    return rootView;
}

From source file:com.medisa.myspacecal.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.removeAllViews();

    Intent mioIntent = getActivity().getIntent();

    nSatelliti = mioIntent.getStringExtra("satelliti").split(",");
    Log.e("EXTRA", mioIntent.getStringExtra("satelliti"));
    for (int i = 0; i < nSatelliti.length; i++) {
        if (nSatelliti[i] != "null") {
        }/*ww  w  . j a v a2  s. com*/
    }

    TextView a = new TextView(MainActivity.ctx);
    a.setTextAppearance(getActivity().getApplicationContext(), R.style.Item_Bottom);
    mObservableScrollView.addView(a);

    TextView b = new TextView(MainActivity.ctx);
    b.setTextAppearance(getActivity().getApplicationContext(), R.style.Item_Bottom);
    mObservableScrollView.addView(b);

    mObservableScrollView.getViewTreeObserver()
            .addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
                @Override
                public void onGlobalLayout() {
                    onScrollChanged();
                }
            });

    return rootView;
}

From source file:com.simplelecture.main.fragments.HomePromoSlidePageFragment.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.imageView);

    if (!bannersArrayLst.get(mPageNumber).getImage().equals("")
            && bannersArrayLst.get(mPageNumber).getImage() != null) {

        Picasso.with(getActivity()).load(bannersArrayLst.get(mPageNumber).getImage())
                .placeholder(R.mipmap.loading) // optional
                .error(R.mipmap.app_icon) // optional
                .fit()//from w  w w. j a  v a 2  s.co  m
                //.resize(250, 200)                        // optional
                //.rotate(90)                             // optional
                .into(imageView);
    } else {
        imageView.setImageResource(R.mipmap.app_icon);
    }

    return rootView;
}

From source file:com.simplelecture.main.fragments.SplashPromoSlidePageFragment.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.imageView);

    if (!splashResponseModelLstArray.get(mPageNumber).getImage().equals("")
            && splashResponseModelLstArray.get(mPageNumber).getImage() != null) {

        Picasso.with(getActivity()).load(splashResponseModelLstArray.get(mPageNumber).getImage())
                .placeholder(R.mipmap.loading) // optional
                .error(R.mipmap.app_icon).fit()// optional
                //.resize(250, 200)                        // optional
                //.rotate(90)                             // optional
                .into(imageView);/*www.  j a  v a 2  s . c  om*/
    } else {
        imageView.setImageResource(R.mipmap.app_icon);
    }

    return rootView;
}

From source file:com.google.cloud.solutions.griddler.android.ui.game.QuestionAnswerView.java

/**
 * Initialize the answer layout and animations as well as setting up the skip button click event
 *///from  w  w w  .j  av a 2s .co m
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    Log.d(LOG_TAG, "onCreateView");

    final ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.fragment_game_questionanswer, container,
            false);

    textViewSkip = (TextView) rootView.findViewById(R.id.textViewSkip);

    textViewSkip.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            gameManager.onQuestionSkipped();
            rootView.invalidate();
        }
    });

    if (wordRenderModel != null) {
        TextView questionText = (TextView) rootView.findViewById(R.id.questionText);
        questionText.setText(wordRenderModel.getQuestion());
    }

    return rootView;
}

From source file:com.example.pc.mylauncher.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);

    //        // Set the title view to show the page number.
    ((TextView) rootView.findViewById(R.id.welcome_info_title)).setText(getResources().getText(title));
    ((TextView) rootView.findViewById(R.id.welcome_info_info)).setText(getResources().getText(info));

    return rootView;
}

From source file:org.hansel.myAlert.WelcomeInfo.Welcome01Fragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    ViewGroup rootView = (ViewGroup) inflater.inflate(org.hansel.myAlert.R.layout.bienvenida01, container,
            false);//from   w  w  w .  j a  v a  2 s .co m

    TextView texto = (TextView) rootView.findViewById(R.id.textView1);
    ImageView icono = (ImageView) rootView.findViewById(R.id.imageView1);

    switch (number) {
    case 0:
        texto.setText(
                "Hancel crea un puente entre periodistas y organizaciones dedicadas a proteger la libertad de expresin.");
        icono.setImageResource(R.drawable.icono1);
        break;
    case 1:
        texto.setText(
                "Es posible programar Hancel para que acompae al usuario durante coberturas de riesgo y enve alertas automticas si el periodista no atiende notificaciones. ");
        icono.setImageResource(R.drawable.icono5);
        break;
    case 2:
        texto.setText(
                "Hancel lanza una alerta de emergencia a contactos de confianza con la ubicacin exacta del GPS del telfono. ");
        icono.setImageResource(R.drawable.icono4);
        break;
    case 3:
        texto.setText(
                "Hancel crea una comunidad de organizaciones e individuos de confianza de manera instantnea al emitir una alerta. ");
        icono.setImageResource(R.drawable.icono3);
        break;
    case 4:
        texto.setText(
                "Hancel le da herramientas a los periodistas para que tengan mayor control de su propia seguridad.");
        icono.setImageResource(R.drawable.icono2);
        break;
    default:
        break;
    }

    return rootView;

}

From source file:cn.jarlen.mediaplayer.sample.fragments.RecentMediaListFragment.java

@Nullable
@Override//from   w  w w. ja  v  a2  s .  co m
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    ViewGroup viewGroup = (ViewGroup) inflater.inflate(R.layout.fragment_file_list, container, false);
    mFileListView = (ListView) viewGroup.findViewById(R.id.file_list_view);
    return viewGroup;
}

From source file:com.medisa.myspacecal.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// w w w .j a  v  a2 s . c o m
                public void onGlobalLayout() {
                    onScrollChanged();
                    mCachedVerticalScrollRange = mObservableScrollView.computeVerticalScrollRange();
                    mQuickReturnHeight = mQuickReturnView.getHeight();
                }
            });

    return rootView;
}

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

@SuppressLint("InflateParams")
@Override/*  w  ww .  j av a  2  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);
    registerForContextMenu(listview);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        listview.setFastScrollAlwaysVisible(true);
    }
    if (controller.getServer() != null) {
        ArrayList<String> list = new ArrayList<String>();
        for (Song s : controller.getSongs()) {
            list.add(s.toString());
        }
        SongArrayAdapter adapter = new SongArrayAdapter(getActivity().getApplicationContext(), list,
                controller.getSongs());
        listview.setAdapter(adapter);
        listview.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, final View view, int position, long id) {
                Log.d("Play now added:", controller.getSongs().get(position).toString());
                controller.getPlayNow().add(controller.getSongs().get(position));
                Context context = view.getContext();
                CharSequence text = getResources().getString(R.string.songsViewSongAdded);
                int duration = Toast.LENGTH_SHORT;
                Toast toast = Toast.makeText(context, text, duration);
                toast.show();
            }

        });
    }
    return root;
}