5 Replies - 781 Views - Last Post: 05 February 2013 - 07:52 PM

#1 ajrodelo  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 23
  • Joined: 14-January 13

my buttons on the first page dont work

Posted 02 February 2013 - 02:19 AM

all my buttons worked then when i added more pages and buttons the first to dont work any more they dont do anything at all can some one help me out would i have to put the code from all the pages or just the first page
Is This A Good Question/Topic? 0
  • +

Replies To: my buttons on the first page dont work

#2 H3R3T1C  Icon User is offline

  • Android Expert
  • member icon

Reputation: 276
  • View blog
  • Posts: 757
  • Joined: 30-March 07

Re: my buttons on the first page dont work

Posted 02 February 2013 - 12:43 PM

Please post your code for the part that is not working.
Was This Post Helpful? 0
  • +
  • -

#3 ajrodelo  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 23
  • Joined: 14-January 13

Re: my buttons on the first page dont work

Posted 02 February 2013 - 05:05 PM

        Button b1=(Button)findViewById(R.id.Button01);
	    Button b2=(Button)findViewById(R.id.Button02);
	      
	      b1.setonclickListener(new View.onclickListener() {

	        public void onclick(View v) {
	            Intent myintent = new Intent(MainActivity.this, Page1.class);
	            startActivity(myintent);

	        }
	    });
	      b2.setonclickListener(new View.onclickListener() {

		        public void onclick(View v) {
		            Intent myintent1 = new Intent(MainActivity.this, Page2.class);
		            startActivity(myintent1);

		        }
		    });

Was This Post Helpful? 0
  • +
  • -

#4 macosxnerd101  Icon User is offline

  • Self-Trained Economist
  • member icon




Reputation: 10462
  • View blog
  • Posts: 38,773
  • Joined: 27-December 08

Re: my buttons on the first page dont work

Posted 02 February 2013 - 11:34 PM

These aren't working how so? Please be specific?
Was This Post Helpful? 0
  • +
  • -

#5 knuapps  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 04-February 13

Re: my buttons on the first page dont work

Posted 04 February 2013 - 12:59 PM

A bit more code would help
Was This Post Helpful? 0
  • +
  • -

#6 ajrodelo  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 23
  • Joined: 14-January 13

Re: my buttons on the first page dont work

Posted 05 February 2013 - 07:52 PM

that is the first page of the code
package com.example.comeon;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Typeface;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

public class MainActivity extends Activity {

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Typeface font = Typeface.createFromAsset(getAssets(), "Fonts/Cabin.ttf");
        TextView tv=(TextView) findViewById(R.id.df);
        tv.setTypeface(font);
        Button b1=(Button)findViewById(R.id.Button01);
	    Button b2=(Button)findViewById(R.id.Button02);
	      
	      b1.setonclickListener(new View.onclickListener() {

	        public void onclick(View v) {
	            Intent myintent = new Intent(MainActivity.this, Page1.class);
	            startActivity(myintent);

	        }
	    });
	      b2.setonclickListener(new View.onclickListener() {

		        public void onclick(View v) {
		            Intent myintent1 = new Intent(MainActivity.this, Page2.class);
		            startActivity(myintent1);

		        }
		    });
    	}
		public void onclick(View v) {
			// TODO Auto-generated method stub
		}	
		
		}

package com.example.comeon;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Typeface;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

public class Page1 extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.page1);
        Typeface font = Typeface.createFromAsset(getAssets(), "Fonts/Cabin.ttf");
        TextView tv=(TextView) findViewById(R.id.df);
        tv.setTypeface(font);
        Button b4=(Button)findViewById(R.id.button3);
        Button b5=(Button)findViewById(R.id.button4);
        Button b6=(Button)findViewById(R.id.button5);
        Button b7=(Button)findViewById(R.id.button6);
        b4.setonclickListener(new View.onclickListener() {

	        public void onclick(View v) {
	            Intent myintent4 = new Intent(Page1.this, DACrips.class);
	            startActivity(myintent4);

	        }
	    });
        b5.setonclickListener(new View.onclickListener() {

	        public void onclick(View v) {
	            Intent myintent5 = new Intent(Page1.this, Mung.class);
	            startActivity(myintent5);

	        }
	    });
        b6.setonclickListener(new View.onclickListener() {

	        public void onclick(View v) {
	            Intent myintent6 = new Intent(Page1.this, MS13.class);
	            startActivity(myintent6);

	        }
	    });
        b7.setonclickListener(new View.onclickListener() {

	        public void onclick(View v) {
	            Intent myintent = new Intent(Page1.this, MainActivity.class);
	            startActivity(myintent);

	        }
	    });
        
        
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.page1, menu);
		return true;
	}

}

that is the second page of the code

when i run the app and click on any of the buttons on the first page nothing happens
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1