Back to project page MproEntity.
The source code is released under:
GNU General Public License
If you think the Android project MproEntity listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.mpro.mprolabs; //from w w w . ja v a 2 s. c o m import java.util.ArrayList; import br.com.mpro3.utils.MproEntity; import br.com.mpro.mprolabs.model.Grupo; import br.com.mpro.mprolabs.model.Pessoa; import android.os.Bundle; import android.app.Activity; import android.view.View; import android.widget.EditText; import android.widget.TextView; public class MainActivity extends Activity { public TextView cods; public EditText codGrupo; public EditText text; public Grupo sessao = new Grupo(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); sessao.Nome = "Grupo tal " + Math.random() * 10; cods = (TextView) findViewById(R.id.textcods); text = (EditText) findViewById(R.id.editText1); codGrupo = (EditText) findViewById(R.id.editText2); Pessoa pp = new Pessoa(1.75, "14/11/1990", "Matheus", "de Barros Castello"); pp.Save(); ArrayList<Pessoa> ps = MproEntity.getAll(Pessoa.class); String out = ""; for(Pessoa p : ps) { out += "Nome: " + p.getNomeCompleto() + "\n"; out += "Idade: " + p.getIdade() + "\n"; out += "Altura: " + p.Altura + "\n"; out += "-----------------------------------------------\n"; } cods.setText(String.valueOf(pp.cod)); text.setText(out); } public void deletaTeste(View view) { Grupo filterObj = new Grupo(); filterObj.cod = Integer.parseInt(codGrupo.getText().toString()); ArrayList<Grupo> grupos = MproEntity.getWhere(filterObj); for(Grupo grupo : grupos) { grupo.Delete(); } } public void saveTeste(View view) { Pessoa pp = new Pessoa(1.75, "14/11/1990", "Matheus", "de Barros Castello"); sessao.Integrantes.add(pp); sessao.Save(); ArrayList<Pessoa> ps = MproEntity.getAll(Pessoa.class); String out = ""; for(Pessoa p : ps) { out += "Nome: " + p.getNomeCompleto() + "\n"; out += "Idade: " + p.getIdade() + "\n"; out += "Altura: " + p.Altura + "\n"; out += "-----------------------------------------------\n"; } cods.setText(String.valueOf(pp.cod)); text.setText(out); } }