Showing posts with label EXAMPLES. Show all posts
Showing posts with label EXAMPLES. Show all posts

How to save image or file to server in multi-part using volley?

♠ Posted by ANDROID THIRST in ,
Uploading files or Images to the server is the main task that every developer have faced in their development process. Here I will show you the way by which you can save an image or a file to the server in multipart form data using Volley.


In this example, we will save an Image to the server in multipart using Volley.

Create a class named PhotoMultipartRequest.




Then called this class constructor from the activity from where you want to save the image.
here below I am sharing you the code of the activity from where I am calling the constructor.




Random password generator program in Java?

♠ Posted by ANDROID THIRST in

A simple program in Java that generates a random password combination of Character, Number, Special symbols.


Here is the code snippet to generate random password in java..........

package password.generater;

import java.util.Random;

/**
 *
 * @author dell
 */
public class PasswordGenerater {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        int length= 8;
        System.out.println(generatePswd(length));
        
        // TODO code application logic here
    }
    static char[] generatePswd(int len){
        System.out.println("Your Password ");
        String charsCaps="ABCDEFGHIJKLMNOPQRSTUVWXYZ"; 
        String Chars="abcdefghijklmnopqrstuvwxyz";
        String nums="0123456789";
        String symbols="!@#$%^&*()_+-=.,/';:?><~*/-+";
        String passSymbols=charsCaps + Chars + nums +symbols;
        Random rnd=new Random();
        char[] password=new char[len];
        int index=0;
        for(int i=0; i<<len;i++){
            password[i]=passSymbols.charAt(rnd.nextInt(passSymbols.length()));
        }
      return password;
        
    }
}
/>

If you have any doubt then comment below.......
HAPPY PROGRAMMING