Solucionado (ver solução)
Solucionado
(ver solução)
5
respostas

Erro função Baixar Provas.

Esta ocorrendo o seguinte erro: The application Agenda (process br.com.caelum.cadastro) has stopped unexpectedly. Please try again.

Quando executo o startActivity no case abaixo:

case R.id.receber_provas: Intent irParaProvas = new Intent(this,Provas.class); startActivity(irParaProvas); break;

Alguem já passou por isso?

5 respostas

Oi Haniel!

Você pode mandar a stacktrace que aparece no LogCat?

Além disso, mande o código da sua activity.

package br.com.caelum.cadastro;

import java.util.List;

import br.com.caelum.cadastro.adapter.ListaAlunosAdapter; import br.com.caelum.cadastro.dao.AlunoDAO; import br.com.caelum.cadastro.modelo.Aluno; import br.com.caelum.cadastro.task.EnviarAlunosTask; import android.app.Activity; import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.support.v4.app.FragmentActivity; import android.view.ContextMenu; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.MenuItem.OnMenuItemClickListener; import android.view.View; import android.view.ContextMenu.ContextMenuInfo; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.AdapterView.OnItemLongClickListener; import android.widget.ListView; import android.widget.Toast;

public class ListaAlunos extends Activity {

private Aluno aluno; private ListView lista;

@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.listagem_alunos);

lista = (ListView) findViewById(R.id.lista);

registerForContextMenu(lista);

lista.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapter, View view, int posicao, long id) { Aluno alunoClicado = (Aluno) adapter.getItemAtPosition(posicao);

Intent edicao = new Intent(ListaAlunos.this, Formulario.class);

Aluno alunoSelecionado = (Aluno) lista.getItemAtPosition(posicao);

edicao.putExtra(Extras.ALUNO_SELECIONADO, alunoSelecionado); startActivity(edicao); } });

lista.setOnItemLongClickListener(new OnItemLongClickListener() {

@Override public boolean onItemLongClick(AdapterView<?> adapter, View view, int posicao, long id) {

aluno = (Aluno) adapter.getItemAtPosition(posicao);

return false; } });

}

@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {

MenuItem ligar = menu.add("Ligar"); ligar.setOnMenuItemClickListener(new OnMenuItemClickListener() {

@Override public boolean onMenuItemClick(MenuItem item) { Intent irParaTelaDeDiscagem = new Intent(Intent.ACTION_CALL); Uri discarPara = Uri.parse("tel: " + aluno.getTelefone()); irParaTelaDeDiscagem.setData(discarPara);

startActivity(irParaTelaDeDiscagem); return false; } });

menu.add("Enviar SMS"); MenuItem site = menu.add("Navegar no site"); site.setOnMenuItemClickListener(new OnMenuItemClickListener() {

@Override public boolean onMenuItemClick(MenuItem item) { Intent irParaOSite = new Intent(Intent.ACTION_VIEW);

Uri localSite = Uri.parse("http://"+aluno.getSite()); irParaOSite.setData(localSite);

startActivity(irParaOSite);

return false; } });

MenuItem deletar = menu.add("Deletar"); deletar.setOnMenuItemClickListener(new OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem item) { AlunoDAO dao = new AlunoDAO(ListaAlunos.this);

dao.deletar(aluno); dao.close();

carregaLista();

return false; } });

menu.add("Ver mapa"); menu.add("Enviar email");

super.onCreateContextMenu(menu, v, menuInfo); }

@Override protected void onResume() { super.onResume();

carregaLista(); }

private void carregaLista(){ AlunoDAO dao = new AlunoDAO(this); List alunos = dao.getLista(); dao.close();

ListaAlunosAdapter adapter = new ListaAlunosAdapter(alunos, this);

lista.setAdapter(adapter); }

@Override public boolean onCreateOptionsMenu(Menu menu) {

MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.lista_alunos, menu);

return super.onCreateOptionsMenu(menu); }

@Override public boolean onOptionsItemSelected(MenuItem item) { int itemClicado = item.getItemId();

switch (itemClicado) {

case R.id.novo: Intent irParaFormulario = new Intent(this, Formulario.class);

startActivity(irParaFormulario); break;

case R.id.receber_provas: Intent irParaProvas = new Intent(this, Provas.class); startActivity(irParaProvas); break;

case R.id.enviar_alunos:

EnviarAlunosTask task = new EnviarAlunosTask(this); task.execute();

break;

default: break; }

return super.onOptionsItemSelected(item); }

}

??-?? ??:??:??.???: INFO/(): [ 10-14 14:48:31.765 2277: 2277 D/AndroidRuntime ] ??-?? ??:??:??.???: INFO/(): Shutting down VM ??-?? ??:??:??.???: INFO/(): [ 10-14 14:48:31.765 2277: 2277 W/dalvikvm ] ??-?? ??:??:??.???: INFO/(): threadid=1: thread exiting with uncaught exception (group=0xb2cfeb20) ??-?? ??:??:??.???: INFO/(): [ 10-14 14:48:31.765 1276: 1321 E/SoundPool ] ??-?? ??:??:??.???: INFO/(): error loading /system/media/audio/ui/Effect_Tick.ogg ??-?? ??:??:??.???: INFO/(): [ 10-14 14:48:31.765 1276: 1321 W/AudioService ] ??-?? ??:??:??.???: INFO/(): Soundpool could not load file: /system/media/audio/ui/Effect_Tick.ogg ??-?? ??:??:??.???: INFO/(): [ 10-14 14:48:31.765 1276: 1321 E/SoundPool ] ??-?? ??:??:??.???: INFO/(): error loading /system/media/audio/ui/Effect_Tick.ogg ??-?? ??:??:??.???: INFO/(): [ 10-14 14:48:31.765 1276: 1321 W/AudioService ] ??-?? ??:??:??.???: INFO/(): Soundpool could not load file: /system/media/audio/ui/Effect_Tick.ogg ??-?? ??:??:??.???: INFO/(): [ 10-14 14:48:31.765 1276: 1321 E/SoundPool ] ??-?? ??:??:??.???: INFO/(): error loading /system/media/audio/ui/Effect_Tick.ogg ??-?? ??:??:??.???: INFO/(): [ 10-14 14:48:31.765 1276: 1321 W/AudioService ] ??-?? ??:??:??.???: INFO/(): Soundpool could not load file: /system/media/audio/ui/Effect_Tick.ogg ??-?? ??:??:??.???: INFO/(): [ 10-14 14:48:31.765 1276: 1321 E/SoundPool ] ??-?? ??:??:??.???: INFO/(): error loading /system/media/audio/ui/Effect_Tick.ogg ??-?? ??:??:??.???: INFO/(): [ 10-14 14:48:31.765 1276: 1321 W/AudioService ] ??-?? ??:??:??.???: INFO/(): Soundpool could not load file: /system/media/audio/ui/Effect_Tick.ogg ??-?? ??:??:??.???: INFO/(): [ 10-14 14:48:31.765 1276: 1321 E/SoundPool ] ??-?? ??:??:??.???: INFO/(): error loading /system/media/audio/ui/Effect_Tick.ogg ??-?? ??:??:??.???: INFO/(): [ 10-14 14:48:31.765 1276: 1321 W/AudioService ] ??-?? ??:??:??.???: INFO/(): Soundpool could not load file: /system/media/audio/ui/Effect_Tick.ogg ??-?? ??:??:??.???: INFO/(): [ 10-14 14:48:31.765 1276: 1321 E/SoundPool ] ??-?? ??:??:??.???: INFO/(): error loading /system/media/audio/ui/KeypressStandard.ogg ??-?? ??:??:??.???: INFO/(): [ 10-14 14:48:31.765 1276: 1321 W/AudioService ] ??-?? ??:??:??.???: INFO/(): Soundpool could not load file: /system/media/audio/ui/KeypressStandard.ogg ??-?? ??:??:??.???: INFO/(): [ 10-14 14:48:31.765 1276: 1321 E/SoundPool ] ??-?? ??:??:??.???: INFO/(): error loading /system/media/audio/ui/KeypressSpacebar.ogg ??-?? ??:??:??.???: INFO/(): [ 10-14 14:48:31.765 1276: 1321 W/AudioService ] ??-?? ??:??:??.???: INFO/(): Soundpool could not load file: /system/media/audio/ui/KeypressSpacebar.ogg ??-?? ??:??:??.???: INFO/(): [ 10-14 14:48:31.765 1276: 1321 E/SoundPool ] ??-?? ??:??:??.???: INFO/(): error loading /system/media/audio/ui/KeypressDelete.ogg ??-?? ??:??:??.???: INFO/(): [ 10-14 14:48:31.765 1276: 1321 W/AudioService ] ??-?? ??:??:??.???: INFO/(): Soundpool could not load file: /system/media/audio/ui/KeypressDelete.ogg ??-?? ??:??:??.???: INFO/(): [ 10-14 14:48:31.765 1276: 1321 E/SoundPool ] ??-?? ??:??:??.???: INFO/(): error loading /system/media/audio/ui/KeypressReturn.ogg ??-?? ??:??:??.???: INFO/(): [ 10-14 14:48:31.765 1276: 1321 W/AudioService ] ??-?? ??:??:??.???: INFO/(): Soundpool could not load file: /system/media/audio/ui/KeypressReturn.ogg ??-?? ??:??:??.???: INFO/(): [ 10-14 14:48:31.765 1276: 1321 E/SoundPool ] ??-?? ??:??:??.???: INFO/(): error loading /system/media/audio/ui/KeypressInvalid.ogg ??-?? ??:??:??.???: INFO/(): [ 10-14 14:48:31.765 1276: 1321 W/AudioService ] ??-?? ??:??:??.???: INFO/(): Soundpool could not load file: /system/media/audio/ui/KeypressInvalid.ogg ??-?? ??:??:??.???: INFO/(): [ 10-14 14:48:31.765 1276: 1321 W/AudioService ] ??-?? ??:??:??.???: INFO/(): onLoadSoundEffects(), Error -1 while loading samples ??-?? ??:??:??.???: INFO/(): [ 10-14 14:48:31.765 1276: 1496 I/ActivityManager ] ??-?? ??:??:??.???: INFO/(): START u0 {cmp=br.com.caelum.cadastro/.Provas} from pid 2277 ??-?? ??:??:??.???: INFO/(): [ 10-14 14:48:31.765 2277: 2277 E/AndroidRuntime ] ??-?? ??:??:??.???: INFO/(): FATAL EXCEPTION: main ??-?? ??:??:??.???: INFO/(): Process: br.com.caelum.cadastro, PID: 2277 ??-?? ??:??:??.???: INFO/(): android.content.ActivityNotFoundException: Unable to find explicit activity class {br.com.caelum.cadastro/br.com.caelum.cadastro.Provas}; have you declared this activity in your AndroidManifest.xml? ??-?? ??:??:??.???: INFO/(): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1628) ??-?? ??:??:??.???: INFO/(): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1424) ??-?? ??:??:??.???: INFO/(): at android.app.Activity.startActivityForResult(Activity.java:3424) ??-?? ??:??:??.???: INFO/(): at android.app.Activity.startActivityForResult(Activity.java:3385) ??-?? ??:??:??.???: INFO/(): at android.app.Activity.startActivity(Activity.java:3627) ??-?? ??:??:??.???: INFO/(): at android.app.Activity.startActivity(Activity.java:3595) ??-?? ??:??:??.???: INFO/(): at br.com.caelum.cadastro.ListaAlunos.onOptionsItemSelected(ListaAlunos.java:171) ??-?? ??:??:??.???: INFO/(): at android.app.Activity.onMenuItemSelected(Activity.java:2600) ??-?? ??:??:??.???: INFO/(): at com.android.internal.policy.impl.PhoneWindow.onMenuItemSelected(PhoneWindow.java:1012) ??-?? ??:??:??.???: INFO/(): at com.android.internal.view.menu.MenuBuilder.dispatchMenuItemSelected(MenuBuilder.java:742) ??-?? ??:??:??.???: INFO/(): at com.android.internal.view.menu.SubMenuBuilder.dispatchMenuItemSelected(SubMenuBuilder.java:81) ??-?? ??:??:??.???: INFO/(): at com.android.internal.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:152) ??-?? ??:??:??.???: INFO/(): at com.android.internal.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:881) ??-?? ??:??:??.???: INFO/(): at com.android.internal.view.menu.MenuDialogHelper.onClick(MenuDialogHelper.java:167) ??-?? ??:??:??.???: INFO/(): at com.android.internal.app.AlertController$AlertParams$3.onItemClick(AlertController.java:941) ??-?? ??:??:??.???: INFO/(): at android.widget.AdapterView.performItemClick(AdapterView.java:299) ??-?? ??:??:??.???: INFO/(): at android.widget.AbsListView.performItemClick(AbsListView.java:1113) ??-?? ??:??:??.???: INFO/(): at android.widget.AbsListView$PerformClick.run(AbsListView.java:2904) ??-?? ??:??:??.???: INFO/(): at android.widget.AbsListView$3.run(AbsListView.java:3638) ??-?? ??:??:??.???: INFO/(): at android.os.Handler.handleCallback(Handler.java:733) ??-?? ??:??:??.???: INFO/(): at android.os.Handler.dispatchMessage(Handler.java:95) ??-?? ??:??:??.???: INFO/(): at android.os.Looper.loop(Looper.java:136) ??-?? ??:??:??.???: INFO/(): at android.app.ActivityThread.main(ActivityThread.java:5017) ??-?? ??:??:??.???: INFO/(): at java.lang.reflect.Method.invokeNative(Native Method) ??-?? ??:??:??.???: INFO/(): at java.lang.reflect.Method.invoke(Method.java:515) ??-?? ??:??:??.???: INFO/(): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779) ??-?? ??:??:??.???: INFO/(): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) ??-?? ??:??:??.???: INFO/(): at dalvik.system.NativeStart.main(Native Method) ??-?? ??:??:??.???: INFO/(): [ 10-14 14:48:31.775 938: 938 D/gralloc ] ??-?? ??:??:??.???: INFO/(): Registering a buffer in the process that created it. This may cause memory ordering problems. ??-?? ??:??:??.???: INFO/(): [ 10-14 14:48:31.775 938: 938 E/libEGL ] ??-?? ??:??:??.???: INFO/(): called unimplemented OpenGL ES API ??-?? ??:??:??.???: INFO/(): [ 10-14 14:48:31.775 938: 938 E/libEGL ] ??-?? ??:??:??.???: INFO/(): called unimplemented OpenGL ES API ??-?? ??:??:??.???: INFO/(): [ 10-14 14:48:31.775 938: 938 E/libEGL ] ??-?? ??:??:??.???: INFO/(): called unimplemented OpenGL ES API ??-?? ??:??:??.???: INFO/(): [ 10-14 14:48:31.775 938: 938 E/libEGL ] ??-?? ??:??:??.???: INFO/(): called unimplemented OpenGL ES API ??-?? ??:??:??.???: INFO/(): [ 10-14 14:48:31.775 938: 938 E/SurfaceFlinger ] ??-?? ??:??:??.???: INFO/(): glCheckFramebufferStatusOES error -825094010 ??-?? ??:??:??.???: INFO/(): [ 10-14 14:48:31.775 938: 938 E/SurfaceFlinger ] ??-?? ??:??:??.???: INFO/(): got GL_FRAMEBUFFER_COMPLETE_OES error while taking screenshot ??-?? ??:??:??.???: INFO/(): [ 10-14 14:48:31.775 938: 938 E/libEGL ] ??-?? ??:??:??.???: INFO/(): called unimplemented OpenGL ES API ??-?? ??:??:??.???: INFO/(): [ 10-14 14:48:31.775 938: 938 E/libEGL ] ??-?? ??:??:??.???: INFO/(): called unimplemented OpenGL ES API ??-?? ??:??:??.???: INFO/(): [ 10-14 14:48:31.775 1276: 1377 W/ActivityManager ] ??-?? ??:??:??.???: INFO/(): Force finishing activity br.com.caelum.cadastro/.ListaAlunos ??-?? ??:??:??.???: INFO/(): [ 10-14 14:48:31.775 1276: 1377 W/WindowManager ] ??-?? ??:??:??.???: INFO/(): Screenshot failure taking screenshot for (246x410) to layer 21015 ??-?? ??:??:??.???: INFO/(): [ 10-14 14:48:32.295 1276: 1291 W/ActivityManager ] ??-?? ??:??:??.???: INFO/(): Activity pause timeout for ActivityRecord{b3423db0 u0 br.com.caelum.cadastro/.ListaAlunos t6 f} ??-?? ??:??:??.???: INFO/(): [ 10-14 14:48:32.835 1276: 1291 I/ActivityManager ] ??-?? ??:??:??.???: INFO/(): Killing 1633:com.google.android.gms.ui/u0a7 (adj 15): empty #17

solução!

Francisco obrigado, descobri que não tinha registrado a activity no Manifest. Só vi quando colei o log pra você. Valeu.

Boa Haniel!