I want to set google mapView API key in my java code, not in xml
many answers in stackoverflow say this can be achieved by using "new MapView(Context, API string)
"
but there's no such a "MapView(Context, String)
" method
all four constructors for mapview are:
MapView(Context)
MapView(Context, AttributeSet)
MapView(Context, AttributeSet, int)
MapView(Context, GoogleMapOptions)
I'm using the latest Google Play services lib (r14), Google Map View v2
the reason I must set API key dynamiclly is that my company is worried about if the key is unavailable some day, the program will not be able to show the google map. so we write the key in a text file, and every time the program starts, it will read a new text file from server. So if the previous key is unavailable some day(for example, google stop the free key service and demand all customers to pay for a commercial key), we can change the text file in server and all our program will get the new key and runs fine.
any ideas? Thanks in advance.