<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="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context="com.example.test1.MainActivity" >

<TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/hello_world" />

<TextView
        android:id="@+id/textView2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/editText1"
        android:layout_alignParentLeft="true"
        android:layout_alignParentRight="true"
        android:layout_alignRight="@+id/button1"
        android:layout_below="@+id/textView1"
        android:layout_marginTop="59dp"
        android:text="只读文本"
        android:textSize="15pt" 
        android:textColor="#0092c7" />

<EditText
        android:id="@+id/editText1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_above="@+id/button1"
        android:layout_centerHorizontal="true"
        android:layout_marginBottom="55dp"
        android:ems="10"
        android:hint="删除完成后显示,提示功能"
        android:text="文本框测试" >

<requestFocus />
    </EditText>

<Button
        android:id="@+id/button1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/textView2"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="85dp"
        android:hint="确定功能提示"
        android:text="@string/btn1Text"
        android:textStyle="bold" />

<Button
        android:id="@+id/Button01"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/button1"
        android:layout_below="@+id/button1"
        android:layout_marginTop="18dp"
        android:hint="弹窗功能提示"
        android:text="@string/btn2Text"
        android:textStyle="bold" />
   
        <Button
        android:id="@+id/Button02"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/button1"
        android:layout_alignRight="@+id/Button01"
        android:layout_below="@+id/Button01"
        android:layout_marginTop="28dp"
        android:hint="下拉窗功能提示"
        android:text="@string/btn3Text"
        android:textStyle="bold" />

</RelativeLayout>

///////////////////////////////////////////////////////////////////////////////////////////

package com.example.test1;

import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.EditText;

public class Popu_TC extends ActionBarActivity {
 
 ////////////////////
 private EditText Text_Popu;
 ////////////////////

@Override
 protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_popu__tc);
  
        ////////1///////////
  Text_Popu = (EditText)findViewById(R.id.editText_Popu);
        ////////////////////
  
        ////////2///////////
  Bundle bunde = this.getIntent().getExtras();
  //String strs = bunde.getString("key3").toString();
  Text_Popu.setText(bunde.getString("key3").toString());
        ////////////////////
  
 }
 
 @Override
 public boolean onCreateOptionsMenu(Menu menu) {
  // Inflate the menu; this adds items to the action bar if it is present.
  getMenuInflater().inflate(R.menu.popu__tc, menu);
  return true;
 }

@Override
 public boolean onOptionsItemSelected(MenuItem item) {
  // Handle action bar item clicks here. The action bar will
  // automatically handle clicks on the Home/Up button, so long
  // as you specify a parent activity in AndroidManifest.xml.
  int id = item.getItemId();
  if (id == R.id.action_settings) {
   return true;
  }
  return super.onOptionsItemSelected(item);
 }
}

///////////////////////////////////////////////////////////////////////////////////////////

package com.example.test1;

import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;

////////////////////
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import android.content.Intent;
////////////////////

public class MainActivity extends ActionBarActivity {
 
    ////////////////////
 private Button myButton;
 private EditText myText;
 
 private Button myButton01;
 private Button myButton02;
    ////////////////////

@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
       
        //////////1/////////
        myButton = (Button)findViewById(R.id.button1);
        myText = (EditText)findViewById(R.id.editText1);
       
        myButton.setOnClickListener(new View.OnClickListener() {

@Override
            public void onClick(View v) {
                // TODO Auto-generated method stub
                myText.setText("弄明白监听!");
            }
        });

////////////////////
       
       
        /////////2//////////
        myButton01 = (Button)findViewById(R.id.Button01);
        myButton01.setOnClickListener(new View.OnClickListener() {

@Override
            public void onClick(View v) {
                // TODO Auto-generated method stub
                ////显示文本------- 测试通过
                //myText.setText("弄明白监听2!");

////intent负责程序跳转和传递数据
                //Intent intent = new Intent(this,F1_TC.class);
                //startActivity(intent);
                //Toast.makeText(this, "Toast", Toast.LENGTH_SHORT).show();
             
             Intent intent = new Intent(MainActivity.this, F1_TC.class);
             startActivity(intent);
             
             
             ////打开一个伪窗口------- 测试通过
             //Toast.makeText(getApplicationContext(), "提示:点击窗口外部关闭窗口!",
             //Toast.LENGTH_SHORT).show();

}
        });
        ////////////////////
       
        /////////3//////////
        myButton02 = (Button)findViewById(R.id.Button02);
        myButton02.setOnClickListener(new View.OnClickListener() {

@Override
            public void onClick(View v) {

////intent负责程序跳转和传递数据
                Intent intent = new Intent(MainActivity.this,Popu_TC.class);
               
                Bundle bundle = new Bundle(); //通过Bundle实现数据的传递:
                bundle.putString("key1", "value1"); // key1为名,value1为值
                bundle.putString("key2", myButton02.toString());
                bundle.putString("key3", myText.getText().toString());
                bundle.putInt("keyInt1", 100);  //整数类型
                intent.putExtras(bundle); // 传数据
               
               
                startActivity(intent);   // ------- 测试通过    //不需要子窗口回传数据
                //startActivityForResult(intent, 1); //requestCode是子窗口的id标志,而且必须大于1,否则回调函数onActivityResult不响应!

}
        });
        ////////////////////
       
       
    }

@Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
    }

@Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
     
        int id = item.getItemId();
        if (id == R.id.action_settings) {
            return true;
        }
        return super.onOptionsItemSelected(item);
    }

}

20150602_Andriod 向窗体传递参数的更多相关文章

  1. C#中在定义事件委托时怎样跨窗体传递参数

    场景 C#中委托与事件的使用-以Winform中跨窗体传值为例: https://blog.csdn.net/BADAO_LIUMANG_QIZHI/article/details/100150700 ...

  2. C#从一个窗体传递参数到另一个窗体的链接

    http://blog.sina.com.cn/s/blog_60d69ce00100eldt.html

  3. 在Winform界面中实现对多文档窗体的参数传值

    在Winform界面中窗体我们一般使用多文档进行展示,也就是类似一般的选项卡的方式可以加载多个窗体界面.一般来说,我们如果打开新的窗体,给窗体传递参数是很容易的事情,但是在框架层面,一般的窗体是通过动 ...

  4. JS加载获取父窗体传递的参数

    JS加载获取父窗体传递的参数 $(document).ready(function () { var query = location.search.substring(1); var values ...

  5. 用SqlParameter 给SQL传递参数

    1.数据访问层 using的用法: 01.可以using System;导命名控空间 02.using 的语法结构 using(变量类型  变量名 =new 变量类型()) { } 案例: 03.us ...

  6. C#进程间通信--API传递参数(SendMessage)

    原文 C#进程间通信--API传递参数(SendMessage)  我们不仅可以传递系统已经定义好的消息,还可以传递自定义的消息(只需要发送消息端和接收消息端对自定义的消息值统一即可).下面的发送和接 ...

  7. post 传递参数中包含 html 代码解决办法,js加密,.net解密

    今天遇到一个问题,就是用post方式传递参数,程序在vs中完美调试,但是在iis中,就无法运行了,显示传递的参数获取不到,报错了,查看浏览器请求情况,错误500,服务器内部错误,当时第一想法是接收方式 ...

  8. 使用EventHandler传递参数

    1.MouseEventHandler和EventHandler传递参数的局限性分析 开发过程中,特别是使用自定义控件时,常常需要对一个控件的click,mouseDown,mouseUp等事件的处理 ...

  9. Vue 给子组件传递参数

    Vue 给子组件传递参数 首先看个例子吧 原文 html <div class="container" id="app"> <div clas ...

随机推荐

  1. linux:什么是linux

    1>.linux是一套作业系统(linux就是核心与呼叫这两层),每一种作业系统都是在他专门的硬体机器上面运行的:linux是一个Open Source的作业系统,具有可移植性 2>.li ...

  2. 支持正则或通配符的hashmap

    RegexpKeyedMap http://wiki.apache.org/jakarta/RegexpKeyedMap RegexHashMap https://heideltime.googlec ...

  3. 初始化 Gradle 工程目录(转自: 隔叶黄莺 Unmi Blog)

    最近重新在 Eclipse 中打开旧的 Maven 项目,总有些什么错误,备受折磨.期间试手了 Ant+Ivy, 现今试用了下 Gradle,感觉不错,它应该才是我真想要的,Maven 差不多该扔到一 ...

  4. Good Bye 2013

    C:有点这种题的经验,先存起来相等的 D:赛后还搓了好久的代码,其实长度就100,枚举两边情况,其实A和C就涵盖了所有情况!所以到2就可以了,而且我弄出了有多少个后,和两边情况,也不知道能否或怎么凑成 ...

  5. [原创]java WEB学习笔记91:Hibernate学习之路-- -HQL 迫切左外连接,左外连接,迫切内连接,内连接,关联级别运行时的检索策略 比较。理论,在于理解

    本博客的目的:①总结自己的学习过程,相当于学习笔记 ②将自己的经验分享给大家,相互学习,互相交流,不可商用 内容难免出现问题,欢迎指正,交流,探讨,可以留言,也可以通过以下方式联系. 本人互联网技术爱 ...

  6. [原创]java WEB学习笔记74:Struts2 学习之路--自定义拦截器,struts内建的拦截器

    本博客的目的:①总结自己的学习过程,相当于学习笔记 ②将自己的经验分享给大家,相互学习,互相交流,不可商用 内容难免出现问题,欢迎指正,交流,探讨,可以留言,也可以通过以下方式联系. 本人互联网技术爱 ...

  7. Linux 硬盘分区

    Linux系统中的重要概念,一切资源都看做是文件,包括硬件设备. 1. 基本概念 1)MBR:Master Boot Recorder,存放主引导记录,446字节的引导代码. 2)主分区表:存放主分区 ...

  8. Extjs treePanel 后台Json的两种构建方法

    public string json = ""; public string QueryMenuTreeJson(string ParentID, string userId) { ...

  9. Appium的理念

    1.Appium的架构:C/S模式 Appium的核心是暴漏REST API的WebServer,appium接收来自客户端的连接请求,监听由客户端发起的命令,在移动设备上执行这些命令,这些命令的执行 ...

  10. Java编程思想(一):大杂烩

    在java中一切都被视为对象.尽管一切都是对象,但是操纵的标识符实际上是对象的一个引用,可以将引用想象成是遥控器(引用)来操纵电视机(对象).没有电视机,遥控器也可以单独存在,即引用可以独立存在,并不 ...