tagore wrote:
> Today, I write some simple code to implement activity. See the
> following codes:
> public class TestLinearView extends Activity {
>         private EditText edit = null;
>     /** Called when the activity is first created. */
>     @Override
>     public void onCreate(Bundle icicle) {
>         super.onCreate(icicle);
> 
>         // Set activity content from layout view
>         setContentView(R.layout.relative_view);
> 
>         // change the edit text
>         edit = (EditText)findViewById(R.id.entry);
>         edit.setText("Mysdfsadfdsafdsf");
>     }
> }
> 
> However, the application crushed. After I debug into the app, I found
> that the edit was null.

It would appear that your res/layout/relative_view.xml file does not 
have a view with the id of "@+id/entry". I would have expected a 
compiler error, though, complaining that R.id.entry was not found. 
Perhaps your R.java file is out of sync with the contents of your res/ 
directory tree.

Try updating the timestamp on your res/layout/relative_view.xml file 
(e.g., touch res/layout/relative_view.xml in Linux) and recompile. Or, 
update res/layout/relative_view.xml to include an EditText element with 
an android:id of "@+id/entry", since it would appear it doesn't have one 
already.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com
The Busy Coder's Guide to Android Development -- coming in June 2008!

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to