Android Action Bar

http://blog.csdn.net/yuxlong2010/article/details/9299507  Action Bar讲的够详细啦!

关于ShareActionProvider:

1。分享文字:http://www.tuicool.com/articles/mAR7Zb

    Intent intent = new Intent(Intent.ACTION_SEND);
     intent.putExtra(Intent.EXTRA_TEXT, "这里是要分享的文字");
     intent.setType("text/plain");
     Intent.createChooser(intent, "Share");
     return intent;

2。分享图片:APIDemo: app---->actionbar--->Action Provider

        Intent shareIntent = new Intent(Intent.ACTION_SEND);
        shareIntent.setType("image/*");
        Uri uri = Uri.fromFile(getFileStreamPath("shared.png"));
        shareIntent.putExtra(Intent.EXTRA_STREAM, uri);
        return shareIntent;

       inputStream = getResources().openRawResource(R.raw.robot);
            outputStream = openFileOutput(SHARED_FILE_NAME,
                    Context.MODE_WORLD_READABLE | Context.MODE_APPEND);
            byte[] buffer = new byte[1024];
            int length = 0;
            try {
                while ((length = inputStream.read(buffer)) > 0){
                    outputStream.write(buffer, 0, length);
                }
            } catch (IOException ioe) {
                /* ignore */
            }

 

 

你可能感兴趣的:(Android Action Bar)