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:com.app.jdy.adapter.MyOrderAdapter.java

@Override
public View getView(int position, View convertView, ViewGroup parent) {

    if (convertView == null || convertView.getTag() == null) {
        // ?list_item
        convertView = listContainer.inflate(this.itemViewResource, null);
        TextView my_order_time = (TextView) convertView.findViewById(R.id.my_order_time);
        TextView my_order_name = (TextView) convertView.findViewById(R.id.my_order_name);
        TextView my_order_momey = (TextView) convertView.findViewById(R.id.my_order_momey);
        if (position % 2.0 == 0) {
            my_order_time.setBackgroundResource(R.drawable.item_color);
            my_order_name.setBackgroundResource(R.drawable.item_color);
            my_order_momey.setBackgroundResource(R.drawable.item_color);
        }//from w w w. j a v a  2s  . c o  m
        my_order_name.setText(list.get(position).getName());
        my_order_momey.setText("+" + list.get(position).getMoney());
        my_order_time.setText(changeTime(list.get(position).getTime()));
    }
    return convertView;
}

From source file:com.fabioarias.ui.Search.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.search, null);
    View scanView = (View) view.findViewById(R.id.p2);
    searchField = (EditText) view.findViewById(R.id.editText1);
    setTouchNClick(view.findViewById(R.id.p1));
    setTouchNClick(scanView);//w w  w  . j  a v  a  2  s  . c  om
    searchField.setOnEditorActionListener(new TextView.OnEditorActionListener() {
        @Override
        public boolean onEditorAction(TextView vv, int actionId, KeyEvent event) {
            if (actionId == EditorInfo.IME_ACTION_SEARCH) {
                // BUSQUEDA POR CRITERIA
                search(searchField.getText().toString());
                return true;
            }
            return false;
        }
    });

    this.v = view;
    if (scan != null) {
        search(scan);
    }
    return view;
}

From source file:kr.co.generic.wifianalyzer.wifi.ConnectionViewTest.java

@Test
public void testConnectionWithConnectionInformation() throws Exception {
    // setup//  www . j a  v  a  2  s . c  o m
    WiFiAdditional wiFiAdditional = withWiFiAdditional();
    WiFiDetail connection = withConnection(wiFiAdditional);
    withConnectionInformation(connection);
    withAccessPointDetailView(connection);
    // execute
    fixture.update(wiFiData);
    // validate
    WiFiConnection wiFiConnection = wiFiAdditional.getWiFiConnection();
    View view = mainActivity.findViewById(R.id.connection);
    assertEquals(wiFiConnection.getIpAddress(),
            ((TextView) view.findViewById(R.id.ipAddress)).getText().toString());
    TextView linkSpeedView = (TextView) view.findViewById(R.id.linkSpeed);
    assertEquals(View.VISIBLE, linkSpeedView.getVisibility());
    assertEquals(wiFiConnection.getLinkSpeed() + WifiInfo.LINK_SPEED_UNITS, linkSpeedView.getText().toString());
}

From source file:com.mercandalli.android.apps.files.user.ProfileFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    final FragmentActivity activity = getActivity();
    final View rootView = inflater.inflate(R.layout.fragment_profile, container, false);

    mProgressBar = (ProgressBar) rootView.findViewById(R.id.circularProgressBar);
    mProgressBar.setVisibility(View.VISIBLE);

    mIconBack = (ImageView) rootView.findViewById(R.id.icon_back);

    mRecyclerView = (RecyclerView) rootView.findViewById(R.id.my_recycler_view);
    mRecyclerView.setHasFixedSize(true);
    mLayoutManager = new LinearLayoutManager(activity);
    mRecyclerView.setLayoutManager(mLayoutManager);

    final Bitmap iconProfileOnline = Config.getUserProfilePicture(activity);
    if (iconProfileOnline != null) {
        mIconBack.setImageBitmap(ImageUtils.setBlur(ImageUtils.setBrightness(iconProfileOnline, -50), 15));
    }/* ww w  .  ja  v a 2s. c  o m*/

    this.mUsernameTextView = (TextView) rootView.findViewById(R.id.username);
    this.mUsernameTextView.setText(StringUtils.capitalize(Config.getUserUsername()));

    refreshView();

    return rootView;
}

From source file:com.example.administrator.myapplication2._4_Detail.LeftFragment.java

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

    Intent myIntent = getActivity().getIntent();
    if (myIntent != null) {
        seq = myIntent.getStringExtra("seq");
    }/*w w  w .  j  a v  a2 s.  c  o m*/

    tvHeart = (TextView) rootView.findViewById(R.id.tvHeart);
    tvDistance = (TextView) rootView.findViewById(R.id.tvDistance);
    tvCalorie = (TextView) rootView.findViewById(R.id.tvCalorie);
    tvWeight = (TextView) rootView.findViewById(R.id.tvWeight);
    ;
    tvRuntime = (TextView) rootView.findViewById(R.id.tvRuntime);

    SharedPreferences myPrefs = this.getActivity().getSharedPreferences("login", Context.MODE_PRIVATE);
    if ((myPrefs != null) && (myPrefs.contains("id"))) {
        id = myPrefs.getString("id", "");
        Log.i("logintest", id.toString());
    }

    getRecentData();

    return rootView;
}

From source file:com.smartx.bill.mepad.mestore.uimgloader.AbsListViewBaseActivity.java

protected void setDialog() {
    dialog = new ProgressDialog(this, R.style.welcome_dialog);
    dialog.setCancelable(false);/*from   www.  j  a va  2 s . com*/
    dialog.show();
    LayoutInflater inflater = LayoutInflater.from(this);
    View v = inflater.inflate(R.layout.wlecome_dialog, null);// view
    LinearLayout layout = (LinearLayout) v.findViewById(R.id.dialog_view);// 
    // main.xmlImageView
    ImageView spaceshipImage = (ImageView) v.findViewById(R.id.img);
    TextView tipTextView = (TextView) v.findViewById(R.id.tipTextView);// ??
    // 
    Animation hyperspaceJumpAnimation = AnimationUtils.loadAnimation(this, R.anim.loading_animation);
    // ImageView
    spaceshipImage.startAnimation(hyperspaceJumpAnimation);
    // tipTextView.setText(msg);// ?
    dialog.setContentView(layout);
}

From source file:app.hacked.ProjectDetailsFragment.java

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

    ((TextView) rootView.findViewById(R.id.Title)).setText(Name);
    ((TextView) rootView.findViewById(R.id.Title))
            .setTypeface(Typeface.create("sans-serif-light", Typeface.NORMAL));

    /*((TextView) rootView.findViewById(R.id.TeamMembers)).setText(TeamMembers);
    ((TextView) rootView.findViewById(R.id.TeamMembers)).setTypeface(Typeface.create("sans-serif-condensed", Typeface.NORMAL));*/

    ((TextView) rootView.findViewById(R.id.Tech)).setText(Technologies);
    ((TextView) rootView.findViewById(R.id.Tech))
            .setTypeface(Typeface.create("sans-serif-condensed", Typeface.NORMAL));

    ((TextView) rootView.findViewById(R.id.Description)).setText(Html.fromHtml(Description));
    ((TextView) rootView.findViewById(R.id.Description))
            .setTypeface(Typeface.create("sans-serif", Typeface.NORMAL));

    ((Button) rootView.findViewById(R.id.VoteUp)).setOnClickListener(new View.OnClickListener() {
        @Override/* w  w  w.  java2 s. co m*/
        public void onClick(View view) {
            doVote(true);
        }
    });

    ((Button) rootView.findViewById(R.id.VoteDown)).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            doVote(false);
        }
    });

    ((Button) rootView.findViewById(R.id.EditProject)).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            startActivity(new Intent(Intent.ACTION_VIEW,
                    Uri.parse("https://www.hackerleague.org/hackathons/hacked/hacks")));
        }
    });

    return rootView;
}

From source file:cn.edu.wyu.documentviewer.RecentsCreateFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    final Context context = inflater.getContext();

    final View view = inflater.inflate(R.layout.fragment_directory, container, false);

    mEmptyView = view.findViewById(android.R.id.empty);

    mListView = (ListView) view.findViewById(R.id.list);
    mListView.setOnItemClickListener(mItemListener);

    mAdapter = new DocumentStackAdapter();
    mListView.setAdapter(mAdapter);//from   ww w .jav  a 2s. c o m

    final RootsCache roots = DocumentsApplication.getRootsCache(context);
    final State state = ((DocumentsActivity) getActivity()).getDisplayState();

    mCallbacks = new LoaderCallbacks<List<DocumentStack>>() {
        @Override
        public Loader<List<DocumentStack>> onCreateLoader(int id, Bundle args) {
            return new RecentsCreateLoader(context, roots, state);
        }

        @Override
        public void onLoadFinished(Loader<List<DocumentStack>> loader, List<DocumentStack> data) {
            mAdapter.swapStacks(data);

            // When launched into empty recents, show drawer
            if (mAdapter.isEmpty() && !state.stackTouched) {
                ((DocumentsActivity) context).setRootsDrawerOpen(true);
            }
        }

        @Override
        public void onLoaderReset(Loader<List<DocumentStack>> loader) {
            mAdapter.swapStacks(null);
        }
    };

    return view;
}

From source file:com.github.rutvijkumar.twittfuse.fragments.ComposeDialog.java

private void setUpUI(View view) {
    // Populate UI elements with currentUser Object
    currentUserProfilePic = (ImageView) view.findViewById(R.id.currentUserProfilePic);
    username = (TextView) view.findViewById(R.id.username);
    userScreenName = (TextView) view.findViewById(R.id.userscreenname);
    remainingChars = (TextView) view.findViewById(R.id.remainingChars);
    tweetTextara = (EditText) view.findViewById(R.id.tweetTextara);
    tweetIt = (Button) view.findViewById(R.id.tweetIt);

    setActionsListeners();//from  w ww .  j av a2s  .co m
}

From source file:com.vrem.wifianalyzer.wifi.accesspoint.ConnectionViewTest.java

@Test
public void testConnectionWithConnectionInformation() throws Exception {
    // setup// ww  w.  j a  v  a  2 s.  c  o  m
    WiFiAdditional wiFiAdditional = withWiFiAdditional();
    WiFiDetail connection = withConnection(wiFiAdditional);
    when(settings.getConnectionViewType()).thenReturn(ConnectionViewType.COMPLETE);
    withConnectionInformation(connection);
    withAccessPointDetailView(connection, ConnectionViewType.COMPLETE.getAccessPointViewType());
    // execute
    fixture.update(wiFiData);
    // validate
    WiFiConnection wiFiConnection = wiFiAdditional.getWiFiConnection();
    View view = mainActivity.findViewById(R.id.connection);
    assertEquals(wiFiConnection.getIpAddress(),
            ((TextView) view.findViewById(R.id.ipAddress)).getText().toString());
    TextView linkSpeedView = (TextView) view.findViewById(R.id.linkSpeed);
    assertEquals(View.VISIBLE, linkSpeedView.getVisibility());
    assertEquals(wiFiConnection.getLinkSpeed() + WifiInfo.LINK_SPEED_UNITS, linkSpeedView.getText().toString());
}