i have the problem in MainActivit when open for fist or when open the MainActivity without click on listView in second Activity

OnItemClickListener(new OnItemClickListener() {
   @Override
   public void onItemClick(AdapterView<?> arg0, View arg1, int position, long arg3) {
    String bookName = lista.getItemAtPosition(position).toString();
    Log.d("bookName-->>>>>", bookName);
    bookDetailsIntent.putExtra("bookName", bookName);
    startActivity(bookDetailsIntent);
   }
  });
 }
}
 

if you copy code you can understand my problem!!!

when i start the MayActivity show error!!! don't want this error!!!
i have edit my code:

if (this.getIntent().getExtras() != null){    
            DataHelper dh = new DataHelper(this);  
            Intent intent = getIntent();  
              
            String valore = this.getIntent().getExtras().get("bookName").toString();  
            final Book book = dh.getBookDetails(valore);  
              
            nomeTextView.setText(book.getNome());  
            baseTextView.setText(book.getBase());  
            jpgTextView.setText(book.getJPG());  
        } 
if (this.getIntent().getExtras() != null){ 
   DataHelper dh = new DataHelper(this);
   Intent intent = getIntent();
   
   String valore = this.getIntent().getExtras().get("bookName").toString();
   final Book book = dh.getBookDetails(valore);
   
   nomeTextView.setText(book.getNome());
   baseTextView.setText(book.getBase());
   jpgTextView.setText(book.getJPG());
  }
 
with "if" i haven't problems!!! thank's 

Back  [1] [2] [3] 

Copyright © 2007-2012 www.chuibin.com Chuibin Copyright