Example usage for android.view View findViewById

List of usage examples for android.view View findViewById

Introduction

In this page you can find the example usage for android.view View 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:de.lebenshilfe_muenster.uk_gebaerden_muensterland.sign_trainer.AbstractSignTrainerFragment.java

protected void initializeVideoViews(View view) {
    this.videoView = (VideoView) view.findViewById(R.id.signTrainerVideoView);
    this.videoView.setContentDescription(getActivity().getString(R.string.videoIsLoading));
    this.progressBar = (ProgressBar) view.findViewById(R.id.signTrainerVideoLoadingProgressBar);
}

From source file:fr.julienvermet.bugdroid.ui.BugCommentsFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_bug_comments, null);
    mCommentAdd = (ViewGroup) view.findViewById(R.id.commentAdd);
    mCommentMessage = (EditText) view.findViewById(R.id.commentMessage);
    mCommentSend = (ImageButton) view.findViewById(R.id.commentSend);
    mCommentSendProgress = (ProgressBar) view.findViewById(R.id.commentSendProgress);
    mCommentSend.setOnClickListener(this);
    return view;/*  w  w w.jav a 2s . c  o m*/
}

From source file:io.v.syncslides.DeckChooserFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_deck_chooser, container, false);
    FloatingActionButton fab = (FloatingActionButton) rootView.findViewById(R.id.new_deck_fab);
    fab.setOnClickListener(v -> onImportDeck());
    mRecyclerView = (RecyclerView) rootView.findViewById(R.id.deck_grid);
    // The cards for the decks are always the same size.
    mRecyclerView.setHasFixedSize(true);

    // Statically set the span count (i.e. number of columns) for now...  See below.
    mLayoutManager = new GridLayoutManager(getContext(), 2);
    mRecyclerView.setLayoutManager(mLayoutManager);
    // Dynamically set the span based on the screen width.  Cribbed from
    // http://stackoverflow.com/questions/26666143/recyclerview-gridlayoutmanager-how-to-auto-detect-span-count
    mRecyclerView.getViewTreeObserver()/*from   w  w w.ja va  2 s  . c o m*/
            .addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
                @Override
                public void onGlobalLayout() {
                    mRecyclerView.getViewTreeObserver().removeOnGlobalLayoutListener(this);
                    int viewWidth = mRecyclerView.getMeasuredWidth();
                    float cardViewWidth = getActivity().getResources().getDimension(R.dimen.deck_card_width);
                    int newSpanCount = (int) Math.floor(viewWidth / cardViewWidth);
                    mLayoutManager.setSpanCount(newSpanCount);
                    mLayoutManager.requestLayout();
                }
            });
    mAdapter = new DeckListAdapter(DB.Singleton.get(),
            new RpcPresentationDiscovery(V23.Singleton.get().getVContext()));

    return rootView;
}

From source file:am.roadpolice.roadpolice.DecisionDialogFragment.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    View decisionView = getActivity().getLayoutInflater().inflate(R.layout.dialog_watcher, null);
    // Get Web View and Progress Bar.
    mWebView = (WebView) decisionView.findViewById(R.id.webView);
    mProgressBar = (ProgressBar) decisionView.findViewById(R.id.progressBar);

    Bundle bundle = getArguments();/*from w w w  .j  a  v a  2  s. c  o  m*/
    final DecisionDownloader d = new DecisionDownloader(bundle.getString(ActionDialogFragment.EXTRA_PIN, ""));
    d.execute();

    return new AlertDialog.Builder(getActivity())
            .setNeutralButton(R.string.txtClose, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    d.cancel(true);
                }
            }).setView(decisionView).create();
}

From source file:com.ateam.alleneatonautorentals.ServiceViewCars.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.view_inventory);

    carsList = new ArrayList<HashMap<String, String>>();

    new LoadAllCars().execute();

    SessionManager session = new SessionManager(getApplicationContext());
    String role = session.getRole();

    if (role.equals("Service") || role.equals("Manager")) {
        ListView lv = getListView();

        lv.setOnItemClickListener(new OnItemClickListener() {

            @Override/*from  w w w  .j  a  v  a  2s .  co m*/
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                String model = ((TextView) view.findViewById(R.id.car_model_list)).getText().toString();
                String make = ((TextView) view.findViewById(R.id.car_make_list)).getText().toString();
                String carid = ((TextView) view.findViewById(R.id.car_id_list)).getText().toString();
                Intent ii = new Intent(getApplicationContext(), ServiceCarMenu.class);

                ii.putExtra(TAG_MODEL, model);
                ii.putExtra(TAG_MAKE, make);
                ii.putExtra(TAG_ID, carid);
                ii.putExtra("key", "");

                startActivity(ii);
                finish();
            }

        });
    }
}

From source file:net.idlesoft.android.apps.github.adapters.SearchUsersListAdapter.java

@Override
public View doGetView(final int index, View convertView, final ViewGroup parent) {
    ViewHolder holder;/*w  w w.j a va 2  s .co  m*/
    if (convertView == null) {
        convertView = mInflater.inflate(R.layout.user_list_item, null);
        holder = new ViewHolder();
        holder.text = (TextView) convertView.findViewById(R.id.tv_user_list_item_name);
        holder.gravatar = (ImageView) convertView.findViewById(R.id.iv_user_list_gravatar);
        convertView.setTag(holder);
    } else {
        holder = (ViewHolder) convertView.getTag();
    }
    holder.text.setTextColor(R.color.textColor);
    try {
        final String username = ((JSONObject) getData().get(index)).getString("username");
        holder.text.setText(username);
        holder.gravatar.setImageBitmap(mGravatars.get(username));
    } catch (final JSONException e) {
        e.printStackTrace();
    }
    return convertView;
}

From source file:com.orange.ocara.ui.activity.EditCommentActivity.java

@Override
void setUpToolbar() {
    super.setUpToolbar();

    final View responseButtonBar = LayoutInflater.from(this)
            .inflate(com.orange.ocara.R.layout.audit_object_toolbar, null);
    responseButtonBar.findViewById(com.orange.ocara.R.id.response_ok_button).setVisibility(View.GONE);

    responseButtonBar.findViewById(com.orange.ocara.R.id.response_nok_button).setVisibility(View.GONE);

    Toolbar.LayoutParams lp = new Toolbar.LayoutParams(Gravity.LEFT);
    responseButtonBar.setLayoutParams(lp);

    toolbar.addView(responseButtonBar);/*from w  w w .j  a  v a  2  s  .c  o  m*/
}

From source file:in.codehex.facilis.ViewBidItemsFragment.java

/**
 * Initialize the objects.//from w w  w.j a  va  2 s. c om
 *
 * @param view the root view of the layout.
 */
private void initObjects(View view) {
    mRefreshLayout = (SwipeRefreshLayout) view.findViewById(R.id.refresh);
    mRecyclerView = (RecyclerView) view.findViewById(R.id.view_bid_list);

    mViewBidItemList = new ArrayList<>();
    mLayoutManager = new LinearLayoutManager(getContext());
    mAdapter = new ViewBidItemsAdapter(getContext(), mViewBidItemList);
    userPreferences = getActivity().getSharedPreferences(Config.PREF_USER, Context.MODE_PRIVATE);
}

From source file:com.ateam.alleneatonautorentals.SalesSearchUser.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.view_users);

    Intent getIntent = getIntent();/*from  ww w . j a  v  a 2 s.c om*/
    keyword = getIntent.getStringExtra("key");
    Log.d("Key Searched: ", keyword);
    usersList = new ArrayList<HashMap<String, String>>();

    new LoadFoundUsers().execute();

    SessionManager session = new SessionManager(getApplicationContext());
    String role = session.getRole();

    if (role.equals("Sales") || role.equals("Manager")) {
        ListView lv = getListView();

        lv.setOnItemClickListener(new OnItemClickListener() {

            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                String email = (((TextView) view.findViewById(R.id.user_email_list)).getText().toString())
                        .substring(7);
                String name = ((TextView) view.findViewById(R.id.user_name_list)).getText().toString();
                Intent ii = new Intent(getApplicationContext(), SalesUserMenu.class);
                ii.putExtra(TAG_EMAIL, email);
                ii.putExtra("key", keyword);
                ii.putExtra(TAG_NAME, name);
                startActivity(ii);
                finish();
            }

        });
    }

}

From source file:com.example.run_tracker.MyRunsFragment.java

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

    Log.v(TAG, "onCreateView");

    View rootView = inflater.inflate(R.layout.myrunfragment, container, false);

    listView = (ListView) rootView.findViewById(R.id.list);
    mRefresh = (Button) rootView.findViewById(R.id.refresh);
    listView.setOnItemClickListener(this);
    mMapFragment = CustomMapFragment.newInstance();
    getChildFragmentManager().beginTransaction().replace(R.id.map_container, mMapFragment).commit();
    mRefresh.setOnClickListener(this);
    return rootView;

}