why is (WebView) in brackets in android -




my background web design using js html , css writing simple apps - nothing professional. have recent had urge learn bit android development. came across below line. understand defining variable webview etc, don't understand why '(webview)', in brackets, used in statement.

webview browser;  browser=(webview)findviewbyid(r.id.webkit);  

i can imagine android haven't come across in js before. or info on can read on appreciated!

it type casting.

webview browser; 

in above line, declaring browser object of webview.

so can hold webview

so, in below line, setting type webview in order prevent error if findviewbyid(r.id.webkit); return otherwise

browser=(webview)findviewbyid(r.id.webkit); 

this java feature.

you can read more in oracle java documentation





wiki

Comments

Popular posts from this blog

Asterisk AGI Python Script to Dialplan does not work -

python - Read npy file directly from S3 StreamingBody -

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -