Titanium JIRA Archive
Appcelerator Community (AC)

[AC-3112] Intent Result Activity return Image objects is null

GitHub Issuen/a
TypeBug
Priorityn/a
StatusClosed
ResolutionNeeds more info
Resolution Date2013-01-22T14:16:30.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsTitanium SDK & CLI
Labelsandroid, image, intent, resultactivit
ReporterGnanaoly
AssigneeBetty Tran
Created2012-07-18T23:44:00.000+0000
Updated2016-03-08T07:48:10.000+0000

Description

The Android intent result activity will get the image objects and image path. But Titanium supporting only for returning the image path . Please review my queries and let me know. Huawei U8650 will returning the image path is null. "It will return the image object." I have explained the both titanium and android code : The Titanium intent result activity not supporting the object return. var win = Ti.UI.createWindow(); var address = "Take the Picture"; var lblAddress = Titanium.UI.createLabel({ text: "link an adress :)", color: 'blue', font: { fontSize: 14, fontWeight: 'normal' }, width: 'auto', textAlign: 'left', top: 1, left: 10, height: 'auto' }); var intent; lblAddress .addEventListener('click',function(){ intent = Titanium.Android.createIntent({ action: 'android.media.action.IMAGE_CAPTURE',type: 'jpg' }); var ImageUri = null var fileNativePath1 = null; Titanium.Android.currentActivity.startActivityForResult(intent, function(e) { if (e.error) { Ti.UI.createNotification({ duration: Ti.UI.NOTIFICATION_DURATION_LONG, message: 'Error: ' + e.error }).show(); } else { if (e.resultCode === Titanium.Android.RESULT_OK) { fileNativePath1 = e.intent.data; // Huawei U8650 will returning the image path is null var image1 = fileNativePath1; var tmp = jpglib.Resize(fileNativePath1,activity2);// code for resizing the image anImageView.image = tmp; var img1str = Ti.Utils.base64encode(tmp); var setimg1str = Ti.App.Properties.setString('getimg1str', img1str); } } }); }); win.add(lblAddress); win.open();

Comments

  1. Betty Tran 2012-11-21

    Hi Gnanaoly, I am able to return the image path using the following code:
       var win = Ti.UI.createWindow({
       	backgroundColor: 'pink',
       	exitOnClose: false
       });
       
       win.open();
       
       var button = Ti.UI.createButton({
       	title : 'button',
       	height : Ti.UI.SIZE,
       	width : Ti.UI.SIZE
       });
       
       button.addEventListener('click', function() {
       	var intent = Ti.Android.createIntent({
       		action: 'android.media.action.IMAGE_CAPTURE'
       	});
       	intent.addCategory(Ti.Android.CATEGORY_DEFAULT);
       	//intent.putExtraUri('android.media.EXTRA_OUTPUT', Ti.Filesystem.resourcesDirectory);
       	
       	Ti.Android.currentActivity.startActivityForResult(intent, function(e){
       		
       		alert(JSON.stringify(e));
       	});
       });
       
       win.add(button);
       
    Are you able to return the image path using the code?

JSON Source