Git Product home page Git Product logo

androidrestapivolley's Introduction

###Volley For Android

  • Very simple and easy code to integrate the volley in your android project to make get post put request .Just copy my VolleyRequest.java class to make the request.

Step 1:

-Add this line into your gradle .

implementation 'com.android.volley:volley:1.1.0' 

Step 2:

-Add this permission into your manifest.

  <uses-permission android:name="android.permission.INTERNET" />

Step 3:

-Copy my VolleyRequest.java file into your project:

Step 4:

-Copy this code call request.

//initialize my class
    VolleyRequest vr = new VolleyRequest(MainActivity.this);
    
	//create JSONObject to send in the body of the post request.
            try{
                JSONObject js = new JSONObject();
                js.accumulate("email", "[email protected]");
                js.accumulate("password","www.Tashfik.me");
				
				//call request in the parameter add the json you created above  					//and in the Second parameter add the api URL.
                vr.VolleyPost(js.toString(),"www.tashfik.me/api/test/getrequest");
    
            }catch (Exception e){
    
            }
    
    		//Listener for response
            vr.setListener(new VolleyRequest.MyServerListener(){
    
    
                @Override
                public void onResponse(JSONObject response) {
    			//here you will get response
                    Toast.makeText(MainActivity.this, ""+response.toString(), Toast.LENGTH_SHORT).show();
    
                }
                @Override
                public void onError(String error) {
                    Toast.makeText(MainActivity.this, ""+error.toString(), Toast.LENGTH_SHORT).show();
                }
    
            });```



For more visit www.tashfik.me . thanks.

androidrestapivolley's People

Contributors

tasfiqulghani avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.