If you think the Android project jpdroid listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
Java Source Code
package br.com.rafael.pedidojpdroid;
//fromwww.java2s.comimport android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import br.com.rafael.jpdroid.core.Jpdroid;
import br.com.rafael.jpdroid.enums.ScriptPath;
import br.com.rafael.jpdroid.exceptions.JpdroidException;
import br.com.rafael.pedidojpdroid.entity.Cidade;
import br.com.rafael.pedidojpdroid.entity.Contato;
import br.com.rafael.pedidojpdroid.entity.Endereco;
import br.com.rafael.pedidojpdroid.entity.Estado;
import br.com.rafael.pedidojpdroid.entity.ItensPedido;
import br.com.rafael.pedidojpdroid.entity.Pedido;
import br.com.rafael.pedidojpdroid.entity.Pessoa;
import br.com.rafael.pedidojpdroid.entity.Produto;
publicclass PrincipalActivity extends Activity {
private Jpdroid dataBase;
@Override
protectedvoid onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_principal);
dataBase = Jpdroid.getInstance();
dataBase.setContext(this);
dataBase.setDatabaseVersion(12);
dataBase.addEntity(ItensPedido.class);
dataBase.addEntity(Cidade.class);
dataBase.addEntity(Estado.class);
dataBase.addEntity(Endereco.class);
dataBase.addEntity(Pessoa.class);
dataBase.addEntity(Contato.class);
dataBase.addEntity(Produto.class);
dataBase.addEntity(Pedido.class);
dataBase.open();
if(dataBase.isCreate()){
dataBase.importSqlScript(ScriptPath.Assets, "import.sql");
}
}
publicvoid onClickCadPessoa(View v) throws JpdroidException{
Intent i = new Intent(this,ListagemPessoaActivity.class);
startActivity(i);
}
publicvoid onClickCadProduto(View v){
Intent i = new Intent(this,ListagemProdutoActivity.class);
startActivity(i);
}
publicvoid onClickExportacoes(View v){
Intent i = new Intent(this,ExportacoesActivity.class);
startActivity(i);
}
publicvoid onClickImportacao(View v){
Intent i = new Intent(this,ImportacoesActivity.class);
startActivity(i);
}
publicvoid onClickCadPedido(View v){
Intent i = new Intent(this,ListagemPedidoActivity.class);
startActivity(i);
}
publicvoid onClickSobre(View v){
Intent i = new Intent(this,SobreActivity.class);
startActivity(i);
}
@Override
publicboolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.principal, menu);
return true;
}
}