Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Who here can help me with Android development?

  • 08-12-2009 7:28pm
    #1
    Registered Users, Registered Users 2 Posts: 569 ✭✭✭


    Hi there,

    I'm doing an Android project (working in Eclipse) and need some help with views and other small things. Probably not very difficult for the pro's but I dont wanna write out the whole problem if there's no one here that knows Android well enough..

    Thanks let me know


Comments

  • Registered Users, Registered Users 2 Posts: 18,272 ✭✭✭✭Atomic Pineapple


    Bubba wrote: »
    Hi there,

    I'm doing an Android project (working in Eclipse) and need some help with views and other small things. Probably not very difficult for the pro's but I dont wanna write out the whole problem if there's no one here that knows Android well enough..

    Thanks let me know

    I done my final year project on Android, what are you specifically having trouble with?


  • Registered Users, Registered Users 2 Posts: 569 ✭✭✭Bubba


    draffodx wrote: »
    I done my final year project on Android, what are you specifically having trouble with?

    Ok great maybe you can help.
    By following the guide on this webpage i've created a view with 3 tabs.
    http://developer.android.com/guide/tutorials/views/hello-tabwidget.html

    So what I want to do next is to have a list of items on each tab, and then the item shall be clickable that will lead to another window.

    Can you help me out? What do i need to do in the layout file? Or do I need to create more .xml files?

    Thanks.


  • Registered Users, Registered Users 2 Posts: 18,272 ✭✭✭✭Atomic Pineapple


    You can add the items to the Tab in your java class file

    something like this.
    public View createTabContent(String tag)
                   {                                            
                        ArrayAdapter<String> adapter = new ArrayAdapter<String>(Main_screen.this,android.R.layout.simple_list_item_1,new String[]{"item4","item5","item6"});
                        ls2.setAdapter(adapter); 
                        return ls2;
                   }         
              });
    


  • Registered Users, Registered Users 2 Posts: 569 ✭✭✭Bubba


    Ok thanks for your help

    Just one thing, what is the variable 'ls2' that you have?

    Thanks.


  • Registered Users, Registered Users 2 Posts: 569 ✭✭✭Bubba


    Bubba wrote: »
    Ok thanks for your help

    Just one thing, what is the variable 'ls2' that you have?

    Thanks.

    never mind i guess thats ur listView sorry.


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 569 ✭✭✭Bubba


    Maybe you could help me out again as nothing is showing up in the tabs still....what have I done wrong or what do I have to do?

    This is my class...
    public class TabWidget extends TabActivity {
    	
    	ListView ls2;
    
    	/** Called when the activity is first created. */
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.main);
            
            TabHost mTabHost = getTabHost();
            
            mTabHost.addTab(mTabHost.newTabSpec("tab_test1").setIndicator("A-Z").setContent(R.id.textview1));
            mTabHost.addTab(mTabHost.newTabSpec("tab_test2").setIndicator("Cuisine").setContent(R.id.textview2));
            mTabHost.addTab(mTabHost.newTabSpec("tab_test2").setIndicator("Location").setContent(R.id.textview3));
            
            mTabHost.setCurrentTab(0);   
            createTabContent();
        }
        
        public View createTabContent(String tag)
        {
            ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1, RESTAURANTS);
            ls2.setAdapter(adapter);
            return ls2;        
        }
    

    One question....what is the paramater String tag you have in the createTabContent?

    I guess i'm doing wrong in the setAdapter(adapter) ?

    Thanks a million for your help please


  • Registered Users, Registered Users 2 Posts: 18,272 ✭✭✭✭Atomic Pineapple


    have a read of this thread, it should help

    http://www.anddev.org/how_to_create_tab_in_android-t1102.html

    thats old though so you should make yourself aware of the changes in new Android versions


Advertisement