You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
paqeuj6gm 9644bb2978
添加图片(1)
2 years ago
README.md 添加图片(1) 2 years ago

README.md

protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.setContentView(R.layout.note_edit);

if (savedInstanceState == null && !initActivityState(getIntent())) {
	finish();
	return;
}
initResources();

//根据id获取添加图片按钮
final ImageButton add_img_btn = (ImageButton) findViewById(R.id.add_img_btn);
//为点击图片按钮设置监听器
add_img_btn.setOnClickListener(new View.OnClickListener() {
	@Override
	public void onClick(View view) {
		Log.d(TAG, "onClick: click add image button");
		//ACTION_GET_CONTENT: 允许用户选择特殊种类的数据,并返回(特殊种类的数据:照一张相片或录一段音)
		Intent loadImage = new Intent(Intent.ACTION_GET_CONTENT);
		//Category属性用于指定当前动作Action被执行的环境.
		//CATEGORY_OPENABLE; 用来指示一个ACTION_GET_CONTENT的intent
		loadImage.addCategory(Intent.CATEGORY_OPENABLE);
		loadImage.setType("image/*");
		startActivityForResult(loadImage, PHOTO_REQUEST);
	}
});

}