Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 5 of 5

Thread: Activities.

  1. #1
    Member
    Join Date
    Sep 2011
    Posts
    83
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Activities.

    Hello, I'm trying to understand what exactly is happening in my code. Thanks in advance for replying, I'm pretty confused and need some help. I have read many things on the internet but i havnt found it to be much help.

    I have followed an Android tutorial which has created an app with tabs. The code im looking at in particular is this:

    intent = new Intent().setClass(this, AlbumsActivity.class);
    and
    setContent(intent);

    I have read that "setContent(Intent) is called to specify the Intent to open the appropriate Activity". I've also read that each activity is a different screen.

    When I click on a new tab what exactly am I doing, when I click on a tab everything remains except that the tab I click on stands out (as I clicked on it), so when I click on a tab what is actually happening, am I opening a different activity? If so by opening a different activity what is actually happening? I cant see how I am though because the Activity class which is supposably opening is pretty much blank, all it has in it is a TextView object, so how come the tabs still remain on the screen.

    Im confused on what it is to switch to a different Activity, all this time I thought that when you switch Activity, you switch screens, but that cant be seeing as the View objects remain on screen when changing activity :S.

    This is the tutorial I've been following: Tab Layout | Android Developers
    Last edited by TP-Oreilly; January 22nd, 2012 at 10:30 PM.


  2. #2
    Member
    Join Date
    Dec 2011
    Location
    United States
    Posts
    94
    My Mood
    Amused
    Thanks
    5
    Thanked 8 Times in 8 Posts

    Default Re: Activities.

    Not to put you down in any way but I think you must understand java before diving into Android development. After you get good with java, you will not have much problems understanding what Android code means - after all, all is based on Java. Wish you good luck. Why don't you select that code and paste it to google, perhaps someone has posted it somewhere!

  3. #3
    Member
    Join Date
    Sep 2011
    Posts
    83
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Activities.

    I do have an understanding of Java. It's concept of an Activity which is confusing me. Reading different things on the internet have made me confused.

  4. #4
    Member
    Join Date
    Sep 2011
    Posts
    83
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Activities.

    This is what made me think that each activity is a different window:

    "An activity is the equivalent of a Frame/Window in GUI toolkits. It takes up the entire drawable area of the screen"

  5. #5
    Member
    Join Date
    Sep 2011
    Posts
    83
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Activities.

    To answer my own question............ What I'm actually doing is setting the content of the tab as an Activity???

Similar Threads

  1. [SOLVED] Help me with different activities in Java program
    By xyldon27 in forum Java Theory & Questions
    Replies: 10
    Last Post: June 9th, 2009, 09:42 AM