Skip to content

Instantly share code, notes, and snippets.

//Es es solo un Popup para mostrar información, no esperamos hacer algo con la respuesta
//de requerir recibir un input del usuario, debemos cambiar el "null" de la línea 11 por "this"
//y el activity debe implementar DialogInterface.OnClickListener
AlertDialog.Builder dialogInputUserBuilder = new AlertDialog.Builder(this);
dialogInputUserBuilder.setCancelable(false);
// fijamos el titulo del díalogo
dialogInputUserBuilder.setTitle("Ingrese un usuario");
//asignamos una imagen de Android (de preferencia reemplazarla por de nuestro proyecyo)
dialogInputUserBuilder.setIcon(android.R.drawable.ic_input_add);
// fijamos el mensaje
@fnovoac
fnovoac / custom_dialog_input.xml
Last active April 10, 2017 03:13
CustomDialogInputWithXML.java
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/custom_dialog_layout_design_user_input"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="16dp">
<TextView
android:id="@+id/dialogTitleCiudad"
@fnovoac
fnovoac / CustomArrayAdapter.java
Created April 10, 2017 03:47
Algunas Plantillas para Android Studio
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import java.util.List;
@fnovoac
fnovoac / Alert_Dialog_con_Opciones.java
Created April 10, 2017 13:19
Un alert dialog que muestra 3 opciones que son pasadas como CharSequence
// a nivel de de la Clase
private CharSequence opcionesCiudad[] = new CharSequence[] {"Editar", "Eliminar"};
AlertDialog.Builder alertDialogBuilderOpciones = new AlertDialog.Builder(this);
alertDialogBuilderOpciones.setCancelable(false);
alertDialogBuilderOpciones.setItems(opcionesCiudad,this);
alertDialogBuilderOpciones.setNegativeButton(R.string.Cancelar,this);
alertDialogBuilderOpciones.create().show();
public interface RecyclerViewItemClickListener {
public void onClick(View view, int position);
public void onLongClick(View view, int position);
}
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- google's material design colours from
http://www.google.com/design/spec/style/color.html#color-ui-color-palette -->
<!--reds-->
<color name="md_red_50">#FFEBEE</color>
<color name="md_red_100">#FFCDD2</color>
<color name="md_red_200">#EF9A9A</color>
//From: https://github.com/cgoldberg/netplot/blob/0cdac581460f70a3d39929ffb5a2635a9eb16320/src/Stopwatch.java
/*
* Copyright 2006 Corey Goldberg (cgoldberg _at_ gmail.com)
*
* This file is part of NetPlot.
*
* NetPlot is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
/**
* Copyright 2017 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
import android.annotation.SuppressLint;
import android.arch.lifecycle.LiveData;
import android.content.Context;
import android.location.Location;
import com.google.android.gms.location.FusedLocationProviderClient;
import com.google.android.gms.location.LocationCallback;
import com.google.android.gms.location.LocationRequest;
import com.google.android.gms.location.LocationResult;
import com.google.android.gms.location.LocationServices;
**
* All constants used by app
*/
public class Constants {
private static final String PACKAGE_NAME = "com.xxxxxxxxxxxx.xxxxxxxxxxxxxx";
public interface NOTIFICATION_ID {
public static int TRACKER_SERVICE = 00;
}