when I am trying to upload the default image with captured image,it is not displaying.If I login again then that captured image will display.Why the default image is not changing? In case if the image already exists in the server, it works fine for me.
this is my code.I am using com.android.volley.toolbox.NetworkImageView
String url = "http://xxx.xxx.x.xx/mobile_app/" + img_path + "/" + img_name;
imageLoader = MyVolleyRequest.getInstance(StudentDetails.this).getImageLoader();
imageLoader.get(url, imageLoader.getImageListener(resultIv,R.drawable.new_back, R.drawable.new_back));
resultIv.setImageUrl(url, imageLoader);
Please help me to find the solution.
Related
I know how to open gallery intent and to display in the imageview.
But I am facing problem in selecting image automatically in oncreate method and display in the imageview.
I have an image in gallery folder with name "myfile.jpg"
Can anyone guide me how to do it without openting gallery intent.
Thank you in advance
Here is solution :
ImageView image = (ImageView)findViewById(R.id.myImage);
File root = Environment.getExternalStorageDirectory();
String path = root.getAbsolutePath();
path = path + File.separator + "myfile.jpg"; //where you image file located
Bitmap myBitmap = BitmapFactory.decodeFile(path);
image.setImageBitmap(myBitmap);
I got json data in this way:
{"data":[{"img_name":"abc.jpeg","img_path":"6"}]}
Now How can I display this image in image view in my android application.Please help me to solve.
Not sure if this is what you want.
First you need to parse the JSON and get the img_path and img_name. Then you can create the url of the image. The url generation logic depends on your server logic.
Something like this,
JSONObject data = new JSONObject(your_json_data);
String img_path = data.getString("img_path");
String img_name = data.getString("img_name");
String url = "http://xxx.xxx.x.x/" + img_path + "/" + img_name;
Use an imageloader like Picasso to load the image.
I have a video and I need a thumbnail image for that video for android.This is what I created for iOS.
player.requestThumbnailImagesAtTimes([1],Titanium.Media.VIDEO_TIME_OPTION_NEAREST_KEYFRAME, function(response) {
if(response.success) {
var f = Titanium.Filesystem.getFile(Titanium.Filesystem.applicationDataDirectory, videoName + ".png");
f.write(response.image);
So? What about android? How can it be done? This is what I done video capture for android. How can I create a thumbnail image for this?
var intent = Titanium.Android.createIntent({
action : 'android.media.action.VIDEO_CAPTURE' //android.provider.MediaStore.ACTION_VIDEO_CAPTURE
});
intent.putExtra("android.intent.extra.durationLimit", 15);
You can get the thumbnail bitmap of video file by using code given below :
Bitmap bmThumbnail = ThumbnailUtils.createVideoThumbnail(filePath, MediaStore.Video.Thumbnails.MINI_KIND);
I have made an android app,In that in an activity I have one imageView,I want to display an image to it using imageLoader,I have been used so many time imageloader,But i got this type of error Image can't be decoded ,My code is as below,Please help me for it,
code
iv_profile = (ImageView) findViewById(R.id.iv_profile);
imageLoader = ImageLoader.getInstance();
imageLoader.init(ImageLoaderConfiguration.createDefault(HomeActivity.this));
options = new DisplayImageOptions.Builder().cacheOnDisc(true).showStubImage(R.drawable.noimage).showImageOnFail(R.drawable.noimage).build();
String img = "http://tp.epagestore.in/" + Pref.getValue(HomeActivity.this, Const.PREF_PHOTO, "");
imageLoader.displayImage(img, iv_profile, options);
I connected GPUImage library for android, everything works pretty nice, but when i try to load image it crops and size is very small, how can i load and save pic in full size?
This is my code for save photo wit full resolution using GPUImage :
private void startSavePhoto(String originalPhotoFilePath) {
final String TEMP_FOLDER = AppConst.PATH_FILE_SAVE_PHOTO + AppConst.PATH_FILE_SAVE_TEMP;
ExtraUtils.createFolder(TEMP_FOLDER);
final String TEMP_FILE_NAME = ".ImageEffect.png";
// Save Photo based on original file
Bitmap source = BitmapFactory.decodeFile(originalPhotoFilePath);
String pathFile = TEMP_FOLDER + File.separator + TEMP_FILE_NAME;
Bitmap bitmap = gpuImage.getGPUImage().getBitmapWithFilterApplied(source);
// Bitmap to File
if (ExtraUtils.saveBitmapToPNG(bitmap, pathFile)) {
showSaveWithAdsDialog(pathFile);
} else {
T.show(R.string.error_save_image);
}
}