I'm currently working on a directory application on ANDROID.
it's my first time working on an mobile application.
While working for the app, I decided to add a map feature as well to locate buildings from the search result.
Instead of using google api, I'm trying to pinpoint the location on an image(map) I have.
since the image is really big as well. I want to zoom into the building when it's pinpointed.
Unfortunately, I don't know where to start.
The help will be really appreciated.
thank you.
Sincerely
Google offer the static map API for free.
You can download a dynamically configured bitmap from the web, store it on the filesystem or on memory, then get a drawable from it in order to set it to the ImageView.
You need to generate an url from your coordinates to load the data from the web using this url. Exemple for a 200x200 bitmap showing the eiffel Tower in Paris:
String latEiffelTower = "48.858235";
String lngEiffelTower = "2.294571";
String url = "http://maps.google.com/maps/api/staticmap?center=" + latEiffelTower + "," + lngEiffelTower + "&zoom=15&size=200x200&sensor=false"
StackOverflow already have some answer on how to download an image from the web in order to display it in an imageview: https://stackoverflow.com/search?q=imageview+url+%5Bandroid%5D
You can find here the documentation for the Google Static Maps API.
Related
I have a question about SDK Google maps in Android
I have a Autocomplete Place that works perfectly. When i write some text in the input, google show me locations, and when i click on any print coordinates.
Question:
Is there any way to know if those coordinates are in a polygon of a Google my maps kml file?
I tried:
KmlLayer(map,id for local file, context)
Documentation: https://developers.google.com/maps/documentation/android-sdk/utility/kml
The problem is that i need the local kml file on my local repository. I need to get KML file from URL with a map id (https://www.google.com/maps/d/u/0/viewer?mid=XXXXrsxRFHqpMEmYXXXXX)
That "mid", can change, since sometimes I will need to use another kml file with a different url.
Also, Autocomplete documentation: https://developers.google.com/maps/documentation/places/android-sdk/autocomplete
Thank you everyone.
Any help would be greatly appreciated! Thanks
I'm developing an app and one of the components involves the user recording where they have gone for the day. I use some NLP to identify the location, however it would be awesome if I could also after obtaining the location or any other string for that matter get an image from an external API. I've seen people use image urls to get images for their android app but, how can I get an image without a URL, kind of of like a google images search? If this isn't possible is there a way to get an image url?
You can use Google Images Api:
https://serpapi.com/images-results
Im currently using Google Drive REST API in order to create folder/files in my Drive.
However i would like to know how could i use the rest api to display an image from Drive in my app ? Is that even possible ?
iv = (ImageView) myFragmentView.findViewById(R.id.imageView1);
iv.setImageURI(Uri.parse("https://drive.google.com/uc?export=view&id={fileid}"));
This doesnt work i have nothing displayed on my screen.
I've not been able to figure out a way of doing this using the id or the URL...
However, if you are using the Google Script, you could try a solution similar to this:
var file = DriveApp.getFileById(fileId)
var base64CodedFile = Utilities.base64Encode(file.getBlob().getBytes());
and use that base64 variable to be sent to your app. With this format you will find a way of displaying your images (don't know Picasso, but Fresco library can do it easily...)
It is not an immediate solution, and requires to do somework in other platform that is not your Android app, but it works perfectly.
Hi I'm working on Google Places API, with Google Places Photo request I can get different images of a specific place. But I don't know how to display this image in a android device.
This is the request URL that I'm using to retrieve the image
https://maps.googleapis.com/maps/api/place/photo?maxwidth=400&photoreference=CoQBegAAAFg5U0y-iQEtUVMfqw4KpXYe60QwJC-wl59NZlcaxSQZNgAhGrjmUKD2NkXatfQF1QRap-PQCx3kMfsKQCcxtkZqQ&sensor=true&key=AddYourOwnKeyHere
Need some help on this..
https://github.com/koush/UrlImageViewHelper
include the library in your project.
and use the following code
UrlImageViewHelper.setUrlDrawable(imageView, "YOUR URL HERE");
its very simple
I've not been successful in searching for this answer, but basically, how can I find the image file name from a website that blocks saving of the images? Normally, the url source will have the image filename and it is easily searchable.
However, some sites lets you hover over the picture and it then zooms to a larger image. The source shows,
for example,
http://example.com/pictures.aspx?ImagePath=ABCDEFGHIJ1234567989KLMNOPQRST==.....
E.g.: A random long string of code, but no .jpg or .png indicating the file name. When right clicking to save, it shows the image is blocked.
How can I get the images using Android code?
Tks
If it's not allowing them to be taken from a website, then it probably shouldn't be taken. That being said, there are a couple of options if you are the owner of the website.
If they are in a database then you can get the url address of them. Also, right clicking anywhere on the page to "View source" should get you some sort of URL of the image.
This seems more of a web service implementation issue rather than anything andriod specific. Many websites have this feature where you are not meant to retrieve information from the url.
However there should be a corresponding supported web service interface for fetching the metadata of a particular resource. If this is not supported then it's meant to be blocked.
The other trial and error sort of way is to invoke a 3rd party API like oEmbed (or Embed.ly : http://embed.ly/) that would return the metadata of the resource for which you have the URL. These services cover a wide range of websites and their resources.
You can search around in their site or find similar such services that would get you this information. Embed.ly is more of a personal preference due to its exhaustive list of supported sites.