Nice, thanks for the link...

I just tried only to launch the email intent, but I get a force close error
as soon as I press the button Email...if someone could help me find the
error, that would be great..


package com.mobilevideoeditor.moved;



import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.BaseAdapter;
import android.widget.GridView;
import android.widget.ImageView;
import android.widget.AdapterView.OnItemClickListener;

public class ShareGalleryView extends Activity {

public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.videogrid);

        GridView vGrid=(GridView) findViewById(R.id.vgrid);
        registerForContextMenu(vGrid);
        vGrid.setAdapter(new VideoAdapter(this));


        vGrid.setOnItemClickListener(new OnItemClickListener() {


@Override
public void onItemClick(AdapterView<?> parent, View v,
int position, long id) {
// TODO Auto-generated method stub
 openOptionsMenu();
  }

        });
    }
@Override
public boolean onCreateOptionsMenu(Menu menu) {

  MenuInflater inflater = getMenuInflater();
  inflater.inflate(R.menu.menu_gallery_share, menu);
  return super.onCreateOptionsMenu(menu);
}
@Override
public boolean onOptionsItemSelected (MenuItem item){
 if (item.getItemId() == R.id.menu_facebook)
{
 //TODO open fb
return true;
 }
else if (item.getItemId() == R.id.menu_youtube)
{
//TODO open youtube
return true;
 }
else if (item.getItemId() == R.id.menu_email)
{

Intent i = new Intent(Intent.ACTION_SEND);
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
//i.setType("image/jpg");
//i.putExtra(Intent.EXTRA_STREAM, Uri.parse("file:///sdcard/Pictures/
//image.jpg"));
startActivity(i);
 return true;
 }
else if (item.getItemId() == R.id.menu_bluetooth)
{
// TODO send via bluetooth
return true;
 }
 return super.onContextItemSelected(item);
}
    public class VideoAdapter extends BaseAdapter {
     private Context mContext;

public VideoAdapter(Context c) {
    mContext = c;
    }

    public int getCount() {
        return mThumbIds.length;
    }

    public Object getItem(int position) {
        return null;
    }

    public long getItemId(int position) {
        return 0;
    }

    // create a new ImageView for each item referenced by the Adapter
    public View getView(int position, View convertView, ViewGroup parent) {
        ImageView imageView;
        if (convertView == null) {  // if it's not recycled, initialize some
attributes
            imageView = new ImageView(mContext);
            imageView.setLayoutParams(new GridView.LayoutParams(85, 85));
            imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
            imageView.setPadding(8, 8, 8, 8);
        } else {
            imageView = (ImageView) convertView;
        }

        imageView.setImageResource(mThumbIds[position]);
        return imageView;
    }

    // references to our images
    private Integer[] mThumbIds = {
            R.drawable.sample_2, R.drawable.sample_3,
            R.drawable.sample_4, R.drawable.sample_2,
            R.drawable.sample_6, R.drawable.sample_3,
            R.drawable.sample_4, R.drawable.sample_1

    };

    }


}





On Fri, Jul 16, 2010 at 1:02 AM, Mark Murphy <[email protected]>wrote:

> On Thu, Jul 15, 2010 at 7:49 PM, Victoria Busse
> <[email protected]> wrote:
> > Okay I see :) Thank you Mark :) I will just stick with
> onClickItemListener
> > then
> > Then there is only my final question left: is it possible to e.g. choose
> the
> > Email option in the menu and attach the item, which I used to open the
> menu
> > with, to an email? If this is possible how would I best do that??
>
>
> http://stackoverflow.com/questions/1247983/problem-sending-an-email-with-an-attachment-programmatically
>
> --
> Mark Murphy (a Commons Guy)
> http://commonsware.com | http://github.com/commonsguy
> http://commonsware.com/blog | http://twitter.com/commonsguy
>
> _The Busy Coder's Guide to Android Development_ Version 3.1 Available!
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Beginners" group.
>
> NEW! Try asking and tagging your question on Stack Overflow at
> http://stackoverflow.com/questions/tagged/android
>
> To unsubscribe from this group, send email to
> [email protected]<android-beginners%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/android-beginners?hl=en
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en

Reply via email to