Question: I have 2 buttons for increasing and decreasing `TextView` font size:

```
    btnZoomin.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
           txtview.setTextSize(txtview.getTextSize()+1);
        }
    });
    btnZoomout.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            txtview.setTextSize(txtview.getTextSize()-1);
        }
    });

```

But are experiencing difficulty, as it will not work.

Answer: 
txtview.setTextSize(TypedValue.COMPLEX\_UNIT\_PX,txtview.getTextSize()-1);
txtview.setTextSize(TypedValue.COMPLEX\_UNIT\_PX,txtview.getTextSize()+1);
Sorry for the previous code, that was wrong but i think this will work for you,

```
package com.example.sample;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;

public class MainActivity extends Activity {

int counter = 0;
private int size;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    final TextView txt = (TextView) findViewById(R.id.txt);
    Button btn = (Button) findViewById(R.id.button1);

    counter = (int) txt.getTextSize();
    btn.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            Toast.makeText(getApplicationContext(), txt.getTextSize() + "",
                    Toast.LENGTH_LONG).show();
            size = counter++;
            txt.setTextSize(size);

        }
    });
}
}

```