• 一个简单的页面跳转



    代码
    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> 
  • 相关阅读:
    手机app数据的爬取之mitmproxy安装教程
    Scrapy库的安装(windows版)
    Cannot uninstall 'html5lib'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.
    HTTP 599: SSL certificate problem: unable to get local issuer certificate错误
    requests禁止重定向
    python多线程爬取-今日头条的街拍数据(附源码加思路注释)
    python爬虫-淘宝商品密码(图文教程附源码)
    20131214-HTML基础-第二十一天
    20131214-EditPlus快捷键-第二十一天
    20131209-数据库导入导出数据-sqlhelper-第十七天
  • 原文地址:https://www.cnblogs.com/gwazy/p/1918991.html
Copyright © 2020-2023  润新知