Twitter Facebook Delicious Digg Stumbleupon Favorites More

Sunday, 12 November 2017

INTENT BASIC

FIRST PAGE CODE

package com.example.viraj.intent;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

public class MainActivity extends AppCompatActivity {

    @Override    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
Button button=(Button)findViewById(R.id.gotobutton);
button.setOnClickListener(new View.OnClickListener() {
    @Override    public void onClick(View view) {
        Intent intent=new Intent(getApplicationContext(),Secondpage.class);
        startActivity(intent);
    }
});
    }
}


SECONDPAGECODE

package com.example.viraj.intent;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

public class Secondpage extends AppCompatActivity {

    @Override    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_secondpage);
    }
}
Share:

0 comments:

Post a Comment

Search This Blog

Popular Posts

Pages

how to make crores from 1 lakh in stock markets in 1 year

how to make crores from 1 lakh in stock markets in 1 year

Blogger Tutorials

Blogger Templates

Sample Text

Copyright © ANDROID TUTORIAL CODE | Powered by Blogger
Design by SimpleWpThemes | Blogger Theme by NewBloggerThemes.com & Distributed By Protemplateslab