zoukankan      html  css  js  c++  java
  • 一个简单的页面跳转


    代码
    package demo.test;

    import android.app.Activity;
    import android.content.Intent;
    import android.os.Bundle;
    import android.view.View;
    import android.widget.Button;

    public class testmain extends Activity {
        
    /** Called when the activity is first created. */
        @Override
        
    public void onCreate(Bundle savedInstanceState) {
            
    super.onCreate(savedInstanceState);
            setContentView(R.layout.main);
            Button btn
    =(Button)findViewById(R.id.Button01); 
            
            btn.setOnClickListener(
    new  View.OnClickListener() { 
              
    public void onClick(View view) { 
               Intent intent
    =new Intent();
            intent.setClass(testmain.
    this,testchild.class);
            startActivity(intent);
            finish();
              } 
            });
            
            
            
           
        }
    }
    代码
    package demo.test;


    import android.app.Activity;
    import android.content.Intent;
    import android.os.Bundle;
    import android.view.View;
    import android.widget.Button;
    public class testchild extends Activity {
         
    /** Called when the activity is first created. */
        @Override
        
    public void onCreate(Bundle savedInstanceState) {
            
    super.onCreate(savedInstanceState);
            setContentView(R.layout.child2);
       Button btn
    =(Button)findViewById(R.id.Button01); 
            
            btn.setOnClickListener(
    new  View.OnClickListener() { 
              
    public void onClick(View view) { 
               Intent intent
    =new Intent();
            intent.setClass(testchild.
    this,testmain.class);
            startActivity(intent);
            finish();
              } 
            });
        }
    }
    代码
    <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
          package
    ="demo.test"
          android:versionCode
    ="1"
          android:versionName
    ="1.0">
        
    <application android:icon="@drawable/icon" android:label="@string/app_name">
            
    <activity android:name=".testmain"
                      android:label
    ="@string/app_name">
                
    <intent-filter>
                    
    <action android:name="android.intent.action.MAIN" />
                    
    <category android:name="android.intent.category.LAUNCHER" />
                
    </intent-filter>
            
    </activity>
       
    <activity android:name=".testchild"
                      android:label
    ="@string/app_name">
               
            
    </activity>
        
    </application>


    </manifest> 
  • 相关阅读:
    21天打造分布式爬虫-房天下全国658城市房源(十一)
    21天打造分布式爬虫-简书整站爬取(十)
    21天打造分布式爬虫-下载汽车之家图片(九)
    21天打造分布式爬虫-Crawl类爬取小程序社区(八)
    21天打造分布式爬虫-Spider类爬取糗事百科(七)
    21天打造分布式爬虫-Selenium爬取拉钩职位信息(六)
    21天打造分布式爬虫-多线程下载表情包(五)
    21天打造分布式爬虫-中国天气网和古诗文网实战(四)
    21天打造分布式爬虫-豆瓣电影和电影天堂实战(三)
    3.使用Selenium模拟浏览器抓取淘宝商品美食信息
  • 原文地址:https://www.cnblogs.com/gwazy/p/1918991.html
Copyright © 2011-2022 走看看