How do I take a screenshot in appcelerator using a click event and send it using email? I have developed a floating action bar and want to associate a click event with it that takes a screenshot of the current screen and then opens an email dialog.
I tried the following:
$.btnScreen.addEventListener("click",function(e){ Ti.Media.takeScreenshot(function(){
I see you're calling the right method, but you're not actually capturing the blob. You should do something along these lines: (keep in mind, email dialog doesn't work in simulator)
Ti.Media.takeScreenshot(function(blob){
var dialog = Ti.UI.createEmailDialog();
dialog.addAttachment(blob.media);
dialog.open();
});
Related
How can I simulate; app has stopped
After I click a button? I'm trying to make my program display that (exactly) after I click a button.
easy way to do this is,
let your app crash in the first place ( cause some sort of exception) take a screenshot from that exact message.
Create a new form called mCrashForm, place a picturebox with the screenshot of that message ( leave out the close Program button.
Create a button in your main Form to open the crashForm with mCrashForm.Show()
Create a Button in mCrashForm which says "Close program" which executes this code snippet when pressed mCrashForm.Close()
In my application I perform an operation which causes an internal Android app to pop up AlertDialog over my application.
Is it possible to somehow dismiss this Dialog programmatically? Unfortunately I can't find the access to this Dialog object.
I've tried overriding onCreateDialog() method in my Activity, but as my Activity is not an originator of Dialog window, this method is not being called when it pops up.
I was also thinking about getting list of all objects that appear on the screen, but I assume there's no such method?
To my understanding you are doing something that is requiring some user interaction, like bluetooth pairing, in which case this Dialog is brought up by the system... possibly (System Dialog) which is not controlled by you. To solve this...
One thing you can try is:
Intent closeDialog = new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
sendBroadcast(closeDialog);
public static final String ACTION_CLOSE_SYSTEM_DIALOGS
Added in API level 1 Broadcast Action: This is broadcast when a user
action should request a temporary system dialog to dismiss. Some
examples of temporary system dialogs are the notification window-shade
and the recent tasks dialog.
Constant Value: "android.intent.action.CLOSE_SYSTEM_DIALOGS"
In my iPad application, I am playing some PDF and Video files. In the application user have option to email these files to himself or a friend. Email functionality is working fine and email gets delivered too. However, when user presses send button to send the email it freezes the application for sometime, also, when user presses Save Draft button to save that email, it freezes too. I think this happens because of large size of the PDF or Video file being attached and since it takes time to attach a file. When app freezes it seems like as if the iPad has hung or the app is crashing. However, it is working fine. But it doesn't look good. That is why I need to apply an activity indicator when Send or Save Draft button is pressed. It should work till the file is attached. I would apply an activity indicator, but not sure how to apply it on Send and Save Draft buttons as they come automatically in Email modal view controller.
Thanks in advance
PC
I have also experienced the same problem. Not because of the size of an attachment. It happens arbitrarily, Here's a workaround:
Enter anything in the "To:" field and then immediately backspace over it.
The "Send" and "Cancel" buttons should start working again.
If not, Quit Mail by double tapping the "Home" key, press and hold the "Mail" icon, when a minus signal shows press it on the "Mail" icon.
Relaunch mail. Your previous work should be intact.
Hope this helps.
I am facing a strange hang issue with IKPictureTaker and on clicking a "Choose" button. I am doing below operation using IKPictureTaker.
When a user wants to change a profile picture, upon clicking "Change Image" button, I display a IKPictureTaker view along with "Choose" button by setting IKPictureTakerAllowsFileChoosingKey to YES.
First time on clicking the "Choose" button, open panel will be displayed allowing user to select an image of his choice.
Next, on clicking the "Set" button, internally I am calling a profile picture upload function of a server in a separate thread and everything works great.
Next if the user tries to do the operation 1) and 2) again application hangs on clicking the "Choose" button.
After investigation I found that this issue is something to do with the background upload operation I am doing with the server.Because if I comment the upload part of code everything looks good.
I don't see any issues with the upload operation performed in the separate thread and it gives up it s runloop once it is done with its upload operation and all UI related operations again taken care in the main thread.
Application hangs only if I click on the "Choose" button. If I select the recent pictures or take a new photo using the camera everything works great.
Is there anyone who faced the same issue? Is it something to do with the NSOpenPanel displayed when we click on the "Choose" button?
I am working on an application for iPad. This application has some PDF files and some mp4 videos. I have a share icon on the navigation bar. When the user clicks on the share icon it shows option to email or print that particular file. I want to add both email and print facility to all the pdf files and only email facility to all videos. I need help in getting this done. Help with code would be great.
Any help will be highly appreciated.
Regards
PC
How to send email: How can I send mail from an iPhone application
How to print: http://cocoacoding.com/2011/05/01/airprint-tutorial/
How to create an action sheet: http://ykyuen.wordpress.com/2010/04/14/iphone-uiactionsheet-example/
Put it all together:
Add an Action Sheet button to your UI.
Create action sheet with options for email and printing, depending on the content.
Depending on the clicked button, start sending an email or printing.