Thanks, but I have same error. New code is : public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); TextView tv = (TextView)this.findViewById(R.id.TextView01); setContentView(tv); tv.setText("Hello, Android\n"); }
Boh..... 2009/5/15 Robert <robert.li.ruim...@gmail.com> > You can try it to move setcontextview() to the first line in oncreate > function.good lock. > > Francesco Pace <paxa...@gmail.com>写道: > > >Thanks, but I have this error : > > > >ERROR/AndroidRuntime(1096): java.lang.RuntimeException: Unable to start > >activity > >ComponentInfo{com.cecco.android.hello/com.cecco.android.hello.HelloWorld}: > >java.lang.NullPointerException: println needs a message > > > >in my code : > > > >public void onCreate(Bundle savedInstanceState) { > > super.onCreate(savedInstanceState); > > > > TextView tv = (TextView)this.findViewById(R.id.TextView01); > > tv.setText("Hello, Android\n"); > > setContentView(tv); > > } > > > >But when I use this statement "TextView tv = new TextView(this) my > >application running correctly. > >My main.xml file is : > > > ><LinearLayout > > android:id="@+id/LinearLayout01" > > android:layout_width="fill_parent" > > android:layout_height="fill_parent" > > xmlns:android=" > http://schemas.android.com/apk/res/android > >"> > > <TextView > > android:text="TextView01" > > android:id="@+id/TextView01" > > android:layout_width="wrap_content" > > android:layout_height="wrap_content"> > > </TextView> > ></LinearLayout> > > > >and my R.java : > > > >public final class R { > > public static final class attr { > > } > > public static final class drawable { > > public static final int icon=0x7f020000; > > } > > public static final class id { > > public static final int LinearLayout01=0x7f050000; > > public static final int TextView01=0x7f050001; > > } > > public static final class layout { > > public static final int main=0x7f030000; > > } > > public static final class string { > > public static final int app_name=0x7f040001; > > public static final int hello=0x7f040000; > > } > > > >2009/5/15 iDeveloper <ideveloper...@gmail.com> > > > >> If you just want to print these on the activity, use a TextView and set > its > >> text to your sysouts > >> TextView tv = (TextView)findViewById... > >> tv.setText("Whatever you want to print"); > >> > >> > >> > >> > >> On 15-May-09, at 1:54 PM, Francesco Pace wrote: > >> > >> Hi, thanks. > >> But I want print these informations on my android application...... > There > >> is a particular UI? > >> > >> 2009/5/15 iDeveloper <ideveloper...@gmail.com> > >> > >>> You can use Log.d for printing debug statements to the LogCat and Log.e > >>> for error statements. > >>> > >>> > >>> > >>> > >>> On 15-May-09, at 1:25 PM, Francesco Pace wrote: > >>> > >>> Hi Mariano, thanks for your time. > >>> Example : > >>> > >>> ///// CODE APPLICATION > >>> *System.out.println("Hello"); > >>> foo1(); // Simple function > >>> System.out.println("World"); > >>> foo2(); // Simple function > >>> System.out.println("Today"); > >>> System.out.println("Yesterday");* > >>> > >>> I know that I can't use "System.out.println" on Android. > >>> > >>> ///// DISPLAY CONSOLE (NO WINDOW COMMAND LINE) > >>> *- Hello > >>> - World (after foo1()) > >>> - Today (after foo2()) > >>> - Yesterday* > >>> > >>> "adb -e logcat" display the output of the currently running emulator on > >>> window command line, I need to show "logs" on interface. > >>> Can you help me? Thanks for all. > >>> > >>> 2009/5/15 Mariano Kamp <mariano.k...@gmail.com> > >>> > >>>> Not sure if I understand you correctly. > >>>> You can run "adb -e logcat" on the command line to display the output > of > >>>> the currently running emulator. Is that what are looking for? > >>>> > >>>> > >>>> On Fri, May 15, 2009 at 9:32 AM, Francesco Pace <paxa...@gmail.com > >wrote: > >>>> > >>>>> Hi developers, > >>>>> I need a help. I need to display all Logcats Log on console of my > >>>>> emulator, as do it the simple program "Hello World". > >>>>> Can you help me? > >>>>> > >>>>> > >>>>> > >>>> > >>>> > >>>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> > >> > >> > >> > >> > >> > >> > > >> > > > >> > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---