Re: [android-developers] Re: How to load more than one layout file for an activity

2010-05-16 Thread Mark Murphy
ThomasWrobel wrote:
> I'm also having trouble with this.
> I can get the View using the Inflator;
> 
> final View loginpage = factory.inflate(R.layout.loginpage, null);
> 
> and I can get an object from within it
> 
> final LinearLayout LoginForm =
> (LinearLayout)loginpage.findViewById(R.id.MainLoginPage);
> 
> But I cant seem to use this object in a Tab...
> 
> spec = tabHost.newTabSpec("LoginTab").setIndicator("Login",
> res.getDrawable(R.drawable.eye))
> .setContent(LoginForm.getId());
> 
> tabHost.addTab(spec);
> 
> Says the ID isn't recognised :-/
> 
> any ideas?

Delete ".getId()" from your setContent() call.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android Training...At Your Office: http://commonsware.com/training

-- 
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


[android-developers] Re: How to load more than one layout file for an activity

2010-05-16 Thread ThomasWrobel
I'm also having trouble with this.
I can get the View using the Inflator;

final View loginpage = factory.inflate(R.layout.loginpage, null);

and I can get an object from within it

final LinearLayout LoginForm =
(LinearLayout)loginpage.findViewById(R.id.MainLoginPage);

But I cant seem to use this object in a Tab...

spec = tabHost.newTabSpec("LoginTab").setIndicator("Login",
res.getDrawable(R.drawable.eye))
  .setContent(LoginForm.getId());

tabHost.addTab(spec);

Says the ID isn't recognised :-/

any ideas?



On Apr 29, 8:43 am, Vo Trung Liem  wrote:
> Hi,
>
> You can you LayoutInflater to for setting layout dialog.
> Here is example code:
>
> LayoutInflater factory = LayoutInflater.from(this);
> final View testview = factory.inflate(R.layou.new_layout, null);
> // process get all view your new layout
>
> your_dialog.setTitle("'');
> your_dialog.setView(testView);
>
> ...
>
>
>
>
>
> On Thu, Apr 29, 2010 at 2:26 PM, karteek22  wrote:
> > Hi,
> > How can we use more than one layout file.
> > I have implemented a cutom dialog.That means i have created an layout file
> > for dialog.
> > And one layout file for my activity.
> > But whatever the UI items in dialog layout ile if iam using them by
> > findViewById it is giving me null
>
> > I will explain indetails here
> > @Override
> >     public void onCreate(Bundle savedInstanceState) {
> >         super.onCreate(savedInstanceState);
> >         setContentView(R.layout.main);
> >         applicationContext=getApplicationContext();
>
> >      Dialog    folder=new Dialog(this);
> >             folder.setTitle("Creating folder");
> >             folder.setContentView(R.layout.create_folder);
> >           TextView tv=findViewById(R.id.folder_text); //Here folder_text is
> > in my second layoutfile ie in create_folder.xml
> >         //In the above statemet i got the null to tv variable.
> >         folder.show();
>
> >     }
>
> > Any suggestions please
>
> > Regards,
> > Karteek
>
> > --
> > 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 > cr...@googlegroups.com>
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en
>
> --
> 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 
> athttp://groups.google.com/group/android-developers?hl=en

-- 
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


[android-developers] Re: How to load more than one layout file for an activity

2010-04-29 Thread karteek
Thanks for your reply
Its working now.
But i have one button in Dialog i have set on Clicklistener to
button.
When i click on the button it is not responding. Can you give any
suggestion.


On Apr 29, 11:43 am, Vo Trung Liem  wrote:
> Hi,
>
> You can you LayoutInflater to for setting layout dialog.
> Here is example code:
>
> LayoutInflater factory = LayoutInflater.from(this);
> final View testview = factory.inflate(R.layou.new_layout, null);
> // process get all view your new layout
>
> your_dialog.setTitle("'');
> your_dialog.setView(testView);
>
> ...
>
>
>
>
>
> On Thu, Apr 29, 2010 at 2:26 PM, karteek22  wrote:
> > Hi,
> > How can we use more than one layout file.
> > I have implemented a cutom dialog.That means i have created an layout file
> > for dialog.
> > And one layout file for my activity.
> > But whatever the UI items in dialog layout ile if iam using them by
> > findViewById it is giving me null
>
> > I will explain indetails here
> > @Override
> >     public void onCreate(Bundle savedInstanceState) {
> >         super.onCreate(savedInstanceState);
> >         setContentView(R.layout.main);
> >         applicationContext=getApplicationContext();
>
> >      Dialog    folder=new Dialog(this);
> >             folder.setTitle("Creating folder");
> >             folder.setContentView(R.layout.create_folder);
> >           TextView tv=findViewById(R.id.folder_text); //Here folder_text is
> > in my second layoutfile ie in create_folder.xml
> >         //In the above statemet i got the null to tv variable.
> >         folder.show();
>
> >     }
>
> > Any suggestions please
>
> > Regards,
> > Karteek
>
> > --
> > 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 > cr...@googlegroups.com>
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en
>
> --
> 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 
> athttp://groups.google.com/group/android-developers?hl=en

-- 
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