List of usage examples for android.widget ArrayAdapter createFromResource
public static @NonNull ArrayAdapter<CharSequence> createFromResource(@NonNull Context context, @ArrayRes int textArrayResId, @LayoutRes int textViewResId)
From source file:com.towson.wavyleaf.Sighting.java
protected void init() { getWindow().setBackgroundDrawable(null); Typeface tf_light = Typeface.createFromAsset(getAssets(), "fonts/roboto_light.ttf"); Typeface tf_bold = Typeface.createFromAsset(getAssets(), "fonts/roboto_bold.ttf"); tvlat = (TextView) findViewById(R.id.tv_latitude); tvlong = (TextView) findViewById(R.id.tv_longitude); tvpicnotes = (TextView) findViewById(R.id.tv_picturenotes); tvper = (TextView) findViewById(R.id.tv_percentageseen); tvper_summary = (TextView) findViewById(R.id.tv_percentageseen_summary); tvcoor = (TextView) findViewById(R.id.tv_coordinates); tvarea = (TextView) findViewById(R.id.tv_areainfested); tvarea_summary = (TextView) findViewById(R.id.tv_areainfested_summary); tv_treatment = (TextView) findViewById(R.id.tv_treatment); notes = (EditText) findViewById(R.id.notes); etarea = (EditText) findViewById(R.id.et_areainfested); b1 = (ToggleButton) findViewById(R.id.bu_1); b2 = (ToggleButton) findViewById(R.id.bu_2); b3 = (ToggleButton) findViewById(R.id.bu_3); b4 = (ToggleButton) findViewById(R.id.bu_4); b5 = (ToggleButton) findViewById(R.id.bu_5); b6 = (ToggleButton) findViewById(R.id.bu_6); cb = (CheckBox) findViewById(R.id.cb_confirm); rg = (RadioGroup) findViewById(R.id.toggleGroup); sp = (Spinner) findViewById(R.id.sp_areainfested); sp_treatment = (Spinner) findViewById(R.id.sp_treatment); mLocationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); locationData = (LocationApplication) getApplication(); currentEditableLocation = locationData.getLocation(); updateLocationTimer = new Timer(); TimerTask updateLocationTask = new TimerTask() { @Override//w w w . ja va 2 s . co m public void run() { checkLocation(); } }; updateLocationTimer.scheduleAtFixedRate(updateLocationTask, 0, FIVE_SECONDS); // Listener for EditText in Area Infested etarea.addTextChangedListener(new TextWatcher() { public void onTextChanged(CharSequence s, int start, int before, int count) { if (etarea.getText().length() == 0) { tvarea_summary.setText(""); } else if (etarea.getText().toString().contains("-")) { // Negative number etarea.getEditableText().clear(); Toast.makeText(getApplicationContext(), "Negative values not allowed", Toast.LENGTH_SHORT) .show(); } else { tvarea_summary.setText(etarea.getText() + " " + sp.getSelectedItem().toString()); } } public void afterTextChanged(Editable s) { } public void beforeTextChanged(CharSequence s, int start, int count, int after) { } }); // Listener for spinner in Area Infested sp.setOnItemSelectedListener(new OnItemSelectedListener() { @Override public void onNothingSelected(AdapterView<?> arg0) { } @Override public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2, long arg3) { if (etarea.getText().length() != 0) tvarea_summary.setText(etarea.getText() + " " + sp.getSelectedItem()); } }); // Adapter for area infested spinner ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.areainfested_array, android.R.layout.simple_spinner_item); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); sp.setAdapter(adapter); // Adapter for Treatment spinner ArrayAdapter<CharSequence> adapter2 = ArrayAdapter.createFromResource(this, R.array.treatment_array, android.R.layout.simple_spinner_item); adapter2.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); sp_treatment.setAdapter(adapter2); // Just to be safe cb.setChecked(false); // Set all the beautiful typefaces tvlat.setTypeface(tf_light); tvlong.setTypeface(tf_light); tvcoor.setTypeface(tf_bold); tvarea.setTypeface(tf_bold); tvarea_summary.setTypeface(tf_bold); tvper.setTypeface(tf_bold); tvper_summary.setTypeface(tf_bold); tvpicnotes.setTypeface(tf_bold); tv_treatment.setTypeface(tf_bold); cb.setTypeface(tf_light); b1.setTypeface(tf_light); b2.setTypeface(tf_light); b3.setTypeface(tf_light); b4.setTypeface(tf_light); b5.setTypeface(tf_light); b6.setTypeface(tf_light); if (!locationData.isSearching()) findUsersLocation(); ib = (ImageButton) findViewById(R.id.imagebutton_sighting); // Listener for camera button ib.setOnClickListener(new OnClickListener() { public void onClick(View v) { takePicture(); } }); ib_percent = (ImageButton) findViewById(R.id.ib_percent); // Listener for help button in Percentage Infested category ib_percent.setOnClickListener(new OnClickListener() { public void onClick(View v) { showDialog(HELP_PERCENT); } }); ib_treatment = (ImageButton) findViewById(R.id.ib_treatment); // Listener for help button in Treatment catgeory ib_treatment.setOnClickListener(new OnClickListener() { public void onClick(View v) { showDialog(HELP_TREATMENT); // Toast.makeText(getApplicationContext(), "Specify the type of treatment that was done to this area", Toast.LENGTH_LONG).show(); } }); }
From source file:com.google.android.apps.flexbox.FlexItemEditFragment.java
@Nullable @Override//w ww.java 2 s . c o m public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { final View view = inflater.inflate(R.layout.fragment_flex_item_edit, container, false); getDialog().setTitle(String.valueOf(mFlexItem.index + 1)); final TextInputLayout orderTextInput = (TextInputLayout) view.findViewById(R.id.input_layout_order); EditText orderEdit = (EditText) view.findViewById(R.id.edit_text_order); orderEdit.setText(String.valueOf(mFlexItem.order)); orderEdit.addTextChangedListener( new FlexEditTextWatcher(orderTextInput, new IntegerInputValidator(), R.string.must_be_integer)); final TextInputLayout flexGrowInput = (TextInputLayout) view.findViewById(R.id.input_layout_flex_grow); final EditText flexGrowEdit = (EditText) view.findViewById(R.id.edit_text_flex_grow); flexGrowEdit.setText(String.valueOf(mFlexItem.flexGrow)); flexGrowEdit.addTextChangedListener(new FlexEditTextWatcher(flexGrowInput, new NonNegativeDecimalInputValidator(), R.string.must_be_non_negative_float)); final TextInputLayout flexShrinkInput = (TextInputLayout) view.findViewById(R.id.input_layout_flex_shrink); EditText flexShrinkEdit = (EditText) view.findViewById(R.id.edit_text_flex_shrink); flexShrinkEdit.setText(String.valueOf(mFlexItem.flexShrink)); flexShrinkEdit.addTextChangedListener(new FlexEditTextWatcher(flexShrinkInput, new NonNegativeDecimalInputValidator(), R.string.must_be_non_negative_float)); final TextInputLayout flexBasisPercentInput = (TextInputLayout) view .findViewById(R.id.input_layout_flex_basis_percent); EditText flexBasisPercentEdit = (EditText) view.findViewById(R.id.edit_text_flex_basis_percent); if (mFlexItem.flexBasisPercent != FlexboxLayout.LayoutParams.FLEX_BASIS_PERCENT_DEFAULT) { flexBasisPercentEdit.setText(String.valueOf(Math.round(mFlexItem.flexBasisPercent * 100))); } else { flexBasisPercentEdit.setText(String.valueOf((int) mFlexItem.flexBasisPercent)); } flexBasisPercentEdit.addTextChangedListener(new FlexEditTextWatcher(flexBasisPercentInput, new FlexBasisPercentInputValidator(), R.string.must_be_minus_one_or_non_negative_integer)); final TextInputLayout widthInput = (TextInputLayout) view.findViewById(R.id.input_layout_width); EditText widthEdit = (EditText) view.findViewById(R.id.edit_text_width); widthEdit.setText(String.valueOf(mFlexItem.width)); widthEdit.addTextChangedListener(new FlexEditTextWatcher(widthInput, new DimensionInputValidator(), R.string.must_be_minus_one_or_minus_two_or_non_negative_integer)); final TextInputLayout heightInput = (TextInputLayout) view.findViewById(R.id.input_layout_height); EditText heightEdit = (EditText) view.findViewById(R.id.edit_text_height); heightEdit.setText(String.valueOf(mFlexItem.height)); heightEdit.addTextChangedListener(new FlexEditTextWatcher(heightInput, new DimensionInputValidator(), R.string.must_be_minus_one_or_minus_two_or_non_negative_integer)); final TextInputLayout minWidthInput = (TextInputLayout) view.findViewById(R.id.input_layout_min_width); EditText minWidthEdit = (EditText) view.findViewById(R.id.edit_text_min_width); minWidthEdit.setText(String.valueOf(mFlexItem.minWidth)); minWidthEdit.addTextChangedListener(new FlexEditTextWatcher(minWidthInput, new FixedDimensionInputValidator(), R.string.must_be_non_negative_integer)); final TextInputLayout minHeightInput = (TextInputLayout) view.findViewById(R.id.input_layout_min_height); EditText minHeightEdit = (EditText) view.findViewById(R.id.edit_text_min_height); minHeightEdit.setText(String.valueOf(mFlexItem.minHeight)); minHeightEdit.addTextChangedListener(new FlexEditTextWatcher(minHeightInput, new FixedDimensionInputValidator(), R.string.must_be_non_negative_integer)); final TextInputLayout maxWidthInput = (TextInputLayout) view.findViewById(R.id.input_layout_max_width); EditText maxWidthEdit = (EditText) view.findViewById(R.id.edit_text_max_width); maxWidthEdit.setText(String.valueOf(mFlexItem.maxWidth)); maxWidthEdit.addTextChangedListener(new FlexEditTextWatcher(maxWidthInput, new FixedDimensionInputValidator(), R.string.must_be_non_negative_integer)); final TextInputLayout maxHeightInput = (TextInputLayout) view.findViewById(R.id.input_layout_max_height); EditText maxHeightEdit = (EditText) view.findViewById(R.id.edit_text_max_height); maxHeightEdit.setText(String.valueOf(mFlexItem.maxHeight)); maxHeightEdit.addTextChangedListener(new FlexEditTextWatcher(maxHeightInput, new FixedDimensionInputValidator(), R.string.must_be_non_negative_integer)); setNextFocusesOnEnterDown(orderEdit, flexGrowEdit, flexShrinkEdit, flexBasisPercentEdit, widthEdit, heightEdit, minWidthEdit, minHeightEdit, maxWidthEdit, maxHeightEdit); Spinner alignSelfSpinner = (Spinner) view.findViewById(R.id.spinner_align_self); ArrayAdapter<CharSequence> arrayAdapter = ArrayAdapter.createFromResource(getActivity(), R.array.array_align_self, R.layout.spinner_item); alignSelfSpinner.setAdapter(arrayAdapter); alignSelfSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { String selected = parent.getItemAtPosition(position).toString(); if (selected.equals(ALIGN_SELF_AUTO)) { mFlexItem.alignSelf = FlexboxLayout.LayoutParams.ALIGN_SELF_AUTO; } else if (selected.equals(ALIGN_SELF_FLEX_START)) { mFlexItem.alignSelf = FlexboxLayout.LayoutParams.ALIGN_SELF_FLEX_START; } else if (selected.equals(ALIGN_SELF_FLEX_END)) { mFlexItem.alignSelf = FlexboxLayout.LayoutParams.ALIGN_SELF_FLEX_END; } else if (selected.equals(ALIGN_SELF_CENTER)) { mFlexItem.alignSelf = FlexboxLayout.LayoutParams.ALIGN_SELF_CENTER; } else if (selected.equals(ALIGN_SELF_BASELINE)) { mFlexItem.alignSelf = FlexboxLayout.LayoutParams.ALIGN_SELF_BASELINE; } else if (selected.equals(ALIGN_SELF_STRETCH)) { mFlexItem.alignSelf = FlexboxLayout.LayoutParams.ALIGN_SELF_STRETCH; } } @Override public void onNothingSelected(AdapterView<?> parent) { // No op } }); CheckBox wrapBeforeCheckBox = (CheckBox) view.findViewById(R.id.checkbox_wrap_before); wrapBeforeCheckBox.setChecked(mFlexItem.wrapBefore); wrapBeforeCheckBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { mFlexItem.wrapBefore = isChecked; } }); int alignSelfPosition = arrayAdapter.getPosition(alignSelfAsString(mFlexItem.alignSelf)); alignSelfSpinner.setSelection(alignSelfPosition); view.findViewById(R.id.button_cancel).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dismiss(); } }); final Button okButton = (Button) view.findViewById(R.id.button_ok); okButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (orderTextInput.isErrorEnabled() || flexGrowInput.isErrorEnabled() || flexBasisPercentInput.isErrorEnabled() || widthInput.isErrorEnabled() || heightInput.isErrorEnabled() || minWidthInput.isErrorEnabled() || minHeightInput.isErrorEnabled() || maxWidthInput.isErrorEnabled() || maxHeightInput.isErrorEnabled()) { Toast.makeText(getActivity(), R.string.invalid_values_exist, Toast.LENGTH_SHORT).show(); return; } if (mFlexItemChangedListener != null) { mFlexItemChangedListener.onFlexItemChanged(mFlexItem); } dismiss(); } }); return view; }
From source file:demo.camera.library.ui.CameraCaptureActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); setContentView(R.layout.activity_camera_capture); CameraUtils.clearSessionConfig();/* w ww. j ava 2 s .co m*/ CameraUtils.clearSessionFolders(this, true, true); Spinner spinner = (Spinner) findViewById(R.id.filterSpinner); ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.cameraFilterNames, android.R.layout.simple_spinner_item); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); // Apply the adapter to the spinner. spinner.setAdapter(adapter); spinner.setOnItemSelectedListener(this); // Define a handler that receives camera-control messages from other threads. All calls // to Camera must be made on the same thread. Note we create this before the renderer // thread, so we know the fully-constructed object will be visible. mSessionConfig = CameraUtils.getSessionConfig(this); CameraUtils.clearSessionConfig(); mCameraHandler = new CameraHandler(this); mVideoEncoder = new TextureMovieEncoder(); mRecordingEnabled = mVideoEncoder.isRecording(); try { mMicEncoder = new MicrophoneEncoder(mSessionConfig); } catch (IOException e) { e.printStackTrace(); } // Configure the GLSurfaceView. This will start the Renderer thread, with an // appropriate EGL context. mGLView = (GLSurfaceView) findViewById(R.id.cameraPreview_surfaceView); mGLView.setEGLContextClientVersion(2); // select GLES 2.0 mRenderer = new CameraSurfaceRenderer(mCameraHandler, mSessionConfig, mVideoEncoder); mGLView.setRenderer(mRenderer); mGLView.setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY); mCameraManager = new AppCameraManager(this, mSessionConfig); setUpUi(); Log.d(TAG, "onCreate complete: " + this); }
From source file:com.example.android.gcncouponalert.app.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); //Spinner spinner = (Spinner) findViewById(R.id.coupons_spinner); MenuItem item = menu.findItem(R.id.coupons_spinner); Spinner spinner = (Spinner) item.getActionView(); ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.coupon_filter_options, android.R.layout.simple_spinner_item); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner.setAdapter(adapter);//from w ww . j av a 2 s. co m spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { Log.d(LOG_TAG, " onItemSelected: " + position + "; " + id); CouponsFragment ff = (CouponsFragment) getSupportFragmentManager() .findFragmentById(R.id.fragment_forecast); if (null != ff) { ff.onSpinnerChanged(position); } } @Override public void onNothingSelected(AdapterView<?> parent) { // sometimes you need nothing here } }); //MenuItem item = menu.findItem(R.id.coupons_spinner); //Spinner spinner =(Spinner) item.getActionView(); //setupSpinner(spinner); //String[] items={"All","Favorites"}; //wrap the items in the Adapter //ArrayAdapter<String> adapter=new ArrayAdapter<String>(this,android.R.layout.simple_spinner_item,items); //assign adapter to the Spinner //spinner.setAdapter(adapter); //MenuItem item = menu.findItem(R.id.coupons_spinner); //Spinner spinner = (Spinner) MenuItemCompat.getActionView(item); //spinner.setAdapter(adapter); // set the adapter to provide layout of rows and content //s.setOnItemSelectedListener(onItemSelectedListener); // set the listener, to perform actions based on item selection return true; }
From source file:com.carver.paul.truesight.Ui.CounterPicker.CounterPickerFragment.java
private void setupRolesSpinner(LayoutInflater inflater, View inflateView) { Spinner spinner = (Spinner) inflateView.findViewById(R.id.spinner_counter_picker); // Create an ArrayAdapter using the string array and a default spinner layout ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(inflater.getContext(), R.array.roles_array, android.R.layout.simple_spinner_item); // Specify the layout to use when the list of choices appears adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); // Apply the adapter to the spinner spinner.setAdapter(adapter);/*from ww w . jav a2s. c om*/ spinner.setOnItemSelectedListener(this); }
From source file:nl.sogeti.android.gpstracker.actions.ShareTrack.java
private void setKmzExportTargets() { ArrayAdapter<CharSequence> shareTargetAdapter = ArrayAdapter.createFromResource(this, R.array.sharekmztarget_choices, android.R.layout.simple_spinner_item); shareTargetAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); mShareTargetSpinner.setAdapter(shareTargetAdapter); int lastTarget = PreferenceManager.getDefaultSharedPreferences(this).getInt(Constants.EXPORT_KMZTARGET, EXPORT_TARGET_SEND);/*from w w w .ja v a 2 s . c o m*/ mShareTargetSpinner.setSelection(lastTarget); }
From source file:com.google.android.apps.flexbox.MainActivity.java
private void initializeSpinner(int currentValue, int menuItemId, Menu navigationMenu, int arrayResourceId, AdapterView.OnItemSelectedListener listener, ValueToStringConverter converter) { Spinner spinner = (Spinner) MenuItemCompat.getActionView(navigationMenu.findItem(menuItemId)); ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, arrayResourceId, R.layout.spinner_item);/*from ww w . j ava 2 s.co m*/ spinner.setAdapter(adapter); spinner.setOnItemSelectedListener(listener); String selectedAsString = converter.asString(currentValue); int position = adapter.getPosition(selectedAsString); spinner.setSelection(position); }
From source file:us.theparamountgroup.android.inventory.EditorActivity.java
/** * Setup the dropdown spinner that allows the user to select if the shell has a hole. */// ww w.ja va 2s. c om private void setupHoleSpinner() { // Create adapter for spinner. The list options are from the String array it will use // the spinner will use the default layout ArrayAdapter holeSpinnerAdapter = ArrayAdapter.createFromResource(this, R.array.array_hole_options, android.R.layout.simple_spinner_item); // Specify dropdown layout style - simple list view with 1 item per line holeSpinnerAdapter.setDropDownViewResource(android.R.layout.simple_dropdown_item_1line); // Apply the adapter to the spinner mHoleSpinner.setAdapter(holeSpinnerAdapter); // Set the integer mSelected to the constant values mHoleSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { String selection = (String) parent.getItemAtPosition(position); if (!TextUtils.isEmpty(selection)) { if (selection.equals(getString(R.string.no_hole))) { mHole = ShellContract.ShellEntry.HOLE; } else if (selection.equals(getString(R.string.hole))) { mHole = ShellContract.ShellEntry.NO_HOLE; } else { mHole = ShellContract.ShellEntry.HOLE_UNKNOWN; } } } // Because AdapterView is an abstract class, onNothingSelected must be defined @Override public void onNothingSelected(AdapterView<?> parent) { mHole = ShellContract.ShellEntry.HOLE_UNKNOWN; } }); }
From source file:com.h6ah4i.android.example.openslmediaplayer.app.contents.VisualizerFragment.java
private void setupViews() { VisualizerStateStore state = getStateStore(); Context context = getActivity(); mDuringSetupViews = true;//from w ww .ja v a2s . c o m mToggleButtonEnableWaveform.setChecked(state.isCaptureWaveformEnabled()); mToggleButtonEnableFft.setChecked(state.isCaptureFftEnabled()); mToggleButtonEnablePeak.setChecked(state.isMeasurementPeakEnabled()); mToggleButtonEnableRms.setChecked(state.isMeasurementRmsEnabled()); { final ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(context, R.array.visualizer_scaling_mode_names, android.R.layout.simple_spinner_item); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); mSpinnerScalingMode.setAdapter(adapter); } mSpinnerScalingMode.setSelection(state.getScalingMode()); mDuringSetupViews = false; }
From source file:metrocasas.projectsgt.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar);//from ww w . ja v a2 s .co m userid = getIntent().getExtras().getString("id"); //<editor-fold desc="Setting Map"> mGoogleApiClient = new GoogleApiClient.Builder(this).addConnectionCallbacks(this) .addOnConnectionFailedListener(this).addApi(LocationServices.API).build(); mLocationRequest = LocationRequest.create().setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY) .setInterval(10 * 1000) // 10 seconds, in milliseconds .setFastestInterval(1000); // 1 second, in milliseconds //</editor-fold> //<editor-fold desc="Setting Views"> title = (EditText) findViewById(R.id.editTextTitle); front = (EditText) findViewById(R.id.editTextFrente); back = (EditText) findViewById(R.id.editTextBack); unities = (EditText) findViewById(R.id.editTextUnidades); developer = (EditText) findViewById(R.id.editTextDesarrollador); phone = (EditText) findViewById(R.id.editTextTelefono); p = (LinearLayout) findViewById(R.id.layoutprogress); q = (ScrollView) findViewById(R.id.layoutinfo); myAudioRecorder = new MediaRecorder(); t1 = (TextView) findViewById(R.id.t1); upLoadInfo = (TextView) findViewById(R.id.tvUpload); grabar = (Button) findViewById(R.id.btnStart); detener = (Button) findViewById(R.id.btnStop); escuchar = (Button) findViewById(R.id.btnPlay); tomarFoto = (Button) findViewById(R.id.takePicture); obtenerGaleria = (Button) findViewById(R.id.getPicture); prevImg = (Button) findViewById(R.id.prevImg); nextImg = (Button) findViewById(R.id.nxtImg); licencia = (Spinner) findViewById(R.id.licencia); categoria = (Spinner) findViewById(R.id.categoria); enviar = (FloatingActionButton) findViewById(R.id.send_info); header = (ImageView) findViewById(R.id.imgHeader); Button btn_nuevo = (Button) findViewById(R.id.btnNew); openFile = (Button) findViewById(R.id.loadFile); audioNameFile = (TextView) findViewById(R.id.audioNameFile); //</editor-fold> assert btn_nuevo != null; btn_nuevo.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { new ApartamentoDialog().show(getFragmentManager(), ""); } }); initializeImageSwitcher(); setInitialImage(); setImageRotateListener(); header.setFocusableInTouchMode(true); header.requestFocus(); header.requestFocusFromTouch(); grabar.setEnabled(true); detener.setEnabled(false); escuchar.setEnabled(false); grabar.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { grabarAudio(v); } }); detener.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { detenerGrabacion(v); } }); escuchar.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { reproducir(v); escuchar.setEnabled(false); } }); tomarFoto.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { openBackCamera(); } }); obtenerGaleria.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { openGallery(); } }); prevImg.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { prevImage(); } }); nextImg.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { nextImage(); } }); openFile.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { loadFile(); } }); //<editor-fold desc="Setting Spinners"> ArrayAdapter<CharSequence> staticAdapter2 = ArrayAdapter.createFromResource(this, R.array.list_license, android.R.layout.simple_spinner_item); staticAdapter2.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); licencia.setAdapter(staticAdapter2); ArrayAdapter<CharSequence> staticAdapter3 = ArrayAdapter.createFromResource(this, R.array.list_category, android.R.layout.simple_spinner_item); staticAdapter3.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); categoria.setAdapter(staticAdapter3); //</editor-fold> enviar.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (isNetworkAvailable()) { upLoadFiles(); } else { Toast.makeText(getApplication(), "No tienes conexin a internet", Toast.LENGTH_LONG).show(); } } }); RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recycler_view); aAdapter = new ApartamentoAdapter(listApartamento); RecyclerView.LayoutManager mLayoutManager = new LinearLayoutManager(getApplicationContext()); assert recyclerView != null; recyclerView.setLayoutManager(mLayoutManager); recyclerView.setItemAnimator(new DefaultItemAnimator()); recyclerView.setAdapter(aAdapter); RecyclerView.ItemDecoration itemDecoration = new DividerItemDecoration(this, DividerItemDecoration.VERTICAL_LIST); recyclerView.addItemDecoration(itemDecoration); hello(); }