• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Buttons problems...

sunde

Lurker
Aug 13, 2012
6
0
Hello

i have made a own app but

when i press on the buttons it dont go to the activity but

if i press the buttons in one order it goes perfectly what is wrong?

i wanna press with button i want and not in one spec order to work

can someone help me with an answer how i should write so it could work with any button directly.

Cincearly

sunde
 
If you're changing your buttons' onClickListeners at runtime using setOnClickListener, make sure you generate your intent and start your activity intent for each onClickListener for each button you want to have enabled.

If you are changing the state/action of other buttons with each button press, you may have to call nested onClickListeners as you set up what the different buttons do under each condition...but it gives me a headache just thinking about that.
 
Upvote 0
Button bomoss = (Button) findViewById (R.id.omoss);
bomoss.setVisibility(View.VISIBLE);
bomoss.setBackgroundColor(Color.TRANSPARENT);
bomoss.setOnClickListener(new View.OnClickListener() {

@Override
public void onClick(View v) {
// TODO Auto-generated method stub
startActivity(new Intent("x.x.x.OMOSS"));

Button bhittaoss = (Button) findViewById (R.id.hittaoss);
bhittaoss.setVisibility(View.VISIBLE);
bhittaoss.setBackgroundColor(Color.TRANSPARENT);
bhittaoss.setOnClickListener(new View.OnClickListener() {

@Override
public void onClick(View v) {
// TODO Auto-generated method stub
startActivity(new Intent("x.x.x.HITTAOSS"));

Button bkontaktaoss = (Button) findViewById (R.id.kontaktaoss);
bkontaktaoss.setVisibility(View.VISIBLE);
bkontaktaoss.setBackgroundColor(Color.TRANSPARENT);
bkontaktaoss.setOnClickListener(new View.OnClickListener() {

@Override
public void onClick(View v) {
// TODO Auto-generated method stub
startActivity(new Intent("x.x.x.KONTAKTAOSS"));
 
Upvote 0
Hello

i have made a own app but

when i press on the buttons it dont go to the activity but

if i press the buttons in one order it goes perfectly what is wrong?

i wanna press with button i want and not in one spec order to work

can someone help me with an answer how i should write so it could work with any button directly.

Cincearly

sunde

You have three buttons in the code that you pasted. Clicking on each of them should launch an activity.

By special order do you mean something like you need to press button one then button two, then button three for your app to launch an activity?
 
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones