Skip to content

Instantly share code, notes, and snippets.

View Charlex96's full-sized avatar

CARLOS PRADO Charlex96

View GitHub Profile
@chrisjenx
chrisjenx / gist:3176258
Created July 25, 2012 13:42
Restart activity from fragment
//Post it in a handler to make sure it gets called if coming back from a lifecycle method.
new Handler().post(new Runnable() {
@Override
public void run()
{
Intent intent = getActivity().getIntent();
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK
| Intent.FLAG_ACTIVITY_NO_ANIMATION);
getActivity().overridePendingTransition(0, 0);
@Klerith
Klerith / preferencias_usuario.dart
Last active March 10, 2023 22:27
Flutter: Configuración singleton para las preferencias del usuario
import 'package:shared_preferences/shared_preferences.dart';
/*
Recordar instalar el paquete de:
shared_preferences:
Inicializar en el main
final prefs = new PreferenciasUsuario();
await prefs.initPrefs();