Programación y Desarrollo para Android Subforo exclusivo para temas de programación de software para PDAs y desarrollo de aplicaciones, interfaces, etc bajo Android


 
Herramientas
  #1  
Viejo 06/03/14, 14:25:35
Avatar de tetapoeta
tetapoeta tetapoeta no está en línea
Miembro del foro
Mensajes: 232
Compra y venta: (2)
 
Fecha de registro: oct 2011
Mensajes: 232
Tu operador: Movistar
Mencionado: 0 comentarios
Tagged: 0 hilos
No funciona programa en diferentes dispositivos

Buenas a todos. Resulta que hice una aplicacion en android y siempre la pruebo en mi antiguo movil, que lo uso de conejillo de indias para estas cosas.

La aplicacion es bastante sencilla. Un ImageViewTouch y un par de botones, para que cuando pulses uno de ellos cambie la imagen. Pues bien, la tenia terminada y funcionaba perfectamente en mi HTC Desire (el movil de prueba). El problema es que al pasarlo a mi Jiayu G3 no funciona a aplicacion y no tengo ni idea de por qué. Lo he probado en el movil de mi novia (Samsung Galaxy SII) y tambien funciona perfectamente. He estado trasteando un poco por internet y he visto que el problema puede ser que las imagenes no se muestran bien o algo asi y que tengo que usar el Bitmap, pero no tengo ni idea de como usarlo. He visto un par de metodos por internet para convertir un Drawable en un Bitmap, pero no funcionan. Pongo un if(bitmapp != null) para que cambien la imagen, pero nunca llega a entrar.

Os pongo el codigo en java por si alguien me puede echar una mano.

Un saludo y gracias.

public class MainActivity extends Activity {

private static final String LOG_TAG = "image-test";

ImageViewTouch mImage;
Button mButton1;
Button mButton2;
static int displayTypeCount = 0;

@Override
protected void onCreate( Bundle savedInstanceState ) {
super.onCreate( savedInstanceState );
requestWindowFeature( Window.FEATURE_NO_TITLE );
setContentView( R.layout.main );

//Toast.makeText(this, "ImageViewTouch.VERSION: " + ImageViewTouch.VERSION, Toast.LENGTH_SHORT).show();
}

@Override
public void onContentChanged() {
super.onContentChanged();
mImage = (ImageViewTouch) findViewById( R.id.image );

// set the default image display type
mImage.setDisplayType( DisplayType.FIT_IF_BIGGER );

mButton1 = (Button) findViewById( R.id.button );
mButton2 = (Button) findViewById( R.id.button2 );

mButton1.setOnClickListener( new OnClickListener() {

@Override
public void onClick( View v ) {

Resources res = getResources();
Drawable drawable = res.getDrawable(R.drawable.metroberlin);
mImage.setImageDrawable(drawable);
//mImage = (ImageViewTouch) findViewById(R.id.image);
}
} );

mButton2.setOnClickListener( new OnClickListener() {

@Override
public void onClick( View v ) {

Resources res = getResources();
Drawable drawable = res.getDrawable(R.drawable.tranviaberlin);
mImage.setImageDrawable(drawable);
//mImage = (ImageViewTouch) findViewById(R.id.image);
}
} );

mImage.setSingleTapListener( new OnImageViewTouchSingleTapListener() {

@Override
public void onSingleTapConfirmed() {
Log.d( LOG_TAG, "onSingleTapConfirmed" );
}
} );

mImage.setDoubleTapListener( new OnImageViewTouchDoubleTapListener() {

@Override
public void onDoubleTap() {
Log.d( LOG_TAG, "onDoubleTap" );
}
} );

mImage.setOnDrawableChangedListener( new OnDrawableChangeListener() {

@Override
public void onDrawableChanged( Drawable drawable ) {
Log.i( LOG_TAG, "onBitmapChanged: " + drawable );
}
} );
}

@Override
public void onConfigurationChanged( Configuration newConfig ) {
super.onConfigurationChanged( newConfig );
}

Matrix imageMatrix;
}
Responder Con Cita


Respuesta

Estás aquí
Regresar   HTCMania > Todo sobre Android > Programación y Desarrollo para Android


Reglas de Mensajes
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Las caritas están On
Código [IMG] está On
Código HTML está Off

Saltar a Foro



Hora actual: 15:24:04 (GMT +2)

Cookies settings
Powered by vBulletin™
Copyright © vBulletin Solutions, Inc. All rights reserved.
 
HTCMania: líderes desde el 2007