Access Picasa in android: PicasaUploadActivity

I am new to Android and I am struggling to figure out what tools are available to me. I am developing for Android 2.0.1 now, simply because this is what my device is working with.

In particular, I am writing an application that would like to upload images to a Picasa album . I am pretty sure that this is supported; for example, the built-in (Google?) photo viewer has a “share” button with Picasa parameter and even a small example code snippet, including a snippet

[borrowed code! sorry if this is against the rules.]

temp.setComponent(new ComponentName 
("com.google.android.apps.uploader", 
"com.google.android.apps.uploader.picasa.PicasaUploadActivity")); 
startActivityForResult(temp, PICASA_INTENT) 

which looks exactly what I want.

But I can’t find the documentation anywhere. I really don't quite understand how to use this type of resource. Inside Eclipse, do I need to include another project com.google.android.apps.uploader? If so, how do I get it? How to enable it? Is there any working code sample I need to take a peek?

+5
source share
2 answers

video Google I / O 2011 - Best Practices for Accessing the Google APIs on Android (40 min.)

public class PostPhotoActivity extends Activity
{

@Override
protected void onCreate(Bundle savedInstanceState)
{
    super.onCreate(savedInstanceState);

    try
    {
        HttpRequestFactory requestFactory = new NetHttpTransport().createRequestFactory();
        Intent intent = getIntent();
        Bundle extras = intent.getExtras();
        InputStreamContent content = new InputStreamContent();
        ContentResolver contentResolver = getContentResolver();
        Uri uri = (Uri) extras.getParcelable(Intent.EXTRA_STREAM);
        content.inputStream = contentResolver.openInputStream(uri);
        Cursor cursor = contentResolver.query(uri, null, null, null, null);
        cursor.moveToFirst();
        content.type = intent.getType();
        content.length = cursor.getLong(cursor.getColumnIndexOrThrow(Images.Media.SIZE));
        HttpRequest request = requestFactory.buildPostRequest(new GenericUrl(
            "https://picasaweb.google.com/data/feed/api/user/default/albumid/default"), content);
        GoogleHeaders headers = new GoogleHeaders();
        request.headers = headers;
        String fileName = cursor.getString(cursor.getColumnIndexOrThrow(Images.Media.DISPLAY_NAME));
        headers.setSlugFromFileName(fileName);
        request.execute().ignore();
    }
    catch (IOException e)
    {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}

}
+2
source

see android developers: picasa :

, picasa ( u r workin in 1.5), ur - picasa, , ... it google, ... if ur sm sm...

, , Activity .

0

All Articles