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 <[email protected]> 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 <[email protected]> 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 [email protected]
> > To unsubscribe from this group, send email to
> > [email protected]<android-developers%2Bunsubs
> > [email protected]>
> > 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 [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> 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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en