Android学习笔记之Intent

Posted 喜爱糖葫芦

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Android学习笔记之Intent相关的知识,希望对你有一定的参考价值。

1.Intent指定启动目标组件

2.Intentfilter描述基本组件所在地址

3.其他包引入资源文件时记得引入R所在的包

package com.jikexueyuan.intent;


import com.jiahemeikang.helloandroid.R;
import android.app.Activity;
import android.os.Bundle;

public class Aty2 extends Activity{

    public Aty2() {
        // TODO Auto-generated constructor stub
    }

    @Override
    protected void onCreate(Bundle e) {
        super.onCreate(e);
        setContentView(R.layout.aty2);
    }
}

 

R的包

/* AUTO-GENERATED FILE.  DO NOT MODIFY.
 *
 * This class was automatically generated by the
 * aapt tool from the resource data it found.  It
 * should not be modified by hand.
 */

package com.jiahemeikang.helloandroid;

public final class R {
    public static final class attr {
    }
    public static final class dimen {
        /**  Default screen margins, per the Android Design guidelines. 

         Customize dimensions originally defined in res/values/dimens.xml (such as
         screen margins) for sw720dp devices (e.g. 10" tablets) in landscape here.
    
         */
        public static final int activity_horizontal_margin=0x7f040000;
        public static final int activity_vertical_margin=0x7f040001;
    }
    public static final class drawable {
        public static final int ic_launcher=0x7f020000;
    }
    public static final class id {
        public static final int action_settings=0x7f08000d;
        public static final int bingdingservice=0x7f080000;
        public static final int btnClose=0x7f08000b;
        public static final int btnGetNum=0x7f080002;
        public static final int btnStartAty1=0x7f080009;
        public static final int btnStartService=0x7f080003;
        public static final int btnStopService=0x7f080004;
        public static final int btnbroadcast=0x7f080006;
        public static final int btnregbroadcast=0x7f080007;
        public static final int btnunregbroadcast=0x7f080008;
        public static final int textView1=0x7f080005;
        public static final int tvOut=0x7f08000c;
        public static final int tvResult=0x7f08000a;
        public static final int unbingdingservice=0x7f080001;
    }
    public static final class layout {
        public static final int activity_main=0x7f030000;
        public static final int aty1=0x7f030001;
        public static final int aty2=0x7f030002;
    }
    public static final class menu {
        public static final int main=0x7f070000;
    }
    public static final class string {
        public static final int action_settings=0x7f050001;
        public static final int app_name=0x7f050000;
        public static final int hello_world=0x7f050002;
    }
    public static final class style {
        /** 
        Base application theme, dependent on API level. This theme is replaced
        by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
    

            Theme customizations available in newer API levels can go in
            res/values-vXX/styles.xml, while customizations related to
            backward-compatibility can go here.
        

        Base application theme for API 11+. This theme completely replaces
        AppBaseTheme from res/values/styles.xml on API 11+ devices.
    
 API 11 theme customizations can go here. 

        Base application theme for API 14+. This theme completely replaces
        AppBaseTheme from BOTH res/values/styles.xml and
        res/values-v11/styles.xml on API 14+ devices.
    
 API 14 theme customizations can go here. 
         */
        public static final int AppBaseTheme=0x7f060000;
        /**  Application theme. 
 All customizations that are NOT specific to a particular API-level can go here. 
         */
        public static final int AppTheme=0x7f060001;
    }
}

将做好的资源文件加入Android activty加入Android Manifest

技术分享

以上是关于Android学习笔记之Intent的主要内容,如果未能解决你的问题,请参考以下文章

Android学习笔记之,调用系统图库,添加自定义字体,屏幕截图

Android :安卓学习笔记之 通过Intent传递类对象(实现Serializable和Parcelable接口)

Android第一行代码学习笔记六---Intent向活动传递数据

Android第一行学习代码笔记四---使用Intent在活动之间穿梭

Android学习笔记 Intent

android小知识点代码片段