Buttons And Tabs


  1. Iguy29

    Iguy29 Member

    I am working on an app, and i have a strange problem. In my main class (Event) it extends tabactivity, because it needs to initialize the tabs. So in my 2nd class (buttonManager) i have the code for when the buttons are pressed that they will switch the view to the appropriate layout. The buttonManager still has the blurb of code:
    @Override
    public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.input);
    i tried removing the @Override, it doesn't work, and i tried moving the code to Event, but it doesn't work, because it extends tabactivity, not activity. I am wondering if it is a problem that my buttons aren't in the main one, or if there is any way for my main class to extend both activity and tab activity.
    Here is the code for buttonmanager, the class that handles the buttons if you are interested to see how it looks:
    Code (Text):
    package com.dev.ir.im;

    import android.app.Activity;
    import android.content.Intent;
    import android.os.Bundle;
    import android.view.View;
    import android.view.View.OnClickListener;

    public class buttonManager extends Activity implements OnClickListener {
        @Override
           public void onCreate(Bundle savedInstanceState) {
              super.onCreate(savedInstanceState);
              setContentView(R.layout.input);

              // Clicklistener setup
              View stretcher = findViewById(R.id.stretchbutton);
              stretcher.setOnClickListener(this);
              View yoga = findViewById(R.id.yogabutton);
              yoga.setOnClickListener(this);
              View arms = findViewById(R.id.armbutton);
              arms.setOnClickListener(this);
              View legs = findViewById(R.id.legworkouts);
              legs.setOnClickListener(this);
              View core = findViewById(R.id.corebutton);
              core.setOnClickListener(this);
              View other = findViewById(R.id.otherbutton);
              other.setOnClickListener(this);
              View timer = findViewById(R.id.timerbutton);
              timer.setOnClickListener(this);
           }
        public void onClick(View v) {
            switch (v.getId()) {
              case R.id.timerbutton:
                 onTimerClick();
                 break;
                 
              }
           }        
        public void onTimerClick() {
            Intent ti = new Intent(this, chrono.class);
            startActivity(ti);
            }
        }
    I know that all of the cases aren't coded in yet, but the one that is doesn't work, so i decided not to put anything else in yet until it's fixed.
    The chrono class just is the set view code.

    Advertisement
    :
Loading...

Share This Page