1
At this link teaches to list comments (in my case news) using external database (has the project download).
How can I delete a news item when selecting, and still cause a dialog to appear asking if I want to delete the news from the external database?
This is the code of INSERT
:
public void chamaCadastrarNoticia(){
setContentView(R.layout.cadastrar_noticia);
editTituloNoticia=(EditText) findViewById(R.id.editTituloNoticia);
editNoticia=(EditText) findViewById(R.id.editNoticia);
btCadastrarNoticia=(Button) findViewById(R.id.btCadastrarNoticia);
btCadastrarNoticia.setOnClickListener(new View.OnClickListener() {
public void onClick(View arg0) {
String vazios = "";
if (editTituloNoticia.getText().toString().equals(""))
vazios="Campo Titulo não pode estar vazio\n\n";
if (editNoticia.getText().toString().equals(""))
vazios="Campo Noticia não pode estar vazio\n\n";
if (editTituloNoticia.getText().toString().equals("") || editNoticia.getText().toString().equals(""))
mensagemExibir("Erro:", ""+vazios);
else {
String urlPost="#url"; // URL
String urlGet="#url ?titulo="+editTituloNoticia.getText().toString()+"noticia="+editNoticia.getText().toString(); // URL
ArrayList<NameValuePair> iparametrosPost = new ArrayList<NameValuePair>();
iparametrosPost.add(new BasicNameValuePair("titulo",editTituloNoticia.getText().toString()));
iparametrosPost.add(new BasicNameValuePair("noticia",editNoticia.getText().toString()));
String respostaRetornada = null;
try {
respostaRetornada = ConexaoHttpClient.executaHttpPost(urlPost, iparametrosPost);
String resposta = respostaRetornada.toString();
resposta = resposta.replaceAll("\\s+", "");
if (resposta.equals("1")) {
mensagemExibir("Cadastrado:", "Acesse Listar Noticias para ver a noticia cadastrada");
}
chamaIndexAdmin();
}
catch(Exception erro){
Log.i("erro", "erro = "+erro);
mensagemExibir("Erro", "Erro ao gravar: "+erro);
}
}
}
});
}
you’ve already managed to do the
INSERT
?– Math
yes, I want to use this project to list news (it worked out) but I can’t implement to delete them
– jhonjhon
has how you show me how to delete from the database, using this project you’ve got to download
– jhonjhon
I don’t think I’ll need to download; your question is a little wide, but if you have already managed to do the delete Insert is mt similar, could you show us how you do the Insert? edit your question to enter the code
– Math
I did not do the Insert using the project there, I made a mix, porderia do separate but I need to urgently solve this problem, when I downloaded the project, I managed to list there I joined the code with my old project
– jhonjhon
There’s the guy who says he can use onItemClick for future modifications but he doesn’t teach to delete =(
– jhonjhon
pera minto, I made the INSERT in my project, I will send
– jhonjhon
@Math looks at her in question the INSERT code
– jhonjhon
the code is totally different, do not use JSON in the code of the Insert
– jhonjhon
personal help =(
– jhonjhon