1
我在所有屏幕底部使用了選項卡,並且我使用onactivityresult()方法從圖庫和camera.my代碼中選擇圖像,但沒有選項卡活動。但是當我使用我的代碼時,Tabactivity不起作用。,我2天尋找,但沒有解決不饒人,我做什麼..,我所以從這個frusted,請幫助我..,thankyou.here是onactivityresult()方法:android如何通過tabhost活動調用onactivityResult?
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
switch (requestCode) {
case 1:
if (resultCode ==RESULT_OK)
{
Uri chosenImageUri = data.getData();
String imagepath= getpath(chosenImageUri);
Bitmap bitmap = BitmapFactory.decodeFile(imagepath);
customImageView.setImageBitmap(Bitmap.createScaledBitmap(bitmap, 120, 120, false));
Constant._profilePicBase64=Constant.convertBitmapToBase64(bitmap);
getprofilepic();
}else{
Toast.makeText(SettingsActivity.this, "Unable to get Image", Toast.LENGTH_SHORT).show();
}
break;
case 2:
if (resultCode ==RESULT_OK)
{
try{
Bitmap bitmap = (Bitmap) data.getExtras().get("data");
customImageView.setImageBitmap(Bitmap.createScaledBitmap(bitmap, 120, 120, false));
Constant._profilePicBase64=Constant.convertBitmapToBase64(bitmap);
getprofilepic();
}catch (OutOfMemoryError e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
}else{
Toast.makeText(SettingsActivity.this, "Unable to get Image", Toast.LENGTH_SHORT).show();
}
break;
}
}
thnaku..but我有解決方案... :) – rajshree
那麼,爲什麼不公佈它,而不是:1.解答未回答的問題和2.不接受@ beginner1答案? – momo