Posts

Store and Retrieve Files with Amazon S3 Transfer Utility

Image
Amazon Simple Storage Service (Amazon S3) provides mobile developers with secure, durable, highly-scalable object storage. Amazon S3 is easy to use, with a simple web services interface to store and retrieve any amount of data from anywhere on the web. The AWS Mobile SDK allows you to consume the S3 service in your mobile application via the S3 Transfer Utility, which is replacing the S3 Transfer Manager as of AWS Mobile SDK for Android v 2.2.4. For information on migrating from the S3 Transfer Manger to the S3 Transfer Utility, see  Migrating from the Transfer Manager to the Transfer Utility  on the AWS Blog. The tutorial below explains how to integrate the S3 TransferUtility, a high-level utility for using S3 with your app. This tutorial assumes you have already created an S3 bucket. To create an S3 bucket, visit the  S3 AWS Console . Project Setup Prerequisites # You must complete all of the instructions on the  Set Up the SDK for Android  page before beginning thi

Set Up the AWS Mobile SDK for Android

Prerequisites # Before you can use the AWS Mobile SDK for Android, you will need the following: An  AWS Account Android 2.3.3 (API Level 10) or higher (for more information about the Android platform, see  Android Developers ) Android Studio  or  Android Development Tools for Eclipse After completing the prerequisites, you will need to do the following to get started: Get the AWS Mobile SDK for Android. Set permissions in your  AndroidManifest.xml  file. Obtain AWS credentials using Amazon Cognito. Step 1: Get the AWS Mobile SDK for Android There are three ways to get the AWS Mobile SDK for Android. Option 1: Using Gradle with Android Studio # If you are using Android Studio, add the  aws-android-sdk-core  dependency to your app/build.gradle  file, along with the dependencies for the individual services that your project will use, as shown below. dependencies { compile 'com.amazonaws:aws-android-sdk-core:2.2.+' compile 'com.

Some File Cruching Failed!

The basic fix to solve this problem is to just disable the cruncher by adding this line in the app's build.gradle file android { aaptOptions { cruncherEnabled = false } }

Right place to initialise Progress Dialogs

It is always easy to create a function in the Util class created which is being used in all other activities. But when progress dialog is created there is a little possibility that we might get an exception. BadTokenException This exception is mainly because the progress dialog is not initialise. So, to overcome this problem I will suggest a right place to initialise progress dialog. It should be initialised right above the code line where it is shown. void requestToServer(){        //Initialise progress dialog here        // show progress dialog here       onResponse(){              //dismiss progress dialog       } }

Passing Data from activity to fragment Android

While developing my application I came across a situation in which i had six fragments four on the same activity and two fragment on one fragment and each fragment is loading some data from the internet sending the Volley Request. It was creating there Volley Request in the same time. Ideally it should send only one. So, I wrote a code in which there is only one single request to server in the beginning. Next thing is to send the data in the form of list to the fragments. For that we have to go there where the object of the fragment is created and using that object we have to pass the data to the fragment in the form of arguments and arguments accept only Bundle, so we have to put our list in Bundle first. Important thing is that the bean or pojo of which our list is a type should be implementing Serializable. The code is like Bundle bundle= new Bundle(); FragmentTransaction fragmentTransactionHome=getSupportFragmentManager().beginTransaction(); UserHomeFragment userHomeFragme

Styling Bottom Navigation

Image
Styling Bottom Navigation Off the bat, the library provides considerable styling options. But after recent updates, there has been a lot more. Some of these additions include notification badges and coordinating behaviors. It also includes  on-scroll Quick Return pattern . Its all that one could ever want with the Bottom Navigation. This library is much more feature-rich than  what Android Design Support Library offers . So if you want more customization options and more control, you know what to use. Before we get to that, here’s a heads-up. We’ll be using and referencing a lot of colors. Normally, we reference colors in Android like this: ContextCompat.getColor(context, R.id.yourcolor); Now I’m no fan of writing such a lengthy line for fetching a simple color resource. So I’ll write a simple method that shortens what I have to type. private int fetchColor( @ColorRes int color) { return ContextCompat.getColor(this, color); } Great! From now on I don’t have