Re: [android-beginners] onItemSelectListener or onItemClickListener, both or none???

2010-07-15 Thread Mark Murphy
On Thu, Jul 15, 2010 at 6:53 PM, kivy victoriasarabu...@gmail.com wrote:
 When I use the onClickItemListener together with openOptionsMenu();
 the menu opens, but the item doesn't get selected.

Correct.

 Now, when I use the onSelectedItemListener I cannot click on the item
 on the emulator's touchscreen to select it but have to use the
 phone's keys.

That's the definition of selection in Android.

 Is there any way to combine both things, so that I select a GridView
 item on the touchscreen

You don't select items in Android via the touchscreen.

http://developer.android.com/resources/articles/touch-mode.html

-- 
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
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en


Re: [android-beginners] onItemSelectListener or onItemClickListener, both or none???

2010-07-15 Thread Victoria Busse
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??



On Fri, Jul 16, 2010 at 12:04 AM, Mark Murphy mmur...@commonsware.comwrote:

 On Thu, Jul 15, 2010 at 6:53 PM, kivy victoriasarabu...@gmail.com wrote:
  When I use the onClickItemListener together with openOptionsMenu();
  the menu opens, but the item doesn't get selected.

 Correct.

  Now, when I use the onSelectedItemListener I cannot click on the item
  on the emulator's touchscreen to select it but have to use the
  phone's keys.

 That's the definition of selection in Android.

  Is there any way to combine both things, so that I select a GridView
  item on the touchscreen

 You don't select items in Android via the touchscreen.

 http://developer.android.com/resources/articles/touch-mode.html

 --
 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
 android-beginners+unsubscr...@googlegroups.comandroid-beginners%2bunsubscr...@googlegroups.com
 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
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en


Re: [android-beginners] onItemSelectListener or onItemClickListener, both or none???

2010-07-15 Thread Mark Murphy
On Thu, Jul 15, 2010 at 7:49 PM, Victoria Busse
victoriasarabu...@gmail.com 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
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en


Re: [android-beginners] onItemSelectListener or onItemClickListener, both or none???

2010-07-15 Thread Victoria Busse
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 mmur...@commonsware.comwrote:

 On Thu, Jul 15, 2010 at 7:49 PM, Victoria Busse
 victoriasarabu...@gmail.com 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
 android-beginners+unsubscr...@googlegroups.comandroid-beginners%2bunsubscr...@googlegroups.com
 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

Re: [android-beginners] onItemSelectListener or onItemClickListener, both or none???

2010-07-15 Thread Mark Murphy
On Thu, Jul 15, 2010 at 8:38 PM, Victoria Busse
victoriasarabu...@gmail.com wrote:
 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..

Use adb logcat, DDMS, or the DDMS perspective in Eclipse to examine
the Java stack trace associated with your force close error.

-- 
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
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en


Re: [android-beginners] onItemSelectListener or onItemClickListener, both or none???

2010-07-15 Thread Mark Murphy
On Thu, Jul 15, 2010 at 9:30 PM, Victoria Busse
victoriasarabu...@gmail.com wrote:
 I just did that and at first I thought it was because I forgot to give the
 activity an intent filter within the manifest.xml, but after I have done
 that now,
 I still got the problem
 I attached the output to this mail.

You are missing some key pieces of information, like the thing to send.

http://www.androidguys.com/2009/11/02/a-call-to-action-action_send-that-is/

-- 
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
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en


Re: [android-beginners] onItemSelectListener or onItemClickListener, both or none???

2010-07-15 Thread Victoria Busse
Thank you so much, Mark...

It works now :)

I completely missed out to send content! Guess it's a bit late... with 3 am
in the morning I shouldn't program any longer :)

THANK YOU AGAIN and Good Night

On Fri, Jul 16, 2010 at 2:45 AM, Mark Murphy mmur...@commonsware.comwrote:

 On Thu, Jul 15, 2010 at 9:30 PM, Victoria Busse
 victoriasarabu...@gmail.com wrote:
  I just did that and at first I thought it was because I forgot to give
 the
  activity an intent filter within the manifest.xml, but after I have done
  that now,
  I still got the problem
  I attached the output to this mail.

 You are missing some key pieces of information, like the thing to send.

 http://www.androidguys.com/2009/11/02/a-call-to-action-action_send-that-is/

 --
 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
 android-beginners+unsubscr...@googlegroups.comandroid-beginners%2bunsubscr...@googlegroups.com
 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
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en