Android4.0.4编程日记(4)--List单击Intent跳转并获取数据
来源:互联网 发布:c#做windows窗口程序 编辑:程序博客网 时间:2024/06/05 18:54
第二个页面的代码
package com.example.test;import com.example.pojo.Params;import android.app.Activity;import android.os.Bundle;import android.widget.CompoundButton;import android.widget.CompoundButton.OnCheckedChangeListener;import android.widget.TextView;import android.widget.Toast;import android.widget.ToggleButton;public class SecondActivity extends Activity{TextView name;TextView note;ToggleButton controlButton;String id;@Overrideprotected void onCreate(Bundle savedInstanceState) {// TODO Auto-generated method stubsuper.onCreate(savedInstanceState);setContentView(R.layout.activity_second);name=(TextView) this.findViewById(R.id.itemNameValue);note=(TextView) this.findViewById(R.id.itemNoteValue);controlButton=(ToggleButton) this.findViewById(R.id.controlButton);Params p=(Params) getIntent().getSerializableExtra("params");name.setText(p.getName());note.setText(p.getNote());id=p.getId();controlButton.setOnCheckedChangeListener(new OnCheckedChangeListener() {@Overridepublic void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {// TODO Auto-generated method stubcontrolButton.setChecked(isChecked);if(isChecked){Toast.makeText(getApplicationContext(),"开启"+id+"按钮成功",Toast.LENGTH_SHORT).show();}else{Toast.makeText(getApplicationContext(),"关闭"+id+"按钮成功",Toast.LENGTH_SHORT).show();}}});}}
第一个界面的单击事件
@Overridepublic void onItemClick(AdapterView<?> arg0, View arg1, int arg2,long arg3) { Intent intent = new Intent(MainActivity.this,SecondActivity.class); //intent.setClass(ListViewActivity.this, ListActivity.class); intent.putExtra("params", list.get(arg2)); startActivity(intent); System.out.println("aaa");}
第二个页面的xml activity_second.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="match_parent" tools:context=".MainActivity" > <LinearLayout android:id="@+id/linearLayout1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:orientation="vertical" > </LinearLayout> <TextView android:id="@+id/itemNameValue" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/linearLayout1" android:layout_marginTop="15dp" android:layout_toRightOf="@+id/linearLayout1" android:textAppearance="?android:attr/textAppearanceLarge" /> <TextView android:id="@+id/itemNoteValue" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/itemNameValue" android:layout_below="@+id/itemNameValue" android:layout_marginTop="77dp" android:textAppearance="?android:attr/textAppearanceLarge" /> <ToggleButton android:id="@+id/controlButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/itemNoteValue" android:layout_alignParentBottom="true" android:layout_marginBottom="76dp" android:text="ToggleButton" /></RelativeLayout>
- Android4.0.4编程日记(4)--List单击Intent跳转并获取数据
- Android4.0.4编程日记(3)--ListView单击获取事件
- Android4.0.4编程日记(5)--URL网络链接获取数据
- Android4.0.4编程日记(2)--ListView
- Intent跳转并回传数据
- gridview鼠标双击事件(跳转至新页面并传值)单击获取值
- Android4.0.4编程日记(1)--安装配置
- EasyUI单击选中一行数据并获取数据
- kendoGrid单击、双击事件绑定并获取当前行数据
- Android 通过intent跳转页面并传送数据
- Intent 跳转分享数据。
- Android开发通过Xutil3获取数据并显示(list)
- Intent跳转传list集合
- Intent的普通跳转和带数据跳转(笔记)
- jqgrid 单击事件获取数据
- onNewIntent(Intent intent) intent无法获取数据
- 单击选中GridView 或 HTML 表格的某行,并获取该行的数据。。。。
- asp.net实现 gridview 鼠标单击任意字段选中一行 ,并获取数据
- FlexLib
- 一个程序员在Elance上的外包经验分享
- mysql的空值与NULL的区别
- 如何实现环形Loading
- 从洗手间细节到企业文化—企业信息化应该具体什么样的精益化管理
- Android4.0.4编程日记(4)--List单击Intent跳转并获取数据
- VC编译选项 MT MTd
- DUT 1009 很久以前的第一次写排序+二分
- 前沿程序员推荐的几个国外开源网站
- DUT 1006 视力表 (打印图形的模拟题)
- hdu1013 Digital Roots
- C++的多态性
- hadoop报错导致flume无法写入日志文件,hadoop报错如下xceiverCount 258 exceeds the limit of concurrent xcievers 256
- maven-android-plugin