Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • What is AQuery or Android Query ?

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 4.34k
    Comment on it

    Do you want to make your code easy ?


    Are you looking for library that have powerful HTTP requests ?


    Do you want to do lots of things in a single line ?
    etc etc.....


    There is only a single solution for all these problems i.e AQuery or Android Query. With this library you can use light weight Asynchronous tasks and manipulate your UI very efficiently. This is also called as Write less code/Do More and more....


    Download android-query-full.0.26.7.jar file.


    Example without using AQuery


    public void onCreate(Bundle savedInstanceState) {
    
        super.onCreate(savedInstanceState);
        setContentView(R.layout.test);             
    
         TextView nameView = (TextView) findViewById(R.id.name);     
           nameView.setText("Hello");        
    
        Button button = (Button) findViewById(R.id.button);
        button.setText("Click Me");
    
        button.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                button.setText("Hello World");   
            }
        }            
    
    }
    

    Example using AQuery

    private AQuery aq;
    public void onCreate(Bundle savedInstanceState) {
    
        super.onCreate(savedInstanceState);
        setContentView(R.layout.test);             
    
            aq = new AQuery(this);         
    
            aq.id(R.id.text).text("Hello");         
    
            aq.id(R.id.button).text("Click Me").clicked(this, "buttonClicked");
    
    }
    
    public void buttonClicked(View button){
    
            //update the text
            aq.id(R.id.text).text("Hello World");
    
    }
    

    you can also perform some asyncTask like this :

    public void asyncJson(){
    
            //perform a Google search in just a few lines of code
    
            String url = "http://www.google.com/uds/GnewsSearch?q=Obama&v=1.0";             
            aq.ajax(url, JSONObject.class, this, "jsonCallback");
    
    }
    
    public void jsonCallback(String url, JSONObject json, AjaxStatus status){
    
            if(json != null){               
                    //successful ajax call          
            }else{          
                    //ajax error
            }
    
    }
    

    You can also download bitmap and set on image view like this:

        public class MainActivity extends Activity {
        private AQuery aq;
        private ProgressDialog dialog;
        @Override
        protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        dialog = new ProgressDialog(this);
        dialog.setTitle("AQuery");
        dialog.setMessage("Downloading....Please wait !");
        dialog.setIndeterminate(false);
        dialog.setMax(100);
        dialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
        dialog.setCancelable(false);
        ImageOptions options = new ImageOptions();
        options.round = 10;
        aq = new AQuery(this);
        aq.id(R.id.imgAQuery).progress(dialog).image("http://www.evontech.com/templates/evonnew/images/logo_evontech.png",false,false);
        }
        }
    
    

    For More information follow this link :
    http://code.google.com/p/android-query/

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: