I’m following the tutorial for sending a picture from your Android phone to a web server. The tutorial is here:
http://blog.sptechnolab.com/2011/03/09/android/android-upload-image-to-server/
Unfortunately, I’ve run across a few errors when I paste the java code into my file:
Bitmap bitmapOrg = BitmapFactory.decodeResource(getResources(), R.drawable.a1);
// a1 cannot be resolved or is not a field
And this:
String ba1 = Base64.encodeBytes(ba);
// The method encodeBytes(byte[]) is undefined for the type Base64
I’ve read further down in the comments and they say I should replace the latter code with this:
String ba1 = Base64.encodeToString(ba, 0);
But this still doesn’t work, saying that there’s an extra value in it (and removing the extra value still requires me to change a value to ‘static’ through Eclipse’s error system.
I’ve read through all of the comments on the blog below and tried the remedies, and nothing seems to work. Does anybody know the problem, or if there’s a library that I’m missing that I can import (and how would I go about importing it?)
First you should have a drawable named a1(E.g. a1.png, a1.jpg, …) in your drawable folder.
Refer to this link, there is no such method in the
Base64class.http://developer.android.com/reference/android/util/Base64.html
Try this instead: