List of usage examples for android.content SharedPreferences getInt
int getInt(String key, int defValue);
From source file:ch.teamuit.android.soundplusplus.LibraryActivity.java
@Override public void onCreate(Bundle state) { ThemeHelper.setTheme(this, R.style.Library); super.onCreate(state); if (state == null) { checkForLaunch(getIntent());//from ww w . j a va2s . c o m } setContentView(R.layout.library_content); mLimiterScroller = (HorizontalScrollView) findViewById(R.id.limiter_scroller); mLimiterViews = (ViewGroup) findViewById(R.id.limiter_layout); LibraryPagerAdapter pagerAdapter = new LibraryPagerAdapter(this, mLooper); mPagerAdapter = pagerAdapter; ViewPager pager = (ViewPager) findViewById(R.id.pager); pager.setAdapter(pagerAdapter); mViewPager = pager; SharedPreferences settings = PlaybackService.getSettings(this); mBottomBarControls = (BottomBarControls) findViewById(R.id.bottombar_controls); mBottomBarControls.setOnClickListener(this); mBottomBarControls.setOnQueryTextListener(this); mBottomBarControls.enableOptionsMenu(this); if (PermissionRequestActivity.havePermissions(this) == false) { PermissionRequestActivity.showWarning(this, getIntent()); } mVanillaTabLayout = (VanillaTabLayout) findViewById(R.id.sliding_tabs); mVanillaTabLayout.setOnPageChangeListener(pagerAdapter); loadTabOrder(); int page = settings.getInt(PrefKeys.LIBRARY_PAGE, PrefDefaults.LIBRARY_PAGE); if (page != 0) { pager.setCurrentItem(page); } loadAlbumIntent(getIntent()); bindControlButtons(); }
From source file:com.nit.vicky.CardBrowser.java
@Override protected void onCreate(Bundle savedInstanceState) { Themes.applyTheme(this); super.onCreate(savedInstanceState); View mainView = getLayoutInflater().inflate(R.layout.card_browser, null); setContentView(mainView);/* w ww. j a v a 2 s . c om*/ Themes.setContentStyle(mainView, Themes.CALLER_CARDBROWSER); mCol = AnkiDroidApp.getCol(); if (mCol == null) { reloadCollection(savedInstanceState); return; } mDeckNames = new HashMap<String, String>(); for (long did : mCol.getDecks().allIds()) { mDeckNames.put(String.valueOf(did), mCol.getDecks().name(did)); } registerExternalStorageListener(); Intent i = getIntent(); mWholeCollection = i.hasExtra("fromDeckpicker") && i.getBooleanExtra("fromDeckpicker", false); mBackground = Themes.getCardBrowserBackground(); SharedPreferences preferences = AnkiDroidApp.getSharedPrefs(getBaseContext()); int sflRelativeFontSize = preferences.getInt("relativeCardBrowserFontSize", DEFAULT_FONT_SIZE_RATIO); String sflCustomFont = preferences.getString("browserEditorFont", ""); mPrefFixArabic = preferences.getBoolean("fixArabicText", false); Resources res = getResources(); mOrderByFields = res.getStringArray(R.array.card_browser_order_labels); try { mOrder = CARD_ORDER_NONE; String colOrder = mCol.getConf().getString("sortType"); for (int c = 0; c < fSortTypes.length; ++c) { if (fSortTypes[c].equals(colOrder)) { mOrder = c; break; } } if (mOrder == 1 && preferences.getBoolean("cardBrowserNoSorting", false)) { mOrder = 0; } mOrderAsc = Upgrade.upgradeJSONIfNecessary(mCol, mCol.getConf(), "sortBackwards", false); // default to descending for non-text fields if (fSortTypes[mOrder].equals("noteFld")) { mOrderAsc = !mOrderAsc; } } catch (JSONException e) { throw new RuntimeException(e); } mCards = new ArrayList<HashMap<String, String>>(); mCardsListView = (ListView) findViewById(R.id.card_browser_list); mCardsAdapter = new SizeControlledListAdapter(this, mCards, R.layout.card_item, new String[] { "word", "sfld", "deck", "flags" }, new int[] { R.id.card_word, R.id.card_sfld, R.id.card_deck, R.id.card_item }, sflRelativeFontSize, sflCustomFont); mCardsAdapter.setViewBinder(new SimpleAdapter.ViewBinder() { @Override public boolean setViewValue(View view, Object arg1, String text) { if (view.getId() == R.id.card_item) { int which = BACKGROUND_NORMAL; if (text.equals("1")) { which = BACKGROUND_SUSPENDED; } else if (text.equals("2")) { which = BACKGROUND_MARKED; } else if (text.equals("3")) { which = BACKGROUND_MARKED_SUSPENDED; } view.setBackgroundResource(mBackground[which]); return true; } else if (view.getId() == R.id.card_deck && text.length() > 0) { view.setVisibility(View.VISIBLE); } return false; } }); //mCardsListView.setAdapter(mCardsAdapter); mCardsListView.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { mPositionInCardsList = position; long cardId = Long.parseLong(mCards.get(mPositionInCardsList).get("id")); sCardBrowserCard = mCol.getCard(cardId); Intent editCard = new Intent(CardBrowser.this, MultimediaCardEditorActivity.class); //editCard.putExtra(CardEditor.EXTRA_CALLER, CardEditor.CALLER_CARDBROWSER_EDIT); editCard.putExtra(MultimediaCardEditorActivity.EXTRA_CARD_ID, sCardBrowserCard.getId()); startActivityForResult(editCard, EDIT_CARD); if (AnkiDroidApp.SDK_VERSION > 4) { ActivityTransitionAnimation.slide(CardBrowser.this, ActivityTransitionAnimation.LEFT); } } }); registerForContextMenu(mCardsListView); mCardsGridView = (StaggeredGridView) findViewById(R.id.card_browser_gridview); mCardsGridView.setAdapter(mGridAdapter); mCardsGridView.setOnItemClickListener(new StaggeredGridView.OnItemClickListener() { @Override public void onItemClick(StaggeredGridView parent, View view, int position, long id) { mPositionInCardsList = position; long cardId = Long.parseLong(mCards.get(mPositionInCardsList).get("id")); sCardBrowserCard = mCol.getCard(cardId); Intent editCard = new Intent(CardBrowser.this, MultimediaCardEditorActivity.class); //editCard.putExtra(CardEditor.EXTRA_CALLER, CardEditor.CALLER_CARDBROWSER_EDIT); editCard.putExtra(MultimediaCardEditorActivity.EXTRA_CARD_ID, sCardBrowserCard.getId()); startActivityForResult(editCard, EDIT_CARD); if (AnkiDroidApp.SDK_VERSION > 4) { ActivityTransitionAnimation.slide(CardBrowser.this, ActivityTransitionAnimation.LEFT); } String imgURL = getImgURL(sCardBrowserCard); Toast.makeText(CardBrowser.this, imgURL, Toast.LENGTH_LONG).show(); } }); mSearchEditText = (EditText) findViewById(R.id.card_browser_search); mSearchEditText.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView view, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_SEARCH) { onSearch(); return true; } return false; } }); getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); mSearchButton = (ImageButton) findViewById(R.id.card_browser_search_button); mSearchButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { onSearch(); } }); mSearchTerms = ""; if (mWholeCollection) { mRestrictOnDeck = ""; setTitle(res.getString(R.string.card_browser_all_decks)); } else { try { String deckName = mCol.getDecks().current().getString("name"); mRestrictOnDeck = "deck:'" + deckName + "' "; setTitle(deckName); } catch (JSONException e) { throw new RuntimeException(e); } } mSelectedTags = new HashSet<String>(); if (!preferences.getBoolean("cardBrowserNoSearchOnOpen", false)) { searchCards(); } }
From source file:com.tsp.clipsy.audio.RingdroidEditActivity.java
private void afterSavingRingtone(CharSequence title, String outPath, File outFile, int duration) { // Create the database record, pointing to the existing file path long fileSize = outFile.length(); String mimeType = "audio/mpeg"; String artist = "" + getResources().getText(R.string.artist_name); ContentValues values = new ContentValues(); values.put(MediaStore.MediaColumns.DATA, outPath); values.put(MediaStore.MediaColumns.TITLE, title.toString()); values.put(MediaStore.MediaColumns.SIZE, fileSize); values.put(MediaStore.MediaColumns.MIME_TYPE, mimeType); values.put(MediaStore.Audio.Media.ARTIST, artist); values.put(MediaStore.Audio.Media.DURATION, duration); values.put(MediaStore.Audio.Media.IS_RINGTONE, false); values.put(MediaStore.Audio.Media.IS_NOTIFICATION, false); values.put(MediaStore.Audio.Media.IS_ALARM, false); values.put(MediaStore.Audio.Media.IS_MUSIC, true); // Insert it into the database Uri uri = MediaStore.Audio.Media.getContentUriForPath(outPath); final Uri newUri = getContentResolver().insert(uri, values); setResult(RESULT_OK, new Intent().setData(newUri)); // Update a preference that counts how many times we've // successfully saved a ringtone or other audio SharedPreferences prefs = getPreferences(Context.MODE_PRIVATE); int successCount = prefs.getInt(PREF_SUCCESS_COUNT, 0); SharedPreferences.Editor prefsEditor = prefs.edit(); prefsEditor.putInt(PREF_SUCCESS_COUNT, successCount + 1); prefsEditor.commit();// w ww . j a v a 2 s . c o m Intent output = new Intent(); output.putExtra("path", outPath); setResult(Activity.RESULT_OK, output); Toast.makeText(this, R.string.save_success_message, Toast.LENGTH_SHORT).show(); finish(); return; }
From source file:org.planetmono.dcuploader.ActivityUploader.java
private void reloadConfigurations() { SharedPreferences pref = getSharedPreferences(Application.APP, Activity.MODE_PRIVATE); maximumResolution = pref.getInt(ActivityPreferences.KEY_MAXIMUM_RESOLUTION, ActivityPreferences.DEFAULT_MAXIMUM_RESOLUTION); imageQuality = pref.getInt(ActivityPreferences.KEY_IMAGE_QUALITY, ActivityPreferences.DEFAULT_IMAGE_QUALITY); sizeThreshold = pref.getInt(ActivityPreferences.KEY_IMAGE_RESIZE_THRESHOLD, ActivityPreferences.DEFAULT_IMAGE_RESIZE_THRESHOLD); mobilePageProvider = pref.getString(ActivityPreferences.KEY_MOBILE_PAGE_PROVIDER, ActivityPreferences.DEFAULT_MOBILE_PAGE_PROVIDER); pageDestination = pref.getString(ActivityPreferences.KEY_DESTINATION, ActivityPreferences.DEFAULT_DESTINATION); formLocation = pref.getBoolean(ActivityPreferences.KEY_ALWAYS_ENCLOSE_POSITION, ActivityPreferences.DEFAULT_ALWAYS_ENCLOSE_POSITION); sign = pref.getBoolean(ActivityPreferences.KEY_SIGNATURE, ActivityPreferences.DEFAULT_SIGNATURE); boolean use_custom_signature = pref.getBoolean(ActivityPreferences.KEY_USE_CUSTOM_SIGNATURE, ActivityPreferences.DEFAULT_USE_CUSTOM_SIGNATURE); if (use_custom_signature) customSign = pref.getString(ActivityPreferences.KEY_CUSTOM_SIGNATURE, ""); signModel = pref.getBoolean(ActivityPreferences.KEY_ALWAYS_ENCLOSE_MODEL, ActivityPreferences.DEFAULT_ALWAYS_ENCLOSE_MODEL); ((CheckBox) findViewById(R.id.upload_enclose_position)).setChecked(formLocation); }
From source file:ch.blinkenlights.android.vanilla.LibraryActivity.java
@Override public void onCreate(Bundle state) { ThemeHelper.setTheme(this, R.style.Library); super.onCreate(state); if (state == null) { checkForLaunch(getIntent());/* w w w . j a v a2s . c o m*/ } setContentView(R.layout.library_content); mLimiterScroller = (HorizontalScrollView) findViewById(R.id.limiter_scroller); mLimiterViews = (ViewGroup) findViewById(R.id.limiter_layout); LibraryPagerAdapter pagerAdapter = new LibraryPagerAdapter(this, mLooper); mPagerAdapter = pagerAdapter; ViewPager pager = (ViewPager) findViewById(R.id.pager); pager.setAdapter(pagerAdapter); mViewPager = pager; SharedPreferences settings = PlaybackService.getSettings(this); mBottomBarControls = (BottomBarControls) findViewById(R.id.bottombar_controls); mBottomBarControls.setOnClickListener(this); mBottomBarControls.setOnQueryTextListener(this); mBottomBarControls.enableOptionsMenu(this); if (PermissionRequestActivity.havePermissions(this) == false) { PermissionRequestActivity.showWarning(this, getIntent()); } mVanillaTabLayout = (VanillaTabLayout) findViewById(R.id.sliding_tabs); mVanillaTabLayout.setOnPageChangeListener(pagerAdapter); loadTabOrder(); int page = settings.getInt(PrefKeys.LIBRARY_PAGE, PrefDefaults.LIBRARY_PAGE); if (page != 0) { pager.setCurrentItem(page); } loadLimiterIntent(getIntent()); bindControlButtons(); if (state != null && state.getBoolean("launch_search")) { mBottomBarControls.showSearch(true); } }
From source file:com.inmobi.ultrapush.AnalyzeActivity.java
void updatePreferenceSaved() { // load preferences for buttons SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this); sampleRate = sharedPref.getInt("button_sample_rate", 48000); fftLen = sharedPref.getInt("button_fftlen", 1024); nFFTAverage = sharedPref.getInt("button_average", 1); isAWeighting = sharedPref.getBoolean("dbA", false); if (isAWeighting) { ((SelectorText) findViewById(R.id.dbA)).nextValue(); }/* w w w . j a v a 2s.c o m*/ boolean isSpam = sharedPref.getBoolean("spectrum_spectrogram_mode", true); if (!isSpam) { ((SelectorText) findViewById(R.id.spectrum_spectrogram_mode)).nextValue(); } Log.i(TAG, " updatePreferenceSaved(): sampleRate = " + sampleRate); Log.i(TAG, " updatePreferenceSaved(): fftLen = " + fftLen); Log.i(TAG, " updatePreferenceSaved(): nFFTAverage = " + nFFTAverage); ((Button) findViewById(R.id.button_sample_rate)).setText(Integer.toString(sampleRate)); ((Button) findViewById(R.id.button_fftlen)).setText(Integer.toString(fftLen)); ((Button) findViewById(R.id.button_average)).setText(Integer.toString(nFFTAverage)); }
From source file:com.almalence.opencam.PluginManager.java
@Override public void onShutterClick() { // <!-- -+- // check if plugin payed if (null != pluginList.get(activeCapture) && !((PluginCapture) pluginList.get(activeCapture)).getInCapture()) { if (!MainScreen.checkLaunches(getActiveMode())) { ApplicationScreen.getGUIManager().lockControls = false; return; }// w ww.ja v a 2s .c o m } // -+- --> if (!shutterRelease) return; SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(ApplicationScreen.getMainContext()); delayedCaptureFlashPrefCommon = prefs.getBoolean(MainScreen.sDelayedFlashPref, false); delayedCaptureSoundPrefCommon = prefs.getBoolean(MainScreen.sDelayedSoundPref, false); int delayInterval = prefs.getInt(MainScreen.sDelayedCapturePref, 0); boolean showDelayedCapturePrefCommon = prefs.getBoolean(MainScreen.sShowDelayedCapturePref, false); photoTimeLapseActive = prefs.getBoolean(MainScreen.sPhotoTimeLapseActivePref, false); photoTimeLapseIsRunning = prefs.getBoolean(MainScreen.sPhotoTimeLapseIsRunningPref, false); if (photoTimeLapseActive && pluginList.get(activeCapture).photoTimeLapseCaptureSupported()) { if (isUserClicked) { Editor e = prefs.edit(); if (photoTimeLapseIsRunning) { e.putBoolean(MainScreen.sPhotoTimeLapseIsRunningPref, false); e.commit(); AlarmReceiver.cancelAlarm(ApplicationScreen.instance); ApplicationScreen.instance.guiManager.stopCaptureIndication(); ApplicationScreen.getGUIManager().lockControls = false; PluginManager.getInstance().sendMessage(ApplicationInterface.MSG_BROADCAST, ApplicationInterface.MSG_CONTROL_UNLOCKED); } else { e.putInt(MainScreen.sPhotoTimeLapseCount, 0); e.putBoolean(MainScreen.sPhotoTimeLapseIsRunningPref, true); e.commit(); for (int i = 0; i < activeVF.size(); i++) pluginList.get(activeVF.get(i)).onShutterClick(); pluginList.get(activeCapture).onShutterClick(); ApplicationScreen.instance.guiManager.showCaptureIndication(); } } else { ApplicationScreen.instance.guiManager.setShutterIcon(ShutterButton.TIMELAPSE_ACTIVE); for (int i = 0; i < activeVF.size(); i++) pluginList.get(activeVF.get(i)).onShutterClick(); pluginList.get(activeCapture).onShutterClick(); } } else { if (!showDelayedCapturePrefCommon || delayInterval == 0 || !pluginList.get(activeCapture).delayedCaptureSupported()) { for (int i = 0; i < activeVF.size(); i++) pluginList.get(activeVF.get(i)).onShutterClick(); if (null != pluginList.get(activeCapture) && ApplicationScreen.instance.findViewById(R.id.postprocessingLayout) .getVisibility() == View.GONE && ApplicationScreen.instance.findViewById(R.id.blockingLayout) .getVisibility() == View.GONE) pluginList.get(activeCapture).onShutterClick(); } else { boolean keepScreenOn = prefs.getBoolean(MainScreen.sKeepScreenOn, false); if (!keepScreenOn) { MainScreen.getInstance().setKeepScreenOn(true); Handler handler = new Handler(); handler.postDelayed(new Runnable() { @Override public void run() { MainScreen.getInstance().setKeepScreenOn(false); } }, delayInterval * 1000 + 500); } shutterRelease = false; delayedCapture(delayInterval); } } isUserClicked = true; }
From source file:com.miz.functions.MizLib.java
public static void scheduleMovieUpdate(Context context) { SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(context); // Check if scheduled updates are enabled, and schedule the next update if this is the case if (settings.getInt(SCHEDULED_UPDATES_MOVIE, ScheduledUpdatesFragment.NOT_ENABLED) > ScheduledUpdatesFragment.AT_LAUNCH) { ScheduledUpdatesAlarmManager.cancelUpdate(ScheduledUpdatesAlarmManager.MOVIES, context); long duration = MizLib.HOUR; switch (settings.getInt(SCHEDULED_UPDATES_MOVIE, ScheduledUpdatesFragment.NOT_ENABLED)) { case ScheduledUpdatesFragment.EVERY_2_HOURS: duration = MizLib.HOUR * 2;/* w w w . j ava 2 s .c o m*/ break; case ScheduledUpdatesFragment.EVERY_4_HOURS: duration = MizLib.HOUR * 4; break; case ScheduledUpdatesFragment.EVERY_6_HOURS: duration = MizLib.HOUR * 6; break; case ScheduledUpdatesFragment.EVERY_12_HOURS: duration = MizLib.HOUR * 12; break; case ScheduledUpdatesFragment.EVERY_DAY: duration = MizLib.DAY; break; case ScheduledUpdatesFragment.EVERY_WEEK: duration = MizLib.WEEK; break; } ScheduledUpdatesAlarmManager.startUpdate(ScheduledUpdatesAlarmManager.MOVIES, context, duration); } }
From source file:com.miz.functions.MizLib.java
public static void scheduleShowsUpdate(Context context) { SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(context); // Check if scheduled updates are enabled, and schedule the next update if this is the case if (settings.getInt(SCHEDULED_UPDATES_TVSHOWS, ScheduledUpdatesFragment.NOT_ENABLED) > ScheduledUpdatesFragment.AT_LAUNCH) { ScheduledUpdatesAlarmManager.cancelUpdate(ScheduledUpdatesAlarmManager.SHOWS, context); long duration = MizLib.HOUR; switch (settings.getInt(SCHEDULED_UPDATES_TVSHOWS, ScheduledUpdatesFragment.NOT_ENABLED)) { case ScheduledUpdatesFragment.EVERY_2_HOURS: duration = MizLib.HOUR * 2;// ww w . j a v a 2 s. c o m break; case ScheduledUpdatesFragment.EVERY_4_HOURS: duration = MizLib.HOUR * 4; break; case ScheduledUpdatesFragment.EVERY_6_HOURS: duration = MizLib.HOUR * 6; break; case ScheduledUpdatesFragment.EVERY_12_HOURS: duration = MizLib.HOUR * 12; break; case ScheduledUpdatesFragment.EVERY_DAY: duration = MizLib.DAY; break; case ScheduledUpdatesFragment.EVERY_WEEK: duration = MizLib.WEEK; break; } ScheduledUpdatesAlarmManager.startUpdate(ScheduledUpdatesAlarmManager.SHOWS, context, duration); } }
From source file:reportsas.com.formulapp.Formulario.java
public void enviarR(View v) { String resul = ""; SharedPreferences pref = getSharedPreferences("ParametrosBasicos", Context.MODE_PRIVATE); long per = pref.getInt("userid", 0); respuestaEncuesta = new EncuestaRespuesta(encuesta.getIdEncuesta(), per, Integer.parseInt(getDatePhone("MMddHHmmss")), "" + getDatePhone("yyyy-MM-dd")); ArrayList<PreguntaRespuesta> respuestas = new ArrayList<PreguntaRespuesta>(); ArrayList<ParametrosRespuesta> respuestaParametros = new ArrayList<ParametrosRespuesta>(); boolean validator = false; for (int i = 0; i < layout.getChildCount(); i++) { LinearLayout child = (LinearLayout) layout.getChildAt(i); int numeRes = ObtenerRespuesta(child, encuesta.getPreguntas().get(i), respuestas); if (encuesta.getPreguntas().get(i).getObligatoria().equals("S")) { for (int j = respuestas.size() - 1; j > (respuestas.size() - 1) - numeRes; j--) { PreguntaRespuesta respuestaValidar = respuestas.get(j); if (respuestaValidar.getOpcion() == null) { if (respuestaValidar.getRespuesta().trim().length() == 0) { Toast toast1 = Toast.makeText(this, "La pregunta :" + encuesta.getPreguntas().get(i).getTitulo() + ", Es obligatoria!", Toast.LENGTH_LONG); toast1.show();/*from ww w .ja v a 2 s . c o m*/ validator = true; } } else { if (respuestaValidar.getOpcion().trim().length() == 0) { Toast toast1 = Toast.makeText(this, "Debe escoger un valor para " + respuestaValidar.getRespuesta() + " en la pregunta :" + encuesta.getPreguntas().get(i).getTitulo(), Toast.LENGTH_LONG); toast1.show(); validator = true; } } } } if (validator) { respuestas.clear(); break; } } if (encuesta.getParametros() != null) { for (int w = 0; w < encuesta.getParametros().size(); w++) { EncuestaParametro ep = encuesta.getParametros().get(w); if (ep.getOpcional().indexOf('N') > -1) { switch (ep.getIdParametro()) { // Captura GPS case 1: if (parametroGPS == null) { Toast toast1 = Toast.makeText(this, "Debe diligenciar la ubicacin GPS ", Toast.LENGTH_LONG); toast1.show(); validator = true; } break; // Captura Imgen case 2: if (parametroCam == null) { Toast toast1 = Toast.makeText(this, "Debe obtener la captura de una imagen.", Toast.LENGTH_LONG); toast1.show(); validator = true; } break; // Lectura de Codigo case 3: if (parametroScan == null) { Toast toast1 = Toast.makeText(this, "Debe obtener el scaner de la cedula", Toast.LENGTH_LONG); toast1.show(); validator = true; } break; default: break; } if (validator) { break; } } } if (!validator) { if (parametroGPS != null) { respuestaParametros.add(parametroGPS); } if (parametroCam != null) { respuestaParametros.add(parametroCam); } if (parametroScan != null) { respuestaParametros.add(parametroScan); } if (respuestas.size() > 0) { respuestaEncuesta.setRespuesta(respuestas); if (respuestaParametros.size() > 0) { respuestaEncuesta.setParametros(respuestaParametros); } } } } if (!validator) { final Gson gson = new Gson(); if (DataOpciones.verificaConexion(this)) { String pr = pref.getString("ruta", "54.164.174.129:8081"); //http://10.200.5.8:8081/ String ruta = "http://" + pr + "/" + HTTP_EVENT; new MyAsyncTask(Formulario.this).execute("POST", gson.toJson(respuestaEncuesta), ruta); } else { insertarEncuentas(respuestaEncuesta); } } }