title: Sqlite confused while using getter and setter to send SELECT query data
body: <p>Getting little confuse while using getter and setter on sqlite because I am new  to sqlite and I feel it very complicated. I have various datas in my database and I want to send these data to another class. How can I do that? I tried something like below but I am stuck I don't know what the another code would be? someone help me  please!!</p>
  
  <p><strong>Encap.java</strong></p>
  
  <pre><code>public class Encap {
  int _id;
  String _phoneno;
  String _Msg;
  int _year;
  int _month;
  int _day;
  int _hour;
  int _minute;
  
  public int get_id() {
      return _id;
  }
  
  public void set_id(int _id) {
      this._id = _id;
  }
  
  public String get_phoneno() {
      return _phoneno;
  }
  
  public void set_phoneno(String _phoneno) {
      this._phoneno = _phoneno;
  }
  
  public String get_Msg() {
      return _Msg;
  }
  
  public void set_Msg(String _Msg) {
      this._Msg = _Msg;
  }
  
  public int get_year() {
      return _year;
  }
  
  public void set_year(int _year) {
      this._year = _year;
  }
  
  public int get_month() {
      return _month;
  }
  
  public void set_month(int _month) {
      this._month = _month;
  }
  
  public int get_day() {
      return _day;
  }
  
  public void set_day(int _day) {
      this._day = _day;
  }
  
  public int get_hour() {
      return _hour;
  }
  
  public void set_hour(int _hour) {
      this._hour = _hour;
  }
  
  public int get_minute() {
      return _minute;
  }
  
  public void set_minute(int _minute) {
      this._minute = _minute;
  }
  
  }
  </code></pre>
  
  <p><strong>AppalaHelperAdapter.java</strong></p>
  
  <pre><code>  public List&lt;Encap&gt; getAll(){
      List&lt;Encap&gt; Encapli=new ArrayList&lt;Encap&gt;();
      try{
          SQLiteDatabase db=appalaHelper.getWritableDatabase();
          String[] columns={appalaHelper.UID,appalaHelper.PHONE_NUMBER,appalaHelper.MESSAGE,appalaHelper.YEAR,appalaHelper.MONTH,appalaHelper.DAY,appalaHelper.HOUR,appalaHelper.MINUTE};
          Cursor cursor=db.query(AppalaHelper.TABLE,columns,null,null,null,null,null);
          Encap encap=new Encap();
          while (cursor.moveToNext()){
              encap.set_id(cursor.getInt(cursor.getColumnIndex(appalaHelper.UID)));
              encap.set_phoneno(cursor.getString(cursor.getColumnIndex(appalaHelper.PHONE_NUMBER)));
              encap.set_Msg(cursor.getString(cursor.getColumnIndex(appalaHelper.MESSAGE)));
              encap.set_year(cursor.getInt(cursor.getColumnIndex(appalaHelper.YEAR)));
              encap.set_month(cursor.getInt(cursor.getColumnIndex(appalaHelper.MONTH)));
              encap.set_day(cursor.getInt(cursor.getColumnIndex(appalaHelper.DAY)));
              encap.set_hour(cursor.getInt(cursor.getColumnIndex(appalaHelper.HOUR)));
              encap.set_minute(cursor.getInt(cursor.getColumnIndex(appalaHelper.MINUTE)));
  
              Encapli.add(encap);
          }
      }catch (Exception ex){}
      return Encapli;
  }
  </code></pre>
  
  <p>Now, Is that above code correct? How do i call this from anotherClass?</p>
  
  <p><strong>Another.class //where  I need data from database</strong></p>
  
  <pre><code>//I dont know how the List&lt;Encap&gt; are called.
  //I only know to  call single values like String data=appalaHelperAdapter.getAll(); and use the return string data to other
  </code></pre>
  
  <p>Thanks in Advance </p>