Question: Used this code on previous app and all seems ok - but today im getting a 

call requires permission which may be rejected by user

I have added 

```
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />

```

to manifest and have read several threads on the subject, but still having issues. Could you guys helps out.

```
public class MainActivity extends AppCompatActivity implements LocationListener
{
    private LocationManager locationManager;
    public static String locationlong;
    public static String locationlati;

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

        TextView tv = (TextView)findViewById(R.id.pig);
        TextView cow = (TextView)findViewById(R.id.cow);

        locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
        locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 10000, 1, this);
    }
}

```

Answer: 
> 
> I'm trying to get a text box to grow as needed to fit the text typed
>  into it, up to 80% of the width of the parent div.
> 
> 
> 

I'm fairly certain this won't be possible via CSS alone, because there is no way for CSS to determine the length of the text-content of the `textarea`.

With javascript, on every keypress, you can check the length of the text-content and if:

* the text-content is above a certain number of keypresses; and
* the width of the `textarea` is still narrower than the maximum allowed width

then the `textarea` can incrementally expand.

**Working Example:**

```js
var myTextArea = document.getElementsByTagName('textarea')[0];
var myTextLength = myTextArea.value.length
var myTextWidth = parseInt(window.getComputedStyle(myTextArea).width);
var myTextMinLength = 20;
var myTextMaxWidth = ((parseInt(window.getComputedStyle(document.body).width) / 100) * 80);

function checkTextLength() {
    myTextLength = myTextArea.value.length;

    if ((myTextLength > myTextMinLength) && (myTextWidth < (myTextMaxWidth))) {
            myTextWidth += 8;
        }

    myTextArea.style.width = myTextWidth + 'px';
}

myTextArea.addEventListener('keypress', checkTextLength, false);
```

```css
textarea {
width: 180px;
height: 40px;
}
```

```html
<form>
<textarea placeholder="Start typing..."></textarea>
</form>
```
hm... try this:

```
display: inline-block;

```

I am not sure tho. Let me know if it works.