[RESOLVED] Crash on TextView.setText

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

[RESOLVED] Crash on TextView.setText

Postby patrick91 » Thu Jul 09, 2009 1:31 pm

Hi! I've a problem with a textview, when I set the text the activity crashes :(
here is my code:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2.  
  3.  
  4. public class ViewOdl extends Activity {
  5.  
  6.        
  7.  
  8.         @Override
  9.  
  10.     public void onCreate(Bundle icicle) {
  11.  
  12.         super.onCreate(icicle);
  13.  
  14.                
  15.  
  16.         TextView customer = (TextView) findViewById(R.id.odl_customer);
  17.  
  18.        
  19.  
  20.         String prova = new String("abcd");        
  21.  
  22.         customer.setText(prova);
  23.  
  24.        
  25.  
  26.         setContentView(R.layout.view_odl);        
  27.  
  28.         }
  29.  
  30.  
  31.  
  32. }
  33.  
  34.  
  35.  
  36.  
Parsed in 0.033 seconds, using GeSHi 1.0.8.4


and this is the layout:

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <?xml version="1.0" encoding="utf-8"?>
  2.  
  3. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  4.  
  5.    android:orientation="vertical"
  6.  
  7.    android:layout_width="fill_parent"
  8.  
  9.    android:layout_height="fill_parent">
  10.  
  11.         <ScrollView android:id="@+id/ScrollView01"
  12.  
  13.                                 android:layout_width="wrap_content"
  14.  
  15.                                 android:layout_height="wrap_content">
  16.  
  17.                 <TextView android:text="TextView01"
  18.  
  19.                                   android:id="@+id/odl_customer"
  20.  
  21.                                   android:layout_width="wrap_content"
  22.  
  23.                                   android:layout_height="wrap_content">
  24.  
  25.                 </TextView>
  26.  
  27.         </ScrollView>
  28.  
  29. </LinearLayout>
  30.  
  31.  
Parsed in 0.002 seconds, using GeSHi 1.0.8.4


thanks :D
Last edited by patrick91 on Thu Jul 09, 2009 3:07 pm, edited 1 time in total.
patrick91
Freshman
Freshman
 
Posts: 5
Joined: Thu Jul 02, 2009 8:58 am

Top

Postby patrick91 » Thu Jul 09, 2009 3:07 pm

resolved :D

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. public class ViewOdl extends Activity {
  2.  
  3.      
  4.  
  5.      @Override
  6.  
  7.     public void onCreate(Bundle icicle) {
  8.  
  9.         super.onCreate(icicle);
  10.  
  11.                
  12.  
  13.         setContentView(R.layout.view_odl);  
  14.  
  15.  
  16.  
  17.         TextView customer = (TextView) findViewById(R.id.odl_customer);
  18.  
  19.        
  20.  
  21.         String prova = new String("abcd");        
  22.  
  23.         customer.setText(prova);
  24.  
  25.        
  26.  
  27.              
  28.  
  29.      }
  30.  
  31.  
  32.  
  33. }
  34.  
  35.  
Parsed in 0.032 seconds, using GeSHi 1.0.8.4
patrick91
Freshman
Freshman
 
Posts: 5
Joined: Thu Jul 02, 2009 8:58 am

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: Yahoo [Bot] and 7 guests