This quick start lets you get an end-to-end implementation up and running using the Android SDK in 10 minutes or less.
Prerequisites 1. Set up and configureYou need to complete some initial project set up and configuration. The quick start assumes you're using Android Studio as your IDE.
Create a new Empty Views Activity projectCreate a new app project and select Empty Views Activity from the list of templates. Give your app a name, update the package name to com.cloudinary.cloudinaryquickstart
, and select Java as your language.
Add the dependencies for the Cloudinary SDK, Glide modules, and navigation dependencies to your build.gradle.kts file in the app directory. You also need to set viewBinding
to true.
In the dependencies
section of your file, add the following:
In the Android
section of your file, add the following:
In your MainActivity class, add the import statements for the Cloudinary SDK and other modules:
Configure CloudinaryUpdate your MainActivity
class, defining your cloud name, creating an initCloudinary
method and initializing it in the onCreate
method.
In your resource directory, under layouts, open the activity_main.xml view in code view. Copy and paste the following code, replacing the existing contents of the file:
In the same directory, create a new file called content_main.xml and add the following XML code:
The above layouts define where to render the uploaded and transformed images in the view.
In AndroidManifest.xml, copy and paste the following code:
2. Upload an imageBefore adding your upload code:
drawable
resource folder.Now copy and paste the code below which:
uploadImage
method.Update MainActivity.java making sure to replace any variable placeholders:
3. Transform an imageCopy and paste the following code, which:
cld-sample-5
)Update MainActivity.java making sure to replace any variable placeholders:
4. Run your codeRun your app. You should see your two images, one being the Cloudinary logo that you uploaded and the other a transformed image for the public ID that you set.
View the completed codeYou can find the full code example for this on GitHub.
Next stepsTake a look at the Android sample project for a more comprehensive example using the Cloudinary Android SDK.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4