Está dando o erro nesta parte, quando tento colocar os valores do arraylist na tela.
fnome.setText(listStockProf.get(numero).getNome());
fidade.setText(listStockProf.get(numero).getIdade());
fprof.setText(listStockProf.get(numero).getProf());
O que pode estar acontecendo?
Segue o código completo e em seguida o erro.
[code]
void CarregaListaPessoas() {
receber recebe = new receber();
listStockProf = (ArrayList<stockProf>) recebe.receberSocket();
numreg = listStockProf.size()-1;
numero = 0;
Log.i("Teste", " " + numreg);
if(numreg==0) {
Toast mostrar = Toast.makeText(getApplicationContext(), "Nenhum registro cadastrado", Toast.LENGTH_LONG);
mostrar.show();
CarregaTelaPrincipal();
return;
}
setContentView(R.layout.listacadastrados);
Log.i("Teste", " "+ numero);
TextView fnome = (TextView)findViewById(R.field.nome);
TextView fidade = (TextView)findViewById(R.field.idade);
TextView fprof = (TextView)findViewById(R.field.profissao);
Button btanterior = (Button) findViewById(R.lista.btanterior);
Button btproximo = (Button) findViewById(R.lista.btproximo);
Button btvoltar = (Button) findViewById(R.lista.btvoltar);
Log.i("Teste10",listStockProf.get(numero).getNome());
fnome.setText(listStockProf.get(numero).getNome());
fidade.setText(listStockProf.get(numero).getIdade());
fprof.setText(listStockProf.get(numero).getProf());
btvoltar.setOnClickListener(new View.OnClickListener(){
public void onClick(View arg0){
CarregaTelaPrincipal();
}
});
Log.i("Teste", " 4");
btanterior.setOnClickListener(new View.OnClickListener(){
public void onClick(View arg0){
if(numero != 0)
numero= numero - 1;
TextView fnome = (TextView)findViewById(R.field.nome);
TextView fidade = (TextView)findViewById(R.field.idade);
TextView fprof = (TextView)findViewById(R.field.profissao);
fnome.setText(listStockProf.get(numero).getNome());
fidade.setText(listStockProf.get(numero).getIdade());
fprof.setText(listStockProf.get(numero).getProf());
}
});
Log.i("Teste", " 5");
btproximo.setOnClickListener(new View.OnClickListener(){
public void onClick(View arg0){
if(numero < listStockProf.size()-1)
numero = numero + 1;
TextView fnome = (TextView)findViewById(R.field.nome);
TextView fidade = (TextView)findViewById(R.field.idade);
TextView fprof = (TextView)findViewById(R.field.profissao);
fnome.setText(listStockProf.get(numero).getNome());
fidade.setText(listStockProf.get(numero).getIdade());
fprof.setText(listStockProf.get(numero).getProf());
}
});
}
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
CarregaTelaPrincipal();
}
}[/code]
11-30 15:57:53.241: I/Teste(415): 5
11-30 15:57:53.291: I/Teste(415): 0
11-30 15:57:53.291: I/Teste10(415): Leandro
11-30 15:57:53.291: W/ResourceType(415): No package identifier when getting value for resource number 0x00000016
11-30 15:57:53.301: D/AndroidRuntime(415): Shutting down VM
11-30 15:57:53.301: W/dalvikvm(415): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
11-30 15:57:53.311: E/AndroidRuntime(415): FATAL EXCEPTION: main
11-30 15:57:53.311: E/AndroidRuntime(415): android.content.res.Resources$NotFoundException: String resource ID #0x16
11-30 15:57:53.311: E/AndroidRuntime(415): at android.content.res.Resources.getText(Resources.java:201)
11-30 15:57:53.311: E/AndroidRuntime(415): at android.widget.TextView.setText(TextView.java:2817)
11-30 15:57:53.311: E/AndroidRuntime(415): at com.android.appcadastro.AppCadastro.CarregaListaPessoas(AppCadastro.java:105)
11-30 15:57:53.311: E/AndroidRuntime(415): at com.android.appcadastro.AppCadastro$2.onClick(AppCadastro.java:32)
11-30 15:57:53.311: E/AndroidRuntime(415): at android.view.View.performClick(View.java:2408)
11-30 15:57:53.311: E/AndroidRuntime(415): at android.view.View$PerformClick.run(View.java:8816)
11-30 15:57:53.311: E/AndroidRuntime(415): at android.os.Handler.handleCallback(Handler.java:587)
11-30 15:57:53.311: E/AndroidRuntime(415): at android.os.Handler.dispatchMessage(Handler.java:92)
11-30 15:57:53.311: E/AndroidRuntime(415): at android.os.Looper.loop(Looper.java:123)
11-30 15:57:53.311: E/AndroidRuntime(415): at android.app.ActivityThread.main(ActivityThread.java:4627)
11-30 15:57:53.311: E/AndroidRuntime(415): at java.lang.reflect.Method.invokeNative(Native Method)
11-30 15:57:53.311: E/AndroidRuntime(415): at java.lang.reflect.Method.invoke(Method.java:521)
11-30 15:57:53.311: E/AndroidRuntime(415): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
11-30 15:57:53.311: E/AndroidRuntime(415): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
11-30 15:57:53.311: E/AndroidRuntime(415): at dalvik.system.NativeStart.main(Native Method)
11-30 16:02:53.341: I/Process(415): Sending signal. PID: 415 SIG: 9
Agradeço a ajuda de todos