save

How do I save an ImageView as an image?

冷暖自知 提交于 2019-12-18 05:46:25
问题 I have an ImageView with a share intent( which works great, brings up all the apps I can share the image with), however, I can not share the photo because it has no path on my phone. How do I go about saving the ImageView on my phone? Below is my code. public void taptoshare(View v) { View content = findViewById(R.id.myimage); content.setDrawingCacheEnabled(true); Bitmap bitmap = content.getDrawingCache(); File file = new File("/DCIM/Camera/image.jpg"); try { file.createNewFile();

Saving a batch variable in a text file

情到浓时终转凉″ 提交于 2019-12-18 05:00:30
问题 I am trying to save a batch variable into a text file. I currently have this code: @echo off Set var=6 @echo %var%>txt.txt For /f "tokens*" %%i in (txt.txt) do @echo %%i Pause It's supposed to save the 6 into the variable var and then write the variable in a text file. I want to do this to save user input into a text file so that when the batch program is terminated it will hold the variables. 回答1: There is a little problem with redirection. You are redirecting a "stream"; they are numbered 0

Saving output of a for-loop to file

瘦欲@ 提交于 2019-12-18 04:28:11
问题 I have opened a file with blast results and printed out the hits in fasta format to the screen. The code looks like this: result_handle = open("/Users/jonbra/Desktop/my_blast.xml") from Bio.Blast import NCBIXML blast_records = NCBIXML.parse(result_handle) blast_record = blast_records.next() for alignment in blast_record.alignments: for hsp in alignment.hsps: print '>', alignment.title print hsp.sbjct This outputs a list of fasta files to the screen. But how can I create a file and save the

android - save image from web server and set it as wallpaper

白昼怎懂夜的黑 提交于 2019-12-18 03:49:13
问题 Can anyone please provide me some idea/guidance on how to save an image from a webserver and set it as wallpaper? i am developing an android application which needs to do that and i am new in android. Thanks a lot. I had tried writing my own code but it doesn't work as i can't find my images after download but the wallpaper has change to the downloaded picture. here is my existing code. Bitmap bmImg; void downloadFile(String fileUrl) { URL myFileUrl = null; try { myFileUrl = new URL(fileUrl);

Save Icon File To Hard Drive

会有一股神秘感。 提交于 2019-12-18 03:35:11
问题 I know that this must be incredibly easy - It's unbelievable how long I have searched for an answer to this question based on how simple it is in VB6. I simply want to extract an Icon from an EXE File using Icon.ExtractAssociatedIcon, and then save this icon file to my hard drive. So, here is what I have, and I will also show you what I have tried so you don't think I'm being lazy. OpenFileDialog ofd = new OpenFileDialog(); ofd.ShowDialog(); string s = Environment.GetFolderPath(Environment

Saving to SD card as text file

二次信任 提交于 2019-12-17 23:35:04
问题 stopWriting = (Button) findViewById(R.id.save); stopWriting.setOnClickListener(new OnClickListener() { @SuppressLint("SdCardPath") public void onClick(View v) { // stop recording the sensor data try { myFile = new File("/sdcard/SensorData/" + txtData.getText() + ".txt"); myFile.createNewFile(); sData = new FileOutputStream(myFile); myOutWriter = new OutputStreamWriter(sData); myBufferedWriter = new BufferedWriter(myOutWriter); myPrintWriter = new PrintWriter(myBufferedWriter); //if(myFile !=

Out of memory problem saving large BufferedImage

ぐ巨炮叔叔 提交于 2019-12-17 19:50:43
问题 I have a problem saving large (f.e. 12 000 x 9 000 ) images. I'm developing a graphical editing software ( something like simple Photoshop ) and The user obviously has to have to ability to save the image. Lets say I would like to save the image as .png. Does JAVA always need to use the BufferedImage for saving drawn stuff ? I know the equation for size of the image is: Xsize * Ysize * 4 ( red, green, blue, alpha ) So in this case we get over 400 MB. I know I could save the image in parts (

iOS: Can't save file to 'Application Support' folder, but can to 'Documents'

只谈情不闲聊 提交于 2019-12-17 17:38:15
问题 I can download and save a binary file to the 'Documents' folder with a custom name perfectly fine. If I just change the URL to the 'Application Support' folder instead of the 'Documents' folder, it fails to write to that URL saying it doesn't exist. Here's the URL construction code: - ( NSURL * ) getSaveFolder { NSURL * appSupportDir = nil; NSURL * appDirectory = nil; NSArray * possibleURLs = [[NSFileManager defaultManager] URLsForDirectory:NSApplicationSupportDirectory inDomains

how to prevent the Image.FromFile() method to lock the file

青春壹個敷衍的年華 提交于 2019-12-17 16:21:37
问题 I am using following code to put JPG's into a DataGridView 's Image cell. If strFileName.ToLower.EndsWith(".jpg") Then Dim inImg As Image = Image.FromFile(strFileName) DataGridView4.Rows.Add() DataGridView4.Rows(DataGridView4.Rows().Count - 1).Cells(0).Value = inImg End If The problem is that I need to save this file from within the program, but i get the message that the file is beeing used by another program . So i tried to add inImg.Dispose() before the end if, but then the program doesnt

How can I save HICON to an .ico file?

坚强是说给别人听的谎言 提交于 2019-12-17 12:56:50
问题 I am extracting an icon from .exe/.dll and want to save it in an .ico file. What is the best way to do this? I have tried to use ::OleCreatePictureIndirect() and then IPicture->SaveAsFile() . It works but transparent parts of the icon are painted black (and obviously are not transparent any more :( ). I tried manual parsing. It works OK but is cumbersome and I am afraid of complications with Vista icons/.icl files/etc. Please, help. Thanks. 回答1: You can save HICON s with the IPicture: