Example usage for android.widget LinearLayout findViewById

List of usage examples for android.widget LinearLayout findViewById

Introduction

In this page you can find the example usage for android.widget LinearLayout 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.jorge.lolin1.ui.frags.ChampionSkinSupportFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    if (container == null) {
        return null;
    }//  w  w  w.  j a  va2s. c  o  m

    LinearLayout l = (LinearLayout) inflater.inflate(R.layout.fragment_champion_skin, container, false);

    ScalableLinearLayout root = (ScalableLinearLayout) l.findViewById(R.id.skin_root_view);
    float scale = this.getArguments().getFloat(KEY_SCALE);
    root.setScaleBoth(scale);

    ImageView skinView = (ImageView) l.findViewById(R.id.skin_view);
    skinView.setImageDrawable(new BitmapDrawable(getResources(),
            ChampionManager.getInstance().getSplashImageByChampion(
                    (Champion) getArguments().getParcelable(KEY_CHAMPION), context, -1, -1,
                    getArguments().getInt(KEY_POSITION))));

    TextView skinNameView = (TextView) l.findViewById(R.id.skin_name);
    skinNameView.setText(((Champion) getArguments().getParcelable(KEY_CHAMPION)).getSkinNames()[getArguments()
            .getInt(KEY_POSITION)]);

    return l;
}

From source file:com.ketanolab.simidic.adapters.AdaptadorViewPager.java

@Override
public Object instantiateItem(View collection, int position) {
    LinearLayout linearLayout = (LinearLayout) View.inflate(contexto, R.layout.diccionario2, null);

    // titulo// w ww  . j ava2  s. c o m
    TextView textoTitulo = (TextView) linearLayout.findViewById(R.id.textview_titulo);
    textoTitulo.setText(listaTitulos.get(position));
    // Subtitulo
    TextView textoSubtitulo = (TextView) linearLayout.findViewById(R.id.textview_subtitulo);
    textoSubtitulo.setText(listaSubtitulos.get(position));
    // Extra
    TextView textoExtra = (TextView) linearLayout.findViewById(R.id.textview_extra);
    textoExtra.setText(listaExtras.get(position));
    textoExtra.setMovementMethod(LinkMovementMethod.getInstance());
    // Imagen
    ImageView imagen = (ImageView) linearLayout.findViewById(R.id.imageview_logo);
    imagen.setImageResource(listaBitmaps.get(position));

    ((ViewPager) collection).addView(linearLayout, 0);
    return linearLayout;
}

From source file:org.tomahawk.tomahawk_android.dialogs.CreateUserPlaylistDialog.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    // Check if there is a playlist key in the provided arguments
    if (getArguments() != null && getArguments().containsKey(TomahawkFragment.TOMAHAWK_USERPLAYLIST_KEY)) {
        mUserPlaylist = UserPlaylist//  w  w  w  .  j a  va  2s . com
                .getUserPlaylistById(getArguments().getString(TomahawkFragment.TOMAHAWK_USERPLAYLIST_KEY));
        if (mUserPlaylist == null) {
            dismiss();
        }
    }

    //set the proper flags for our edittext
    LayoutInflater inflater = getActivity().getLayoutInflater();
    LinearLayout textLayout = (LinearLayout) inflater.inflate(R.layout.config_text, null);
    mNameEditText = (ConfigEdittext) textLayout.findViewById(R.id.config_edittext);
    mNameEditText.setHint(R.string.playbackactivity_playlist_dialog_name_hint);
    mNameEditText.setOnEditorActionListener(mOnKeyboardEnterListener);
    addViewToFrame(textLayout);

    showSoftKeyboard(mNameEditText);

    //Set the textview's text to the proper title
    setDialogTitle(getString(R.string.playbackactivity_save_playlist_dialog_title));

    hideEnabledCheckbox();
    hideStatusImage();

    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    builder.setView(getDialogView());
    return builder.create();
}

From source file:org.yasik.android.utils.conditions.RateAppDialogFragment.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    setCancelable(true);//from   w  w w  .j a v  a  2  s  .  c  o m
    // Inflate and build the dialog view.
    LayoutInflater inflater = getActivity().getLayoutInflater();
    LinearLayout dialogLayout = (LinearLayout) inflater.inflate(R.layout.rateapp_dialog_fragment, null);
    TextView textView = (TextView) dialogLayout.findViewById(R.id.rateapp_dialog_text);
    textView.setText(Html.fromHtml(getString(R.string.rateapp_dialog_text)));
    textView.setMovementMethod(LinkMovementMethod.getInstance());
    textView.setSingleLine(false);

    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    builder.setView(dialogLayout).setTitle(R.string.rateapp_dialog_title)
            .setPositiveButton(R.string.rateapp_btn_title_rateme, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    mListener.onDialogRateNowClick(RateAppDialogFragment.this);
                }
            }).setNeutralButton(R.string.rateapp_btn_title_remind, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    mListener.onDialogRemindClick(RateAppDialogFragment.this);
                }
            }).setNegativeButton(R.string.rateapp_btn_title_cancel, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    mListener.onDialogCancelClick(RateAppDialogFragment.this);
                }
            }).setOnCancelListener(new DialogInterface.OnCancelListener() {
                @Override
                public void onCancel(DialogInterface dialog) {
                    mListener.onDialogCancelClick(RateAppDialogFragment.this);
                }
            });
    return builder.create();
}

From source file:it.gaiacri.mobile.AboutAttivita.java

public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    LinearLayout v = (LinearLayout) inflater.inflate(R.layout.activity_about, container, false);

    ((TextView) v.findViewById(R.id.about_title)).setText("Gaia Mobile v " + getString(R.string.app_version));

    GaiaGoogleAnalytics.notifyScreen(getActivity().getApplicationContext(), "About");

    //licenza// w ww.  j a  va2  s  . c  om
    ((TextView) v.findViewById(R.id.about_licenza))
            .setText(Html.fromHtml("Questa applicazione  rilasciata con licenza <a href=\"\">GPL v3</a>"));
    ((TextView) v.findViewById(R.id.about_licenza)).setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            AlertDialog.Builder alert = new AlertDialog.Builder(AboutAttivita.this.getActivity());
            WebView wv = new WebView(AboutAttivita.this.getActivity());
            wv.loadUrl("https://raw.githubusercontent.com/CroceRossaItaliana/gaia-android/master/LICENSE.txt");
            wv.setWebViewClient(new WebViewClient() {
                @Override
                public boolean shouldOverrideUrlLoading(WebView view, String url) {
                    view.loadUrl(url);

                    return true;
                }
            });
            alert.setView(wv);
            alert.setNegativeButton("Chiudi", new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int id) {
                    dialog.dismiss();
                }
            });
            alert.show();
        }
    });
    //portale gaia
    ((TextView) v.findViewById(R.id.about_portale_gaia))
            .setText(Html.fromHtml("<a href=\"\">Portale Gaia</a>"));
    ((TextView) v.findViewById(R.id.about_portale_gaia)).setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            Internet("https://gaia.cri.it");
        }
    });
    //informazioni gaia
    ((TextView) v.findViewById(R.id.about_gaia)).setText(Html.fromHtml("<a href=\"\">Informazioni GAIA</a>"));
    ((TextView) v.findViewById(R.id.about_gaia)).setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            Internet("https://gaia.cri.it/?p=public.about");
        }
    });
    //portale sviluppo mobile
    ((TextView) v.findViewById(R.id.about_gaia_mobile))
            .setText(Html.fromHtml("<a href=\"\">Codice Sorgente Gaia Mobile</a>"));
    ((TextView) v.findViewById(R.id.about_gaia_mobile)).setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            Internet("https://github.com/CroceRossaItaliana/gaia-android");
        }
    });
    //infomrazione dati
    ((TextView) v.findViewById(R.id.about_gaia_privacy))
            .setText(Html.fromHtml("<a href=\"\">Informazioni Gestione Dati</a>"));
    ((TextView) v.findViewById(R.id.about_gaia_privacy)).setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            Internet("https://gaia.cri.it/?p=public.privacy");
        }
    });

    //((WebView)v.findViewById(R.id.about_info))//.setClickable(true);;   
    return v;
}

From source file:com.jimsuplee.femaleastronauts.FemaleAstronautsActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    //photoMap.put("ACAZ C.2 2 seat fighter",R.drawable.belgium);
    //Shannon_Walker
    //Dorothy_Marie_Dottie_Metcalf_Lindenburger

    super.onCreate(savedInstanceState);
    Context ctx = getApplicationContext();
    setContentView(R.layout.activity_female_astronauts);
    Resources res = ctx.getResources();
    String[] options = res.getStringArray(R.array.astronauts);
    TypedArray icons = res.obtainTypedArray(R.array.astronaut_icons);
    setListAdapter(new ImageAndTextAdapter(ctx, R.layout.main_list_item, options, icons));
    ListView listView = getListView();
    listView.setTextFilterEnabled(true);
    listView.setOnItemClickListener(new OnItemClickListener() {
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            //Intent i = new Intent("");
            Intent iAstronaut = new Intent("com.jimsuplee.femaleastronauts.Astronaut");
            //NO/*from  ww w. j  av a 2 s .c o  m*/
            //Intent iAstronaut = new Intent("Astronaut");
            //NO:This item is not a TextView but is a LinearLayout
            //String astronautChoice = ((TextView) view).getText().toString();
            LinearLayout ll = (LinearLayout) view;
            TextView tv = (TextView) ll.findViewById(R.id.option_text);
            String astronautChoice = tv.getText().toString();
            iAstronaut.putExtra("astronautChoice", astronautChoice);
            //startActivityForResult(iAstronaut, 0);
            //Log.w(TAG, "In Astronaut, about to startActivity(iAstronaut)");
            startActivity(iAstronaut);
            //i.setData(Uri.parse(astronautChoice));
            //setResult(RESULT_OK, i);
            //finish();

        }
    });
}

From source file:org.wheelmap.android.fragment.FilterCategoriesFragment.java

private View createSectionTitle(LayoutInflater inflater, int textId) {
    LinearLayout layout = (LinearLayout) inflater.inflate(R.layout.item_list_sectiontitle, null);
    TextView title = (TextView) layout.findViewById(R.id.text);
    title.setText(getResources().getString(textId));
    return layout;
}

From source file:de.gebatzens.sia.fragment.FirstUseFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    LinearLayout layout = (LinearLayout) inflater.inflate(R.layout.fu_card, container, false);
    ImageView i = (ImageView) layout.findViewById(R.id.fu_image);
    TextView tvhead = (TextView) layout.findViewById(R.id.fu_header);
    TextView tvsub = (TextView) layout.findViewById(R.id.fu_text);

    switch (mPage) {
    case 0:// w  w w.  ja  v a 2 s  .c  o  m
        color = Color.parseColor("#1976D2");
        layout.setBackgroundColor(color);
        i.setImageResource(R.drawable.fu_device);
        tvhead.setText(R.string.fu_firstpage_title);
        tvsub.setText(R.string.fu_firstpage_content);
        break;
    case 1:
        color = Color.parseColor("#F4511E");
        layout.setBackgroundColor(color);
        i.setImageResource(R.drawable.fu_overview);
        tvhead.setText(R.string.fu_secondpage_title);
        tvsub.setText(R.string.fu_secondpage_content);
        break;
    case 2:
        color = Color.parseColor("#43A047");
        layout.setBackgroundColor(color);
        i.setImageResource(R.drawable.fu_filter);
        tvhead.setText(R.string.fu_thirdpage_title);
        tvsub.setText(R.string.fu_thirdpage_content);
        break;
    case 3:
        color = Color.parseColor("#d32f2f");
        layout.setBackgroundColor(color);
        i.setImageResource(R.drawable.fu_exam);
        tvhead.setText(R.string.fu_fifthpage_title);
        tvsub.setText(R.string.fu_fifthpage_content);
        break;
    case 4:
        color = Color.parseColor("#00ACC1");
        layout.setBackgroundColor(color);
        i.setImageResource(R.drawable.fu_more);
        tvhead.setText(R.string.fu_fourthpage_title);
        tvsub.setText(R.string.fu_fourthpage_content);
        break;
    case 5:
        color = Color.parseColor("#8BC34A");
        layout.setBackgroundColor(color);
        i.setImageResource(R.drawable.fu_finish);
        tvhead.setText(R.string.fu_sixth_title);
        tvsub.setText(R.string.fu_sixth_content);
        break;
    }

    return layout;
}

From source file:de.dmxcontrol.fragment.NetworkErrorDialogFragment.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    LinearLayout ll = (LinearLayout) LayoutInflater.from(getActivity()).inflate(R.layout.dialog_network_error,
            null);//from   w w  w .  java  2 s.  c  o  m
    mCheckBox = (CheckBox) ll.findViewById(R.id.offline_mode_enable);
    mCheckBox.setChecked(true);

    String msg = getArguments().getString(ARGUMENT_MESSAGE);

    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    builder.setTitle(getResources().getString(R.string.error_network_occurred)).setMessage(msg)
            .setCancelable(false).setPositiveButton(getResources().getString(android.R.string.ok), this);

    builder.setView(ll);
    return builder.create();
}

From source file:com.pepperonas.truthordare.fragments.FragmentTwoPlayer.java

@Override
public boolean onMenuItemClick(MenuItem item) {

    Player tmpPlayer;//from   ww  w .  j  a  v  a  2s  . c  o  m

    for (int i = 0; i < mLinearFrame.getChildCount(); i++) {

        if (mLinearFrame.getChildAt(i) instanceof Button)
            continue;

        LinearLayout playerLayout = (LinearLayout) mLinearFrame.getChildAt(i);

        EditText etName = (EditText) playerLayout.findViewById(R.id.et_name);
        EditText etJokers = (EditText) playerLayout.findViewById(R.id.et_jokers);
        RadioButton radioFemale = (RadioButton) playerLayout.findViewById(R.id.rb_female);

        if (ensureInput(etName, etJokers))
            return false;

        mMain.getPlayers()
                .add(tmpPlayer = new Player(mMain.getPlayers().size(), etName.getText().toString(),
                        Integer.parseInt(etJokers.getText().toString()),
                        radioFemale.isChecked() ? Gender.FEMALE : Gender.MALE));

        mMain.getDatabase().addPlayer(tmpPlayer.getId(), tmpPlayer.getName(), tmpPlayer.getGender(), true);
    }

    showPlayerLog();

    mMain.makeFragmentTransaction(FragmentSelectAction.newInstance(0));

    return true;
}