Results 1 to 5 of 5
  1. #1
    RickM is offline Member
    Join Date
    Jan 2013
    Posts
    1
    Rep Power
    0

    Default [HELP] Linking buttons

    Hi all,

    First of all I would like to say that I'm new to this forum and to Java Eclipse aswell. For my exams I have to make a (simple) android application.
    I'l explain what I would like to have:

    I'm trying to have a button when I click on it I will go to another page (activity). I'm new to how all of this works so a simple explination would be appreciated.
    I've tried many internet searchs but this did not help,so I'm trying it here.

    Hope you can help me sort this out,If you need any more information feel free to ask.

    Thanks in advance,
    Rick

  2. #2
    PhQ's Avatar
    PhQ
    PhQ is offline Senior Member
    Join Date
    Mar 2010
    Location
    Lithuania
    Posts
    358
    Rep Power
    5

    Default Re: [HELP] Linking buttons

    I believe you can use the setContentView() function. I haven't made a lot of stuff on android.
    Have a look at this:
    Starting an Activity | Android Developers

    You will also need to set an OnClickListener for your button.
    View.OnClickListener | Android Developers

    I think that this was meant to be posted on Android .

    Based on the grammar, I would just like to point out that Java and Eclipse are two different things.
    Last edited by PhQ; 01-08-2013 at 07:21 PM.

  3. #3
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,240
    Rep Power
    19

    Default Re: [HELP] Linking buttons

    Quote Originally Posted by RickM View Post
    I have to make a (simple) android application.
    Moved from New to Java

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  4. #4
    tamilarasi is offline Member
    Join Date
    Nov 2012
    Location
    India
    Posts
    70
    Rep Power
    0

    Default Re: [HELP] Linking buttons

    Hi,

    I hope this will be help to u...


    Button Tbutun;
    public void onCreate(Bundle savedInstanceState) {
    setContentView(R.layout.main);

    Tbutun=(Button)findViewById(R.id.button1) //change the id as per yours

    Tbutun.setOnClickListener(new OnClickListener() {

    public void onClick(View v) {
    // TODO Auto-generated method stub

    Intent myIntent = new Intent(CurrentActivity.this, NextActivity.class);
    startActivity(myIntent);
    }
    });

    Thanks,

  5. #5
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,240
    Rep Power
    19

    Default Re: [HELP] Linking buttons

    tamilarasi, please go through the Guide For New Members and BB Code List - Java Programming Forum - Learn Java Programming and edit your post accordingly.

    Quote Originally Posted by tamilarasi View Post
    I hope this will be help to u...
    This is a programming forum, not SMS chat. Please spell words in full -- you not u

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. linking jframe
    By vinodpatole in forum NetBeans
    Replies: 4
    Last Post: 01-20-2012, 11:15 PM
  2. linking to a web page
    By Juuno in forum Advanced Java
    Replies: 7
    Last Post: 05-01-2009, 02:47 PM
  3. static linking
    By Nicholas Jordan in forum Advanced Java
    Replies: 35
    Last Post: 03-14-2009, 09:17 PM
  4. linking 2 Jframes
    By suhaib1thariq in forum New To Java
    Replies: 9
    Last Post: 02-13-2009, 01:30 AM
  5. Linking of exe files
    By archu2friends in forum JavaServer Pages (JSP) and JSTL
    Replies: 0
    Last Post: 02-06-2008, 06:08 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •