对于使用intent,主要是用来进行活动之间的跳转,然后就是通过intent向下一个活动传递数据,还有就是想上一个活动传递数据。

实例:

先添加按钮的点击事件,当点击按钮时进行事件的触发,主要代码是

String data="hello word";

Intent intent=new Intent(firstactivity.this,secondactivity.class);

intent.putExtra("extra_data",data);

startActivity(intent);

通过此方法向下一个activity传递参数;

下一个界面进行参数的接收;

Intent intent=getIntent();

String data=intent.getStringExtra("extra_data");

这样进行数据的接收。

关于fragment的主要是应用碎片时候的额相关操作。

主要是在新建的.java文件中重写了Fragment中的onCreateView()方法,然后就是在这个方法中通过LayoutInflater的inflate()方法将刚才定义的 left_fragment布局动态加载进来,整个方法简单明了。

主要的代码 如下:

public class Rncjas extends Fragment

{

@Override

public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedIntanceState)

{

View view inflater.inflate(R.layout.right_fragment,container,flase);

}

}

这就是主要的代码实现。其次就是外加上layout的相关操作。

android学习相关intent和fragment的先关知识点的更多相关文章

  1. Android学习之 Intent详解

    一. Intent 作用 Intent 是一个将要执行的动作的抽象的描述,一般来说是作为参数来使用,由Intent来协助完成android各个组件之间的通讯.比如说调用startActivity()来 ...

  2. (转载)Android学习之Intent使用

    ndroid学习之Intent使用   1.使用显示Intent Intent intent = new Intent(FirstActivity.this,SecondActivity.class) ...

  3. android学习五 Intent

    1.Intent是组件间调用的桥梁. 2.Android系统定义了很多Intent    http://developer.android.com/guide/components/intents-c ...

  4. Android学习之Intent传递数据

    Intent在Activity中的作用主要是有两个: 1.启动目标Activity 2.传递数据 Intent在传递数据时分两种情况:向下一个Activity传递数据和从下一个Activity返回数据 ...

  5. Android学习笔记-Intent(一)

    Intent对象在Android官方API这样描述:It is a passive data structure holding an abstract description of an opera ...

  6. Android学习之Intent使用

    1.使用显示Intent Intent intent = new Intent(FirstActivity.this,SecondActivity.class); startActivity(inte ...

  7. Android学习笔记--Intent

    Intent是android四大组件之间交互的一种重要方式.Intent可以指明当前要执行的动作,也可以指明要传递的数据.Intent可以用来启动活动,启动服务,发送广播. Intent分为两种:1. ...

  8. Android学习笔记Intent二

    上篇随笔大概写了了Intent学习的大纲,这篇通过代码理解下Intent的ComponentName属性的使用 ComponentName,中文意思是组件名称,通过Intent的setsetCompo ...

  9. android 学习随笔二十八(应用小知识点小结 )

    去掉标题栏的方法 第一种:也一般入门的时候经常使用的一种方法requestWindowFeature(Window.FEATURE_NO_TITLE);//去掉标题栏注意这句一定要写在setConte ...

随机推荐

  1. RStudio终端操作

    转于:https://support.rstudio.com/hc/en-us/articles/115010737148-Using-the-RStudio-Terminal#send 原文是英文版 ...

  2. CSS的SVG学习

    SVG 意为可缩放矢量图形(Scalable Vector Graphics). HTML三种方法导入svg文件: <html xmlns:svg="http://www.w3.org ...

  3. 浅析Redis分布式锁---从自己实现到Redisson的实现

    当我们在单机情况下,遇到并发问题,可以使用juc包下的lock锁,或者synchronized关键字来加锁.但是这俩都是JVM级别的锁,如果跨了JVM这两个锁就不能控制并发问题了,也就是说在分布式集群 ...

  4. Quantitative Proteomics of Enriched Esophageal and Gut Tissues from the Human Blood Fluke Schistosoma mansoni Pinpoints Secreted Proteins for Vaccine Development (解读人:张聪敏)

    文献名:Quantitative Proteomics of Enriched Esophageal and Gut Tissues from the Human Blood Fluke Schist ...

  5. Hive 时间操作

    Hive 时间转换 UNIX时间戳概念:因为UNIX时间戳只是一个秒数,一个UNIX时间戳在不同时区看来,时间是不同的.如UNIX时间戳0,在0时区看来是1970-01-01 00:00:00,在东八 ...

  6. VsCode编辑器那些事

    1.怎么改成中文的? 按快捷键“Ctrl+Shift+P” 在框下点击“configur Display language" 会跳转至商店,选择插件下载“Chinese (Simplifie ...

  7. Angularjs优点

    数据双向绑定,前后台的更改都可以随时生效, 提供mvc开发模式模式,剥离前端各部分代码,使代码便于维护管理. 简化了你写DOM操作

  8. hdu2642二维树状数组,单点修改+区间查询

    题目链接:http://icpc.njust.edu.cn/Problem/Hdu/2642/ 代码如下: #include<bits/stdc++.h> using namespace ...

  9. BFS与DFS常考算法整理

    BFS与DFS常考算法整理 Preface BFS(Breath-First Search,广度优先搜索)与DFS(Depth-First Search,深度优先搜索)是两种针对树与图数据结构的遍历或 ...

  10. Building Applications with Force.com and VisualForce (DEV401) (二十):Visualforce Pages: Visualforce Componets (Tags)

    Dev401-021:Visualforce Pages: Visualforce Componets (Tags) Module Agenda1.Tag Basics2.Tag Bindings T ...