Android学习笔记之Intent(1)

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

时间: 2024-08-08 22:08:17

Android学习笔记之Intent(1)的相关文章

Android学习笔记-Activity&Intent

界面activity_main.xml <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:tools="http://schemas.android.com/tools"     android:layout_width="match_parent"     android:layout_height="matc

Android学习笔记之Intent

Intent中文意思:意图 Intent是各组件沟通的桥梁,在Android中非常的重要 Inten可以启动的大致分为三种:Activity(界面),Service(服务),Broadcasts(广播) 启动界面:StartActivity(),StartActivityForResult(); 启动服务:StartService(),BindService() 发送广播:SendBroadcasts() Intent分为显式意图和隐式意图两种 显式意图:需要明确指明打开的组件 隐式意图:没有明

android学习笔记(4)Intent初级学习

对应若水老师的视频教程第7课 这节课程讲解了intent,是对动作的抽象描述,是意图的意思,建立一个intent就可以给一个动作给他来执行.inten是android开发的精髓所在. 一,点击按钮实现给一个指定号码打电话 btn1.setOnClickListener(listener); private OnClickListener listener =new OnClickListener() { Intent intent = new Intent(); @Override public

Pro Android学习笔记(十二):了解Intent(下)

解析Intent,寻找匹配Activity 如果给出component名字(包名.类名)是explicit intent,否则是implicit intent.对于explicit intent,关键就是component 名字,在<intent-fliter>中声明的其他属性被忽略.对于implicit intent,则根据action,category和data来进行匹配.然而一个intent fliter中可以声明多个actions,多个categories,多个data属性,因此可以满

Pro Android学习笔记(十):了解Intent(上)

Android引入了Intent的概念来唤起components,component包括:1.Activity(UI元件) 2.Service(后台代码) 3.Broadcast receiver(处理广播消息的代码) 4.Content provider(抽象数据的代码) Intent基本含义 intent是通知平台处理(唤起)的动作.Android唤起的动作将取决于注册了什么动作.例如我们有个简单的Activity:IntentBaiscViewActivity.在AndroidManife

Android学习笔记(三五):再谈Intent(下)-一些实践

Android的UI框架要求用户将他们的app分为activity,通过itent来进行调度,其中有一个main activity由Android的launcher在桌面中调用.例如一个日历的应用,需要查看日历的activity,查看单个事件的activity,编辑事件的activity等等.在查看日历的activity中,如果用户选择的某个事件,需要通过查看事件的activity来处理.这就是最近本的app UI框架,本次,我们将学习如何通过intent来完成. Activity之间的关系 某

Android学习笔记(三四):再谈Intent(上)-一些知识

在Android学习笔记(七):多个Activity和Intent中,我们先在学会了如何使用intent在代码中唤起activity.此处作深一步地学习. 什么是Intent intent是对一个操作处理的抽象描述.context可以在使用startActivity(intent)来launch一个actvivity,就如我们在学习笔记(七)中的处理,也是最常用的方式,将activity在我们的应用中整合:可以在通过sentBroast(intent)来广播给任何有兴趣的BroadcastRec

【转】Pro Android学习笔记(十):了解Intent(上)

目录(?)[-] Intent基本含义 系统的Intent Android引入了Intent的概念来唤起components,component包括:1.Activity(UI元件) 2.Service(后台代码) 3.Broadcast receiver(处理广播消息的代码) 4.Content provider(抽象数据的代码) Intent基本含义 intent是通知平台处理(唤起)的动作.Android唤起的动作将取决于注册了什么动作.例如我们有个简单的Activity:IntentBa

Android学习笔记三:Intent实现页面跳转

在主Activity的OnCreate()方法中,通过findViewById得到Activiity_main中已定义的组件,例如Button.EditText等,注意需要强制转型view到具体的类型. 给取得的组件btn添加监听器如OnClickListener(),在其中实例化Intent对象,参数为要跳转的出发类和目标类. 用putExtra()方法添加内容到intent对象中,内容为K-V对.K中可写标记,V中存要传输的内容. public void onClick(View arg0)