Skip to content

Instantly share code, notes, and snippets.

@monotocho
monotocho / gist:3171180
Created July 24, 2012 16:59
tag contextview in getview.
private class ViewHolder : Java.Lang.Object
{
public TextView lbCodigo;
public TextView lbNombre;
public TextView lbPrecio;
public ProgressBar pbImagen;
public ImageView ivImagen;
public int position;
}
// Quick-and-dirty (and untested!) port of https://gist.github.com/3169945 to C#
Bitmap DecodeFile (string path)
{
var opts = new BitmapFactory.Options () {
InJustDecodeBounds = true,
};
using (var b = BitmapFactory.DecodeFile (path, opts)) {
// Ignore; we're filling `opts`
}
const int RequiredSize = 70;
@monotocho
monotocho / gist:3169945
Created July 24, 2012 13:37
optimize bitmap
//decodes image and scales it to reduce memory consumption
private Bitmap decodeFile(File f){
try {
//Decode image size
BitmapFactory.Options o = new BitmapFactory.Options();
o.inJustDecodeBounds = true;
BitmapFactory.decodeStream(new FileInputStream(f),null,o);
//The new size we want to scale to
final int REQUIRED_SIZE=70;
@monotocho
monotocho / gist:3164525
Created July 23, 2012 16:19
MY GetView - Gridview. ( very slow!!!!!! in tablet to scrolling 5 columns..)
public override View GetView(int position, View convertView, ViewGroup parent)
{
ViewHolder holder;
AdapterArticuloConsultaItem item;
string path;
bool encontrado = false;
Bitmap bMap = null;
if (convertView == null)
{
@monotocho
monotocho / gist:3164319
Created July 23, 2012 15:45
GetView - Gridview.
public override View GetView(int position, View convertView, ViewGroup parent)
{
View row;
AdapterArticuloConsultaItem item;
TextView lbTexto;
ProgressBar pbImagen;
ImageView ivImagen;
if (convertView == null)
{
@monotocho
monotocho / gist:3033431
Created July 2, 2012 14:12
ViewDissapear
public override void ViewWillDisappear (bool animated)
{
base.ViewWillDisappear (animated);
//use AtmHud ActivityView
MUI.MuestraCursor ("Cargando Articulos...");
ThreadPool.QueueUserWorkItem ((ee) => {
//That method is late 6 seconds
call database method
@monotocho
monotocho / gist:3001973
Created June 27, 2012 06:31
Selected custom element
//********************
//Navigate to DVC1 !!!
//********************
namespace EMALI
{
public partial class vPtoVentaTipo : DialogViewController
{
public int PaginaIndex { get; set; }