WEB开发网
开发学院手机开发Android 开发 Android Activity之间的Inter-process沟通 阅读

Android Activity之间的Inter-process沟通

 2010-06-01 15:47:00 来源:WEB开发网   
核心提示:37. layout.addView(btn, param);38.39. btn4 = new Button(this);40. btn4.setBackgroundResource(R.drawable.face);41. btn4.setText("Exit");42. btn4.setOnC

37. layout.addView(btn, param);

38.

39. btn4 = new Button(this);

40. btn4.setBackgroundResource(R.drawable.face);

41. btn4.setText("Exit");

42. btn4.setOnClickListener(this);

43. layout.addView(btn4, param);

44. setContentView(layout);

45. }

46. public void setData(String x){

47. feedback_data = x;

48. }

49. public void onClick(View v){

50. if (v == btn){

51. Intent intent = new Intent(this, Activity_1.class);

52. this.startActivity(intent);

53. }

54. if(v.equals(btn4))

55. this.finish();

56. }

57. }

58.

59.

60. /* Activity_1.java */

61. package xom.misoo.pkzz;

62. import android.app.Activity;

63. import android.os.Bundle;

64. import android.view.View;

65. import android.view.View.OnClickListener;

66. import android.widget.Button;

67. import android.widget.LinearLayout;

68.

69. public class Activity_1 extends Activity implements OnClickListener {

70. private Button btn;

71. @Override

72. public void onCreate(Bundle icicle) {

73. super.onCreate(icicle);

74. LinearLayout layout = new LinearLayout(this);

75. layout.setOrientation(LinearLayout.VERTICAL);

76.

77. btn = new Button(this);

78. btn.setBackgroundResource(R.drawable.music);

79. btn.setText("Edit");

80. btn.setOnClickListener(this);

81. LinearLayout.LayoutParams param = new LinearLayout.LayoutParams(150, 40);

82. param.topMargin = 5;

83. layout.addView(btn, param);

84. setContentView(layout);

85. ac01.appRef.setData("feedback from Activity_1.");

上一页  1 2 3 4 5 6 7  下一页

Tags:Android Activity 之间

编辑录入:coldstar [复制链接] [打 印]
赞助商链接