Found the problem : I needed to call the findViewById() method on the dialog like this :
TextView tv = (TextView) d.findViewById(R.id.TextView01); and not like this : TextView tv = (TextView) findViewById(R.id.TextView01); Geoffrey. On 11 mar, 09:09, Chavepeyer Geoffrey <gchavepe...@gmail.com> wrote: > Nobody to help me ? > > On Mar 10, 11:30 am, Chavepeyer Geoffrey <gchavepe...@gmail.com> > wrote: > > > > > So, I've created a test case but still encounter the same problem: > > > package be.geoc.DialogTest; > > > import android.app.Activity; > > import android.app.Dialog; > > import android.os.Bundle; > > import android.view.View; > > import android.widget.Button; > > import android.widget.TextView; > > > public class Dialog_Test extends Activity { > > /** Called when the activity is first created. */ > > @Override > > public void onCreate(Bundle savedInstanceState) { > > super.onCreate(savedInstanceState); > > setContentView(R.layout.main); > > > Button b = (Button) findViewById(R.id.Button01); > > > b.setOnClickListener(new View.OnClickListener(){ > > > public void onClick(View arg0) { > > Dialog d = new Dialog(Dialog_Test.this); > > d.setContentView(R.layout.meeting_detail); > > > TextView tv = (TextView) > > findViewById(R.id.TextView01); > > System.out.println(tv); > > tv.setText("TEST"); > > > d.show(); > > > } > > > }); > > } > > > } > > > And the 2 xml layout files : > > main.xml : > > > <?xml version="1.0" encoding="utf-8"?> > > <LinearLayout xmlns:android="http://schemas.android.com/apk/res/ > > android" > > android:orientation="vertical" > > android:layout_width="fill_parent" > > android:layout_height="fill_parent" > > > > > <TextView > > android:layout_width="fill_parent" > > android:layout_height="wrap_content" > > android:text="@string/hello" android:id="@+id/TextView"/> > > <Button android:id="@+id/Button01" android:layout_width="wrap_content" > > android:layout_height="wrap_content" android:text="Ouvrir le dialog"></ > > Button> > > </LinearLayout> > > > and meeting_detail.xml : > > > <?xml version="1.0" encoding="utf-8"?> > > <LinearLayout xmlns:android="http://schemas.android.com/apk/res/ > > android" > > android:orientation="vertical" > > android:layout_width="fill_parent" > > android:layout_height="fill_parent" > > > > > > <TextView android:id="@+id/TextView01" > > android:layout_width="wrap_content" > > android:layout_height="wrap_content"></TextView> > > </LinearLayout> > > > Is anyone able to help me ? > > Thanks a lot !!! > > > Geoffrey --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~----------~----~----~----~------~----~------~--~---