List of usage examples for android.view View findViewById
@Nullable public final <T extends View> T findViewById(@IdRes int id)
From source file:com.example.cuisoap.agrimac.machineRegister.driverInfoFragment.java
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_driverinfo, container, false); drive_type1 = (RadioButton) view.findViewById(R.id.machine_drivetype_1); drive_type2 = (RadioButton) view.findViewById(R.id.machine_drivetype_2); driver_male = (RadioButton) view.findViewById(R.id.driver_male); driver_female = (RadioButton) view.findViewById(R.id.driver_female); driver_info = (LinearLayout) view.findViewById(R.id.machine_driverinfo); driver_name = (EditText) view.findViewById(R.id.driver_name); driver_age = (EditText) view.findViewById(R.id.driver_age); license = (Button) view.findViewById(R.id.driver_licence_button); license_pic = (ImageView) view.findViewById(R.id.driver_licence_pic); license_type = (TextView) view.findViewById(R.id.licence_type); drive_type = (RadioGroup) view.findViewById(R.id.drive_type); driver_gender = (RadioGroup) view.findViewById(R.id.driver_gender); confrim = (Button) view.findViewById(R.id.driver_confirm); drive_type2.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override/*from w ww . j av a 2 s . c o m*/ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if (isChecked) driver_info.setVisibility(View.GONE); else driver_info.setVisibility(View.VISIBLE); } }); license.setOnClickListener(myOnClickListener); license_type.setOnClickListener(myOnClickListener); confrim.setOnClickListener(myOnClickListener); return view; }
From source file:fr.music.overallbrothers.activity.ArtistActivity.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View view = inflater.inflate(R.layout.artist, container, false); mAlbumGridView = (GridView) view.findViewById(R.id.AlbumGridView); mArtist = (Artist) this.getArguments().getSerializable("artiste"); mAlbumGridAdapter = new AlbumGridAdapter(this.getActivity()); loadAlbums();/* w w w.ja va2 s . c om*/ mAlbumGridView.setOnItemClickListener(mOnItemClickListener); mAlbumGridView.setOnItemLongClickListener(mOnItemLongClickListener); mDonateButton = (Button) view.findViewById(R.id.DonateButton); mDonateButton.setOnClickListener(mDonateClick); mWebpageButton = (Button) view.findViewById(R.id.WebpageButton); mWebpageButton.setOnClickListener(mWebpageClick); Toast.makeText(ArtistActivity.this.getActivity(), R.string.long_press_playlist, Toast.LENGTH_SHORT).show(); mGestureOverlayView = (GestureOverlayView) view.findViewById(R.id.gestures); mGestureOverlayView .addOnGesturePerformedListener(JamendoApplication.getInstance().getPlayerGestureHandler()); return view; }
From source file:gov.in.bloomington.georeporter.adapters.ServersAdapter.java
@Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder;//from w w w . j ava 2s . c om if (convertView == null) { convertView = mInflater.inflate(R.layout.list_item_servers, null); holder = new ViewHolder(); holder.name = (TextView) convertView.findViewById(android.R.id.text1); holder.url = (TextView) convertView.findViewById(android.R.id.text2); holder.radio = (RadioButton) convertView.findViewById(R.id.radio); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } String name = mServers.optJSONObject(position).optString("name"); String url = mServers.optJSONObject(position).optString("url"); if (name.equals(mCurrentServerName)) { holder.radio.setChecked(true); } else { holder.radio.setChecked(false); } holder.name.setText(name); holder.url.setText(url); return convertView; }
From source file:at.bitfire.davdroid.ui.setup.LoginCredentialsFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.login_credentials_fragment, container, false); radioUseEmail = (RadioButton) v.findViewById(R.id.login_type_email); emailDetails = (LinearLayout) v.findViewById(R.id.login_type_email_details); editEmailAddress = (EditText) v.findViewById(R.id.email_address); editEmailPassword = (EditPassword) v.findViewById(R.id.email_password); radioUseURL = (RadioButton) v.findViewById(R.id.login_type_url); urlDetails = (LinearLayout) v.findViewById(R.id.login_type_url_details); editBaseURL = (EditText) v.findViewById(R.id.base_url); editUserName = (EditText) v.findViewById(R.id.user_name); editUrlPassword = (EditPassword) v.findViewById(R.id.url_password); radioUseEmail.setOnCheckedChangeListener(this); radioUseURL.setOnCheckedChangeListener(this); if (savedInstanceState == null) { // first call Activity activity = getActivity(); Intent intent = (activity != null) ? activity.getIntent() : null; if (intent != null) { // we've got initial login data String url = intent.getStringExtra(LoginActivity.EXTRA_URL), username = intent.getStringExtra(LoginActivity.EXTRA_USERNAME), password = intent.getStringExtra(LoginActivity.EXTRA_PASSWORD); if (url != null) { radioUseURL.setChecked(true); editBaseURL.setText(url); editUserName.setText(username); editUrlPassword.setText(password); } else { radioUseEmail.setChecked(true); editEmailAddress.setText(username); editEmailPassword.setText(password); }/*from w w w .j a v a2 s .com*/ } else radioUseEmail.setChecked(true); } final Button login = (Button) v.findViewById(R.id.login); login.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { LoginCredentials credentials = validateLoginData(); if (credentials != null) DetectConfigurationFragment.newInstance(credentials).show(getFragmentManager(), null); } }); return v; }
From source file:com.aqnote.app.wifianalyzer.wifi.ConnectionViewTest.java
@Test public void testConnectionVisibleWithConnectionInformation() throws Exception { // setup//w ww. j a v a2 s . com WiFiAdditional wiFiAdditional = new WiFiAdditional(StringUtils.EMPTY, "IPADDRESS", 11); WiFiDetail connection = withConnection(wiFiAdditional); when(wiFiData.getConnection()).thenReturn(connection); when(wiFiData.getWiFiDetails(settings.getWiFiBand(), settings.getSortBy())) .thenReturn(new ArrayList<WiFiDetail>()); // execute fixture.update(wiFiData); // validate View view = mainActivity.findViewById(R.id.connection); assertEquals(View.VISIBLE, view.getVisibility()); TextView ipAddressView = (TextView) view.findViewById(R.id.ipAddress); assertEquals(View.VISIBLE, ipAddressView.getVisibility()); assertEquals(wiFiAdditional.getIPAddress(), ipAddressView.getText().toString()); TextView linkSpeedView = (TextView) view.findViewById(R.id.linkSpeed); assertEquals(View.VISIBLE, linkSpeedView.getVisibility()); assertEquals(wiFiAdditional.getLinkSpeed() + WifiInfo.LINK_SPEED_UNITS, linkSpeedView.getText().toString()); verify(wiFiData).getConnection(); verify(accessPointsDetail).setView(mainActivity.getResources(), view, connection, false); }
From source file:com.dvdprime.mobile.android.ui.MainActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main_menu, menu); View count = menu.findItem(R.id.menu_badge).getActionView(); badgeCount = (Button) count.findViewById(R.id.badge_count); badgeCount.setText(String.valueOf(0)); badgeCount.setOnClickListener(new OnClickListener() { @Override/*from w w w. ja v a2 s . c o m*/ public void onClick(View v) { startActivity(new Intent(MainActivity.this, NotificationListActivity.class)); } }); return true; }
From source file:com.microsoft.onedrive.apiexplorer.DeltaFragment.java
@Override public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) { final View view = inflater.inflate(R.layout.fragment_json_view, container, false); ((TextView) view.findViewById(R.id.json)).setMovementMethod(new ScrollingMovementMethod()); getActivity().setTitle(getString(R.string.delta_title, mItemName)); refresh();//from w w w. ja va 2s .c o m return view; }
From source file:com.vrem.wifianalyzer.wifi.accesspoint.ConnectionViewTest.java
@Test public void testConnectionWithInvalidLinkSpeed() throws Exception { // setup// w ww . ja v a 2 s .c om WiFiConnection wiFiConnection = new WiFiConnection(SSID, BSSID, IP_ADDRESS, WiFiConnection.LINK_SPEED_INVALID); WiFiDetail connection = withConnection(new WiFiAdditional(StringUtils.EMPTY, wiFiConnection)); when(settings.getConnectionViewType()).thenReturn(ConnectionViewType.COMPLETE); withConnectionInformation(connection); withAccessPointDetailView(connection, ConnectionViewType.COMPLETE.getAccessPointViewType()); // execute fixture.update(wiFiData); // validate View view = mainActivity.findViewById(R.id.connection); TextView linkSpeedView = (TextView) view.findViewById(R.id.linkSpeed); assertEquals(View.GONE, linkSpeedView.getVisibility()); }
From source file:com.vrem.wifianalyzer.wifi.ChannelAvailableAdapter.java
@Override public View getView(int position, View convertView, ViewGroup parent) { View view = convertView; if (view == null) { view = MainContext.INSTANCE.getLayoutInflater().inflate(R.layout.channel_available_details, parent, false);/*from w w w . j av a 2 s . com*/ } WiFiChannelCountry wiFiChannelCountry = getItem(position); ((TextView) view.findViewById(R.id.channel_available_country)) .setText(wiFiChannelCountry.getCountryCode() + " - " + wiFiChannelCountry.getCountryName()); ((TextView) view.findViewById(R.id.channel_available_title_ghz_2)).setText(WiFiBand.GHZ2.getBand() + " : "); ((TextView) view.findViewById(R.id.channel_available_ghz_2)) .setText(StringUtils.join(wiFiChannelCountry.getChannelsGHZ2().toArray(), ",")); ((TextView) view.findViewById(R.id.channel_available_title_ghz_5)).setText(WiFiBand.GHZ5.getBand() + " : "); ((TextView) view.findViewById(R.id.channel_available_ghz_5)) .setText(StringUtils.join(wiFiChannelCountry.getChannelsGHZ5().toArray(), ",")); return view; }
From source file:com.ateam.alleneatonautorentals.ServiceSearchCar.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.view_inventory); Intent getIntent = getIntent();/*from w w w .ja v a2 s.com*/ keyword = getIntent.getStringExtra("key"); Log.d("Key Searched: ", keyword); carsList = new ArrayList<HashMap<String, String>>(); new LoadFoundCars().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 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", keyword); startActivity(ii); finish(); } }); } }