POJO Class in Android

by Monday, June 16, 2014 0 comments
Introduction 
                         POJO (Plain Old Java Object), basically a class with attributes and it’s getters and setters. The name is used to emphasise that a given object is an ordinary Java Object, not a special object.

Why used in android?
                         POJO is mainly used to denote a Java object which does not follow any of the major Java object models, conventions, or frameworks. Mainly used in Restful API web-services.

Example 
Initialize : 
 public Test(String id, String name) {  
           this.name = name;
           this.id = id; 
      }  
Getter : 
 public String getName() {  
           return name;  
      }  
Setter : 
 public void setName(String name) {  
           this.name = name;  
      }  
Calling from Activity : 
 Test pojo = new Test("001" , "Kumar"};  


Unknown

Androider

Welcome to Android-Action Blog. I’m a normal guy, who is passionate about Mobile Coding. Here I am writing about Android. Happy learning

0 comments:

Post a Comment