Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4362: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4364: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4365: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4366: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
anddev.org • View topic - onItemClick View object to TextView Cast error

onItemClick View object to TextView Cast error

Put your problem here if it does not fit any of the other categories.

onItemClick View object to TextView Cast error

Postby Raskolnikov » Thu Jun 03, 2010 3:32 pm

I am trying to understand the onItemClick method a bit more. I created this simple test to try to get the jist but am having trouble.

I recieve an error: java.lang.ClassCastException

it happens at the line 8 when i try to cast the "view" object to a TextView. Is there other way to derive the text that is being displayed by the list of a particular item that is clicked?


Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. mContactList.setOnItemClickListener(new OnItemClickListener() {
  2.                 public void onItemClick(AdapterView<?> parent, View view, int position, long id) {      
  3.                         // When clicked, show a toast with the TextView text      
  4.                         //Toast.makeText(AddContactTest20.this, ((TextView) view).getText(), Toast.LENGTH_SHORT).show();
  5.                         TextView resultText = (TextView)findViewById(R.id.tvResult);
  6.                
  7.                         try {
  8.                                         resultText.setText(((TextView) view).getText().toString());
  9.                                 } catch (Exception e) {
  10.                                         Log.e("Line 57", e.getMessage()+" - "+e.getLocalizedMessage()+" - "+e.toString());
  11.                                 }
  12.                 }  
  13.         });
Parsed in 0.014 seconds, using GeSHi 1.0.8.4


I can provide more code if needed.

Ras
Raskolnikov
Junior Developer
Junior Developer
 
Posts: 11
Joined: Tue May 18, 2010 4:54 am

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 12 guests