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
my buttons on the first page dont work
Page 1 of 15 Replies - 319 Views - Last Post: 05 February 2013 - 07:52 PM
Replies To: my buttons on the first page dont work
#2
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.
#3
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);
}
});
#4
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?
#5
Re: my buttons on the first page dont work
Posted 04 February 2013 - 12:59 PM
A bit more code would help
#6
Re: my buttons on the first page dont work
Posted 05 February 2013 - 07:52 PM
that is the first page of the code
when i run the app and click on any of the buttons on the first page nothing happens
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 codewhen i run the app and click on any of the buttons on the first page nothing happens
Page 1 of 1
|
|

New Topic/Question
Reply


MultiQuote







|