Quando crio o projeto ele vem assim
public class MainActivity extends AppCompatActivity{
gostaria de usar mais duma extends
como fazer ?
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.ScaleGestureDetector;
import android.view.ScaleGestureDetector.SimpleOnScaleGestureListener;
import android.view.View;
import android.widget.ImageView;
public class MainActivity extends AppCompatActivity implements SimpleOnScaleGestureListener {
private ImageView imageView;
private float scale = 1f;
@Override
public boolean onScale(ScaleGestureDetector detector) {
//Factor de zoom correspondente ao movimento feito
float scaleFactor = detector.getScaleFactor();
//Executa o zoom
performZoom(scaleFactor);
return true;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
scaleGestureDetector = new ScaleGestureDetector(this,new MainActivity());
view.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
v.performClick();
//Chamar o onTouchEvent do nosso ScaleGestureDetector
scaleGestureDetector.onTouchEvent(event);
return true;
}
});
}
private void performZoom(float scaleFactor) {
scale *= scaleFactor;
scale = Math.max(0.1f, Math.min(scale, 5.0f));
imageView.setScaleX(scale);
imageView.setScaleY(scale);
}
}
extends SimpleOnScaleGestureListener
implements SimpleOnScaleGestureListener
e declare uma inner class que extends de SimpleOnScaleGestureListener ou seja copie o código da classe ScaleListener da outra resposta para dentro da MainActivity