private OnClickListener buttonClick = new View.OnClickListener () {
public void onClick (View v) {
Intent intent = null;
switch (v.getId ()) {
case R.id.backBtn:
BizEditSettingActivity.this.finish ();
break;
case R.id.saveBtn:
getInfo = new GetBusinessInfo ();
getInfo.execute ();
break;
case R.id.biz_image:
LayoutInflater inflater = (LayoutInflater) getSystemService (LAYOUT_INFLATER_SERVICE);
myView = inflater.inflate (R.layout.popupwindow, null);
popupWindow = new PopupWindow (myView, LayoutParams.FILL_PARENT, 300, false);
popupWindow.setBackgroundDrawable (new BitmapDrawable ());
/ / Set PopupWindow pop and disappear effect
popupWindow.setAnimationStyle (R.style.popupAnimation);
albumsBtn = (Button) myView.findViewById (R.id.albumsBtn);
albumsBtn.setOnClickListener (new OnClickListener () {
@ Override
public void onClick (View arg0) {
Intent picture = new Intent (Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
startActivityForResult (picture, ConstantUtils.IMAGE_FROM_ALBUMS);
popupWindow.dismiss ();
}
});
cancleBtn = (Button) myView.findViewById (R.id.cancleBtn);
cancleBtn.setOnClickListener (new OnClickListener () {
@ Override
public void onClick (View arg0) {
popupWindow.dismiss ();
}
});
popupWindow.showAtLocation (cameraBtn, Gravity.BOTTOM, 0, 0);
break;
}
}
};
@ Override
protected void onActivityResult (int requestCode, int resultCode, Intent data) {
super.onActivityResult (requestCode, resultCode, data);
switch (resultCode) {
case ConstantUtils.IMAGE_FROM_ALBUMS:
if (resultCode == Activity.RESULT_OK && null! = data) {
Uri selectedImage = data.getData ();
String [] filePathColumns = {MediaStore.Images.Media.DATA};
. Cursor c = this.getContentResolver () query (selectedImage, filePathColumns, null, null, null);
c.moveToFirst ();
int columnIndex = c.getColumnIndex (filePathColumns [0]);
imagePath = c.getString (columnIndex);
c.close ();
}
break;
default:
break;
}
}
Paste the code relationship problems, engage in a fast one afternoon, and did not find what the problem<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
I ask you this is accessible album?
Reply:
switch (resultCode) {saying you should be requestCode it here
Reply:
Not looking really can not see
Reply:
Is to call the album
if (data == null | | data.getExtras () == null) {
return;
} Else {
Uri selectedImage = data.getData ();
String [] filePathColumns = {MediaStore.Images.Media.DATA};
. Cursor c = this.getContentResolver () query (selectedImage, filePathColumns, null, null, null);
c.moveToFirst ();
int columnIndex = c.getColumnIndex (filePathColumns [0]);
imagePath = c.getString (columnIndex);
c.close ();
}
The method is slightly changed a bit, or not being called
Reply:
switch (resultCode) {not the problem here you can come in onActivityResult yet
Reply:
onActivityResult not get
startActivityForResult method body where the operation is successful, but the callback onActivityResult invalid
Reply:
switch (resultCode) did not change the
Reply:
switch (resultCode) into switch (requestCode)
Reply:
switch (resultCode) into switch (requestCode)
Reply:
Plagiarism
Reply:
Solved, thank you
When you call the phone cameras, photo albums and other functions, the callback corresponds requestCode
While usually startActivityForResult, corresponds resultCode
Trouble you
Reply:
In fact, yesterday I had already answered in # 2, you did not adoption
Good luck to you!
No comments:
Post a Comment