Activity传递数据

//通过意图传递参数
1
Intent intent = new Intent(this, Activity.class); 2 Bundle bundle=new Bundle(); 3 bundle.putString("name", "this!"); 4 intent.putExtras(bundle); 5 startActivity(intent );

 

1 //获取数据
2 Bundle bundle=getIntent().getExtras();
3 String name=bundle.getString("name");

 

 1 <GridView //GridView 
 2       android:layout_width="fill_parent" 
 3       android:layout_height="fill_parent"
 4       android:numColumns="auto_fit"
 5       android:verticalSpacing="10dp"
 6       android:horizontalSpacing="10dp"
 7       android:columnWidth="90dp"
 8       android:id="@+id/gridview"
 9       android:stretchMode="columnWidth"
10       android:gravity="center"
11    />

 

posted @ 2013-10-12 14:23  wangzhenxiang  阅读(170)  评论(0编辑  收藏  举报