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

Android Activity之间的Inter-process沟通

 2010-06-01 15:47:00 来源:WEB开发网   
核心提示:54. setTitle(im);55. }56.57. public void onClick(View v){58. if (v == btn){59. Intent intent = new Intent(Intent.ACTION_VIEW, null);60. intent.putExtra(com.miso

54. setTitle(im);

55. }

56.

57. public void onClick(View v){

58. if (v == btn){

59. Intent intent = new Intent(Intent.ACTION_VIEW, null);

60. intent.putExtra(com.misoo.pkzz.ac01.KKK, "Ax004::Intent Extra Msg.");

61. this.startActivityForResult(intent, 0);

62. }

63. if(v.equals(btn2)){

64. SharedPreferences passwdfile = getSharedPreferences(

65. "ITEM", 0);

66. String im = passwdfile.getString("ITEM", null);

67. setTitle(im);

68. }

69. if(v.equals(btn4))

70. this.finish();

71. }

72. }

73.

74.

75. /* Activity_1.java */

76. package com.misoo.pkzz;

77. import android.app.Activity;

78. import android.content.SharedPreferences.Editor;

79. import android.os.Bundle;

80. import android.view.View;

81. import android.view.View.OnClickListener;

82. import android.widget.Button;

83. import android.widget.LinearLayout;

84.

85. public class Activity_1 extends Activity implements OnClickListener {

86. private Button btn;

87. @Override

88. public void onCreate(Bundle icicle) {

89. super.onCreate(icicle);

90. LinearLayout layout = new LinearLayout(this);

91. layout.setOrientation(LinearLayout.VERTICAL);

92.

93. btn = new Button(this);

94. btn.setBackgroundResource(R.drawable.x_yellow);

95. btn.setText("Edit");

96. btn.setOnClickListener(this);

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

98. param.topMargin = 5;

99. layout.addView(btn, param);

100. setContentView(layout);

101. //-----------------------------------

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

Tags:Android Activity 之间

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