Can’t start activity by overriding onClick method

Spread the love
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  

I implemented View.OnClickListener on MainActivity class and used a switch case to catch the clicks.
`
public void onClick(View v) {
switch (v.getId()) {
case R.id.numbers:
Intent numbersIntent = new Intent(MainActivity.this, NumbersActivity.class);
startActivity(numbersIntent);
break;

case R.id.colors:
Intent colorsIntent = new Intent(MainActivity.this, ColorsActivity.class);
startActivity(colorsIntent);
break;

case R.id.family:
Intent familyIntent = new Intent(MainActivity.this, FamilyActivity.class);
startActivity(familyIntent);
break;

case R.id.phrases:
Intent phrasesIntent = new Intent(MainActivity.this, PhrasesActivity.class);
Log.v(“Phrases Clicked “, “here.”);
startActivity(phrasesIntent);
break;

default:
break;
}
}

`
But the activities are not starting. The only one that starts is the numbersActivity because I implemented functionality for that. But thats not necessary right? The other three activities should just display an empty activity screen but the clicks dont primpt anything.

X ITM Cloud News

Marisa

Leave a Reply

Next Post

Intermittent network timeout on Ubuntu 20.04 server

Wed Jul 1 , 2020
Spread the love          I’ve been having an intermittent network issue with my Ubuntu 20.04 LTS server. Theres a few symptoms that seem to be similar but slightly different so I’m not sure where to look exactly. Heres a list of the symptoms: Nginx web server seems to have a ‘start delay’ […]
X- ITM

Cloud Computing – Consultancy – Development – Hosting – APIs – Legacy Systems

X-ITM Technology helps our customers across the entire enterprise technology stack with differentiated industry solutions. We modernize IT, optimize data architectures, and make everything secure, scalable and orchestrated across public, private and hybrid clouds.

This image has an empty alt attribute; its file name is x-itmdc.jpg

The enterprise technology stack includes ITO; Cloud and Security Services; Applications and Industry IP; Data, Analytics and Engineering Services; and Advisory.

Watch an animation of  X-ITM‘s Enterprise Technology Stack

We combine years of experience running mission-critical systems with the latest digital innovations to deliver better business outcomes and new levels of performance, competitiveness and experiences for our customers and their stakeholders.

X-ITM invests in three key drivers of growth: People, Customers and Operational Execution.

The company’s global scale, talent and innovation platforms serve 6,000 private and public-sector clients in 70 countries.

X-ITM’s extensive partner network helps drive collaboration and leverage technology independence. The company has established more than 200 industry-leading global Partner Network relationships, including 15 strategic partners: Amazon Web Services, AT&T, Dell Technologies, Google Cloud, HCL, HP, HPE, IBM, Micro Focus, Microsoft, Oracle, PwC, SAP, ServiceNow and VMware

.

X ITM