Sandesh Patil Sandesh Patil - 1 year ago 58
Java Question

was trying for intent class to swap to new page in android but its not going to next page


import android.os.Bundle;

import android.content.Intent;

import android.util.Log;

import android.view.Menu;

import android.view.View;

import android.widget.Button;

public class MainActivity extends AppCompatActivity {

Button btn;

protected void onCreate(Bundle savedInstanceState) {

btn = (Button) findViewById(;
btn.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
Intent i = new Intent(MainActivity.this, SecondPage.class);




private void startActivities(Intent i) {


Answer Source

Just replace MainActivity.this.startActivities(i); to startActivity(i);.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download