Metzen83
05/11/13, 21:24:13
Os comento, estoy desarrollando un curso de programacion en android y se me hecha el tiempo encima, me quedan pocos dias para acabar el plazo y si no termino este ejercicio me quedo sin titulacion, por la que he pagado un paston encima, pero mi tutor pasa de mi, directamente tarda siglos en responder mis correos y asi no se puede...
dios no se a quien recurrir y vosotros sois mi ultima esperanza chicos !!!
el curso se basa en Titanium Apcelerator, y lo que tengo que hacer es esto:
Debes crear un bloc de notas que permita:
Listar las notas creadas; de no haber ninguna, la lista aparecerá vacía.
Mostrar un botón de “añadir nueva nota” que lanzará la ventana con el formulario de inserción.
Indicar el título y el cuerpo de texto para cada nota.
Almacenar las notas en SQLite. Los campos de la tabla serán: el identificador de nota, el título, el cuerpo del texto y la fecha de la nota.
Modificar las notas al seleccionarlas en el listado y que se actualicen en la base de datos.
Indicar el color de fondo de la nota al mostrarse en el listado.
tengo serios problemas sobre todo con la base de datos, os paso lo que tengo de momento, pido por favor ayuda, en serio, estoy desesperado !!!!
app.js
var db = Ti.Database.open('cuaderno_bitacora');
var query = 'CREATE TABLE IF NOT EXISTS notas (id_nota INTEGER PRIMARY KEY AUTOINCREMENT, nota TEXT, fecha DATETIME DEFAULT CURRENT_TIMESTAMP);';
db.execute(query);
db.close();
// LLAMAR NOTAS.JS
var tabGroup = Ti.UI.createTabGroup();
var win_notas = Ti.UI.createWindow({
url : '/notas.js'
});
var tab_notas = Ti.UI.createTab({
window : win_notas,
title : 'Cuaderno'
});
tabGroup.addTab(tab_notas);
tabGroup.open();
notas.js
var win = Titanium.UI.currentWindow;
win.title = 'Cuaderno';
win.backgroundColor = 'red';
var tabla = Titanium.UI.createTableView({
backgroundColor : '#999',
top : 0,
width : '100%',
height : '88%'
});
var button = Titanium.UI.createButton({
backgroundColor : '#336699',
title : 'Añadir Nueva Nota',
bottom : '1%',
width : '100%',
height : '10%',
borderRadius : '6',
borderWidth : '6',
borderColor : "black",
});
win.add(tabla);
win.add(button);
button.addEventListener('click', function(e) {
var form_win = Titanium.UI.createWindow({
title : 'Crear nueva nota',
width : '100%',
height : '100%',
backgroundColor : '#000',
opacity : 0.8
});
var view = Titanium.UI.createView({
width : '80%',
height : '80%',
backgroundColor : '#fff',
borderRAdius : 6,
borderWidth : 6,
borderColor : '#666'
});
var label = Titanium.UI.createLabel({
text : 'Introduce tu experiencia',
top : 16,
left : '6%',
color : '#000',
font : {
fontSize : 18
}
});
var textarea = Titanium.UI.createTextArea({
width : '92%',
top : 60,
bottom : 48
});
var guardar = Titanium.UI.createButton({
title : 'Guardar',
width : 160,
height : 32,
bottom : 16,
color : '#fff',
borderRadius : 6,
borderWidth : 6,
backgroundColor : '#336699'
});
function guardaNota(textarea, form_win) {
var db = Ti.Database.open('cuaderno_bitacora');
var query = 'INSERT INTO notas (nota) VALUES(?,?)';
db.execute(query, textarea.value);
var id_nota_current = db.lastInsertRowID;
db.close();
}
guardar.addEventListener('click', function(e) {
guardaNota(textarea, form_win);
});
function cargaNotas() {
var db = Ti.Database.open('cuaderno_bitacora');
var query = 'SELECT * FROM notas ORDER BY fecha DESC';
var res = db.execute(query);
var filas = [];
while (res.is.ValidRow()) {
var fecha_txt = res.fieldByName('fecha');
var nota_text = res.fieldByName('nota');
var fecha_label = Ti.UI.createLabel({
text : fecha_txt,
top : 8,
width : '90%',
height : 18,
color : '#000',
font : {
fontWeight : 'bold',
fontSize : 16
}
});
var nota_label = Ti.UI.createLabel({
text : nota_txt,
top : 24,
width : '90%',
height : 64,
color : '#333',
font : {
fontWeight : 'normal',
fontSize : 18
}
});
var nota_view = Ti.UI.createView({
width : '100%',
height : 88
});
nota_view.add(fecha_label);
nota_view.add(nota_label);
var fila_tabla = Ti.UI.createTableViewRow({
selectedColor : "black",
height : 88
});
fila_tabla.add(nota_view);
filas.push(fila_tabla);
res.next();
}
res.close();
db.close();
tabla.setData(filas);
}
view.add(label);
view.add(textarea);
view.add(guardar);
form_win.add(view);
form_win.open({
'modal' : true
});
});
cargaNotas();
asi mismo me piden otros contenidos optativos, pero que cuentan para la nota encima y son estos:
Compartir dicha nota en redes sociales.
Añadir más información del lugar mediante geolocalización inversa.
asi pues por favor, AYUDA !!!
dios no se a quien recurrir y vosotros sois mi ultima esperanza chicos !!!
el curso se basa en Titanium Apcelerator, y lo que tengo que hacer es esto:
Debes crear un bloc de notas que permita:
Listar las notas creadas; de no haber ninguna, la lista aparecerá vacía.
Mostrar un botón de “añadir nueva nota” que lanzará la ventana con el formulario de inserción.
Indicar el título y el cuerpo de texto para cada nota.
Almacenar las notas en SQLite. Los campos de la tabla serán: el identificador de nota, el título, el cuerpo del texto y la fecha de la nota.
Modificar las notas al seleccionarlas en el listado y que se actualicen en la base de datos.
Indicar el color de fondo de la nota al mostrarse en el listado.
tengo serios problemas sobre todo con la base de datos, os paso lo que tengo de momento, pido por favor ayuda, en serio, estoy desesperado !!!!
app.js
var db = Ti.Database.open('cuaderno_bitacora');
var query = 'CREATE TABLE IF NOT EXISTS notas (id_nota INTEGER PRIMARY KEY AUTOINCREMENT, nota TEXT, fecha DATETIME DEFAULT CURRENT_TIMESTAMP);';
db.execute(query);
db.close();
// LLAMAR NOTAS.JS
var tabGroup = Ti.UI.createTabGroup();
var win_notas = Ti.UI.createWindow({
url : '/notas.js'
});
var tab_notas = Ti.UI.createTab({
window : win_notas,
title : 'Cuaderno'
});
tabGroup.addTab(tab_notas);
tabGroup.open();
notas.js
var win = Titanium.UI.currentWindow;
win.title = 'Cuaderno';
win.backgroundColor = 'red';
var tabla = Titanium.UI.createTableView({
backgroundColor : '#999',
top : 0,
width : '100%',
height : '88%'
});
var button = Titanium.UI.createButton({
backgroundColor : '#336699',
title : 'Añadir Nueva Nota',
bottom : '1%',
width : '100%',
height : '10%',
borderRadius : '6',
borderWidth : '6',
borderColor : "black",
});
win.add(tabla);
win.add(button);
button.addEventListener('click', function(e) {
var form_win = Titanium.UI.createWindow({
title : 'Crear nueva nota',
width : '100%',
height : '100%',
backgroundColor : '#000',
opacity : 0.8
});
var view = Titanium.UI.createView({
width : '80%',
height : '80%',
backgroundColor : '#fff',
borderRAdius : 6,
borderWidth : 6,
borderColor : '#666'
});
var label = Titanium.UI.createLabel({
text : 'Introduce tu experiencia',
top : 16,
left : '6%',
color : '#000',
font : {
fontSize : 18
}
});
var textarea = Titanium.UI.createTextArea({
width : '92%',
top : 60,
bottom : 48
});
var guardar = Titanium.UI.createButton({
title : 'Guardar',
width : 160,
height : 32,
bottom : 16,
color : '#fff',
borderRadius : 6,
borderWidth : 6,
backgroundColor : '#336699'
});
function guardaNota(textarea, form_win) {
var db = Ti.Database.open('cuaderno_bitacora');
var query = 'INSERT INTO notas (nota) VALUES(?,?)';
db.execute(query, textarea.value);
var id_nota_current = db.lastInsertRowID;
db.close();
}
guardar.addEventListener('click', function(e) {
guardaNota(textarea, form_win);
});
function cargaNotas() {
var db = Ti.Database.open('cuaderno_bitacora');
var query = 'SELECT * FROM notas ORDER BY fecha DESC';
var res = db.execute(query);
var filas = [];
while (res.is.ValidRow()) {
var fecha_txt = res.fieldByName('fecha');
var nota_text = res.fieldByName('nota');
var fecha_label = Ti.UI.createLabel({
text : fecha_txt,
top : 8,
width : '90%',
height : 18,
color : '#000',
font : {
fontWeight : 'bold',
fontSize : 16
}
});
var nota_label = Ti.UI.createLabel({
text : nota_txt,
top : 24,
width : '90%',
height : 64,
color : '#333',
font : {
fontWeight : 'normal',
fontSize : 18
}
});
var nota_view = Ti.UI.createView({
width : '100%',
height : 88
});
nota_view.add(fecha_label);
nota_view.add(nota_label);
var fila_tabla = Ti.UI.createTableViewRow({
selectedColor : "black",
height : 88
});
fila_tabla.add(nota_view);
filas.push(fila_tabla);
res.next();
}
res.close();
db.close();
tabla.setData(filas);
}
view.add(label);
view.add(textarea);
view.add(guardar);
form_win.add(view);
form_win.open({
'modal' : true
});
});
cargaNotas();
asi mismo me piden otros contenidos optativos, pero que cuentan para la nota encima y son estos:
Compartir dicha nota en redes sociales.
Añadir más información del lugar mediante geolocalización inversa.
asi pues por favor, AYUDA !!!