i have an EditText in my InvoiceForm, that i wanna set per line a total of 40 characters, and when the user prompt these total, i need that automatically jumps, to the next line with a total of 40 also, and so on till 240 characters... or not necessary jumps to the next line, but store as another line with 40 characters at the total
And i need to save this text in my local database so i have the tables to my InvoiceForm tables with:
String createInvoice = "CREATE TABLE "
+ TB_INVOICE
+ "(ID_INVOICE INTEGER PRIMARY KEY AUTOINCREMENT, "
+ "COD_INVOICE TEXT PRIMARY KEY,"
+ "DES_CLIENT TEXT, "
+ "COD_CLIENT TEXT, "
+ "NUM_SERIE TEXT, "
+ "TXT_DESCRIPTION TEXT );"; <--
String createTextForm = "CREATE TABLE "
+ TB_TEXTINVOICE
+ "(ID_TXT_INVOICE INTEGER PRIMARY KEY, "
+ "COD_INVOICE TEXT PRIMARY KEY(SECONDARY KEY),"
+ " COD_LINE TEXT," <--
+ " LINE TEXT );"; <--
So, here is my code and my UI, to make my description more clear
And My Code:
Button botao_salvar = (Button) findViewById(R.id.btn_salvar);
botao_salvar.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
EditText Et_client = (EditText) findViewById(R.id.searchclient);
EditText Et_nserie = (EditText) findViewById(R.id.ET_nserie);
EditText Et_descrinota = (EditText) findViewById(R.id.ET_descrinota);
if (Et_client.getText() == null || Et_nserie.getText() == null || Et_descrinota.getText() == null) {
Toast.makeText(Formulario_Nota.this, "Voce não pode salvar um valor nulo, por favor insira dados nos campos", Toast.LENGTH_LONG).show();
return;
} else if (Et_client.getText().length() < 2 || Et_nserie.getText().length() < 2 || Et_descrinota.getText().length() < 2) {
Toast.makeText(Formulario_Nota.this, "Por favor insira dados completos. Sempre maior que 2 caracteres.", Toast.LENGTH_LONG).show();
return;
} else {
Nota notalist = nota_helper.pegaNotaDoFormulario();
Stara_DB NotaDao = new Stara_DB(Formulario_Nota.this);
notas = NotaDao.getListaNota();
NotaDao.insereNota(notalist);
Toast.makeText(Formulario_Nota.this, "Dados Salvos com sucesso", Toast.LENGTH_LONG).show();
NotaDao.close();
Intent continuar = new Intent(Formulario_Nota.this, Formulario_ItemNota.class);
finish();
startActivity(continuar);
return;
}
}
});
}
The user, dont needs to know about that, i will handle this intern in my app
My question is, how can i perform this insert, like how can i recogonize, which line i need to store in My DB, because MyBackend only accepts per line a total of 40 characters in the description text field,
What i know for know is the property android:maxLength"40"; or something like that, but how can i perform this specific insert case each line in my DB, i already have the contentValues and everything else, i just wanna know the "logic" to do that, or examples... thanks a lot