android - Able to insert passed image value into sdcard? -


As asked, is this possible? Here is part of my code. I do not know how to change it, please help me!

  bundle b = new_interity.ice.agentent (). GetExtras ();  

string s1 = b.getString ("image");

Try {"/ sdcard / myimages"). Mkdirs ();

In InputStream = getResources (). OpenRawResource (imageSID [status]);

file f2 = new file ("/ sdcard / myimages" + file name [status]);

OutputStream Out = New FileAutputed Stream (F2);

Byte [] buf = new byte [1024];

int lane;

While ((lane = in read (buff))> 0) {

Out. Written (buff, 0, lane); }

in.close ();

out.close ();

} hold (exception x) {

Toast MakeText (getBaseContext (), "Error!", Toast.LnnGHHRT) Show ();

}

And yes, the toast came in error!

It seems that you are missing a trailing slash on this line:

  file f2 = new file ("/ sdcard / myimages" + file name [status]);  

However, I do not think it will crash - it will just cause the image to be written in the wrong file. Can you post a stack trace? It will help to know which line you are crashing on.


Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -