[android-developers] Log in a file

2010-07-24 Thread ReyLith
Hi,

I'm developing an image editor application for Android. I have a big
problem: I haven't a mobile with Android. I found a person that helps
me to test the application and I found many problems. The application
works in the emulator perfectly but in the mobile the application
constantly mistakenly ends. I want to print a log similar that the
show in ddms in a file on the SDCard. I did it with a FileWriter but
it isn't the same that I can see in ddms.

Is it possible to show the same output as ddms in a file?

If not possible I would like to get as much information as possible.
The person who has the mobile don't have knowledge of programming and
I have not got close.

I need help urgently please. Thank you very much in advance. Thanks,

JESÚS

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: OutOfMemoryError with Bitmap

2010-07-24 Thread ReyLith
First of all thank you very much everyone for your help.

I continue with a problem. I use Runtime.getRuntime().freeMemory() for
obtain the free memory and compare it with the real Bitmap memory.
Sometimes I get a free memory less than that occupied by the image.
However, if I remove the restriction on the size of the image, I can
work with it without any problem. Am I using an incorrect function to
get the free memory?. Should I use another function?

Thank you very much in advance.

On 23 jul, 20:40, DanH danhi...@ieee.org wrote:
 Close as I can tell, you use a BitmapFactory.Options and put a
 BitmapConfig constant in that that specifies the type of internal
 representation you want.  If you use ARGB_ then each pixel will be
 64 bits.  ARGB_ -- 32 bits, RGB_565 -- 16 bits.

 On Jul 23, 12:21 pm, ReyLith jesus...@gmail.com wrote:



  Thanks Nathan.

  With this option I can obtain the image characteristics but I don't
  know the option that indicates me the depth of the pixel. Width and
  Height are in outWidth and outHeight but I don't know where is the
  depth. I thought use the getRowBytes() of Bitmap and product it with
  getHeight() of Bitmap, but I don't know if there is correct.

  On 23 jul, 18:52, Nathan nathan.d.mel...@gmail.com wrote:

   If you can get the width and height for the image without completely
   opening it, then use the width*height*depth.

   You probably have to use this option:

  http://developer.android.com/intl/de/reference/android/graphics/Bitma...

   Nathan

   On Jul 23, 9:30 am, ReyLith jesus...@gmail.com wrote:

So, how can I obtain the depth for know if I can work with the image?

On 23 jul, 18:18, DanH danhi...@ieee.org wrote:

 The size of an image file depends greatly on the compression
 techniques used to create it.  Virtually all image formats involve
 some sort of compression such that the total number of bits in the
 file is considerably less than the (width * height * depth) number
 that represents the raw image.

 On Jul 23, 7:27 am, ReyLith jesus...@gmail.com wrote:

  Hi again,

  I'm trying to put a message when the image is so big. For this I 
  think
  to obtain the size of the file and compare it with the free memory
  Runtime.getRuntime().getFreeMemory()). It works well but I have a 
  new
  problem. The application show an error message with some images
  because they are so big and the application dont't detect the 
  problem.
  I research in other posts and the problem is that the file size is
  different from the size of the image in memory. To get the size of 
  the
  image in memory I use the product getHeight () * getRowBytes () of 
  the
  Bitmap class, but with some images not previously had problems, I 
  get
  very large sizes, so often I get the message erroneously.

  Does anyone know how could solve this problem?

   Thank you very much in advance.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: How to use repaint() method in Android...

2010-07-23 Thread ReyLith
I'm not sure but I think that if you use invalidate(), onDraw function
will be called.

On 22 jul, 10:18, blessu76 bless...@gmail.com wrote:
 Hi
 If i use repaint() method.I got error message.
 What is the solution for that.Can we use repaint() in android.If not
 what is the alternate solution for it?
 Thanks

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: OutOfMemoryError with Bitmap

2010-07-23 Thread ReyLith
Hi again,

I'm trying to put a message when the image is so big. For this I think
to obtain the size of the file and compare it with the free memory
Runtime.getRuntime().getFreeMemory()). It works well but I have a new
problem. The application show an error message with some images
because they are so big and the application dont't detect the problem.
I research in other posts and the problem is that the file size is
different from the size of the image in memory. To get the size of the
image in memory I use the product getHeight () * getRowBytes () of the
Bitmap class, but with some images not previously had problems, I get
very large sizes, so often I get the message erroneously.

Does anyone know how could solve this problem?

 Thank you very much in advance.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: OutOfMemoryError with Bitmap

2010-07-23 Thread ReyLith
So, how can I obtain the depth for know if I can work with the image?

On 23 jul, 18:18, DanH danhi...@ieee.org wrote:
 The size of an image file depends greatly on the compression
 techniques used to create it.  Virtually all image formats involve
 some sort of compression such that the total number of bits in the
 file is considerably less than the (width * height * depth) number
 that represents the raw image.

 On Jul 23, 7:27 am, ReyLith jesus...@gmail.com wrote:



  Hi again,

  I'm trying to put a message when the image is so big. For this I think
  to obtain the size of the file and compare it with the free memory
  Runtime.getRuntime().getFreeMemory()). It works well but I have a new
  problem. The application show an error message with some images
  because they are so big and the application dont't detect the problem.
  I research in other posts and the problem is that the file size is
  different from the size of the image in memory. To get the size of the
  image in memory I use the product getHeight () * getRowBytes () of the
  Bitmap class, but with some images not previously had problems, I get
  very large sizes, so often I get the message erroneously.

  Does anyone know how could solve this problem?

   Thank you very much in advance.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: OutOfMemoryError with Bitmap

2010-07-23 Thread ReyLith
Thanks Nathan.

With this option I can obtain the image characteristics but I don't
know the option that indicates me the depth of the pixel. Width and
Height are in outWidth and outHeight but I don't know where is the
depth. I thought use the getRowBytes() of Bitmap and product it with
getHeight() of Bitmap, but I don't know if there is correct.

On 23 jul, 18:52, Nathan nathan.d.mel...@gmail.com wrote:
 If you can get the width and height for the image without completely
 opening it, then use the width*height*depth.

 You probably have to use this option:

 http://developer.android.com/intl/de/reference/android/graphics/Bitma...

 Nathan

 On Jul 23, 9:30 am, ReyLith jesus...@gmail.com wrote:



  So, how can I obtain the depth for know if I can work with the image?

  On 23 jul, 18:18, DanH danhi...@ieee.org wrote:

   The size of an image file depends greatly on the compression
   techniques used to create it.  Virtually all image formats involve
   some sort of compression such that the total number of bits in the
   file is considerably less than the (width * height * depth) number
   that represents the raw image.

   On Jul 23, 7:27 am, ReyLith jesus...@gmail.com wrote:

Hi again,

I'm trying to put a message when the image is so big. For this I think
to obtain the size of the file and compare it with the free memory
Runtime.getRuntime().getFreeMemory()). It works well but I have a new
problem. The application show an error message with some images
because they are so big and the application dont't detect the problem.
I research in other posts and the problem is that the file size is
different from the size of the image in memory. To get the size of the
image in memory I use the product getHeight () * getRowBytes () of the
Bitmap class, but with some images not previously had problems, I get
very large sizes, so often I get the message erroneously.

Does anyone know how could solve this problem?

 Thank you very much in advance.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] OutOfMemoryError with Bitmap

2010-07-22 Thread ReyLith
Hi,

I'm developing an image editor for Android. When I do some operations
with small pictures (600x600 - 1024x768), the program work well. But
when I do some opeations with big pictures, I always obtain an
OutOfMemory Error. I read read many post trying to have the image in
memory. Also I looked at the Android's Gallery, trying to simulate the
effect of loading the image with lower quality and get the complete
quality after a while. But I doesn't get to work with large images.

I thought of using the parameter inSampleSize but I raised the problem
of having to perform operations on the image and save it with the
original size, so it no longer serves me. The only thing I've done is
use the parameter inJustDecodeBounds and display an error to the user
if the image exceeds the available memory.

Is there any possibility of working with large images with no memory
problems?

I need urgent help. Thank you very much in advance. Thanks,

JESÚS

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: How to obtain ID of an image by the id of the thumbnails?

2010-07-22 Thread ReyLith
Thanks. However I achieve it by
MediaStore.Images.Thumbnails.getThumbnail, so now I haven't to match
the databases of Images and Thumbnails.

On 15 jul, 18:43, Tabman tabishfay...@gmail.com wrote:
 IMAGE_ID of the Thumbnail record is the id of the original image.

 On Jun 25, 2:27 pm, ReyLith jesus...@gmail.com wrote:



  Hi!

  I'm developing animageeditor for android. In the main activity, I
  get to show all images by viewing thethumbnailsto make the process
  faster. The problem it's that I need to process theimagelater and I
  would get the normalimageID(with theoriginalsize, which I think
  is in MediaStore.Images.Media). I can't get the form of the query. The
  code that I have is the following but I can't obtain the realimageID
  (in the IDImage variable):

          int columnIndex = 0;
          String[] projection = {MediaStore.Images.Thumbnails._ID,
  MediaStore.Images.Thumbnails.DATA};

          // It is necessary to use EXTERNAL_CONTENT_URI ofThumbnails
  because it contains the
          // littleimageand not theoriginal
          Cursor cursor =
  managedQuery(MediaStore.Images.Thumbnails.EXTERNAL_CONTENT_URI,
                                                           projection,
                                                           null,
                                                           null,
                                                           null);

          if(cursor != null)
          {
                  cursor.moveToPosition(position);

                  columnIndex =
  cursor.getColumnIndexOrThrow(MediaStore.Images.Thumbnails.DATA);
                  String imagePath = cursor.getString(columnIndex);

                  columnIndex =
  cursor.getColumnIndexOrThrow(MediaStore.Images.Thumbnails._ID);
                  String _IDThumbnails = cursor.getString(columnIndex);

                  String[] nProjection = {MediaStore.Images.Media._ID,
                                                                  
  MediaStore.Images.Media.PICASA_ID};
                  String nSelection = MediaStore.Images.ImageColumns.PICASA_ID
  +  =  + _IDThumbnails;

                  Cursor nCursor =
  managedQuery(MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
                                                                            
  nProjection, nSelection, null, null);

                  nCursor.moveToFirst();

                  columnIndex =
  cursor.getColumnIndexOrThrow(MediaStore.Images.Media._ID);
                  String _IDImage = cursor.getString(columnIndex);

                  FileInputStream is = null;
                  BufferedInputStream bis = null;
                  try
                  {
                          is = new FileInputStream(new File(imagePath));
                          bis = new BufferedInputStream(is);

                          // Imagen is a class that I have defined
                         image= new Imagen(BitmapFactory.decodeStream(bis),
  _IDImage);
                  }
                  catch(Exception e)
                  {

                  }
                  finally
                  {
                          try
                          {
                                  if(bis != null)
                                          bis.close();

                                  if(is != null)
                                          is.close();

                                  cursor.close();
                                  projection = null;
                          }
                          catch(Exception e)
                          {

                          }
                  }
          }

  Thank you. Regards,
  Jesús

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: OutOfMemoryError with Bitmap

2010-07-22 Thread ReyLith
Thanks for the info.

I also implements a gallery of thumbnails. I have many problems with
it but I get to remove them by using the
MediaStore.Images.Thumbnails.getThumbnail. Try to use it.

On 22 jul, 20:27, Joseph Earl joseph.w.e...@gmail.com wrote:
 Ran into sort of the same problem myself whilst developing an image
 gallery - my problem was that loading thumbnails of 5 or so of the
 images caused an out of memory error. Luckily I was able to implement
 inJustDecodeBounds and inSampleSize to reduce the quality of my
 thumbnails and that solved it in my case.

 In your case, you're just going to have to put a maximum limit on the
 memory of an image that your app will take. If the input source is
 larger than this then use inSampleSize to scale it. However it does
 you will mean unable to save the image at the same size as the source
 image, but from my experience this is common among mobile photo
 editing apps (going back a bit, the LG Viewty for instance could take
 5MP photos, but I think the photo editing app could only save them at
 around the resolution of 1MP).

 The other option might be to see if it is possible to load only
 portions of the bitmap (or you could cut it up before opening it in
 your program) and the piece these back together in a similar fashion
 to the Google Map tiles.

 On Jul 22, 1:12 pm, ReyLith jesus...@gmail.com wrote:



  Hi,

  I'm developing an image editor for Android. When I do some operations
  with small pictures (600x600 - 1024x768), the program work well. But
  when I do some opeations with big pictures, I always obtain an
  OutOfMemory Error. I read read many post trying to have the image in
  memory. Also I looked at the Android's Gallery, trying to simulate the
  effect of loading the image with lower quality and get the complete
  quality after a while. But I doesn't get to work with large images.

  I thought of using the parameter inSampleSize but I raised the problem
  of having to perform operations on the image and save it with the
  original size, so it no longer serves me. The only thing I've done is
  use the parameter inJustDecodeBounds and display an error to the user
  if the image exceeds the available memory.

  Is there any possibility of working with large images with no memory
  problems?

  I need urgent help. Thank you very much in advance. Thanks,

  JESÚS

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: How to obtain ID of an image by the id of the thumbnails?

2010-06-26 Thread ReyLith
Nobody?

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: Save image on SD card

2010-06-26 Thread ReyLith
Nobody?

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] How to obtain ID of an image by the id of the thumbnails?

2010-06-25 Thread ReyLith
Hi!

I'm developing an image editor for android. In the main activity, I
get to show all images by viewing the thumbnails to make the process
faster. The problem it's that I need to process the image later and I
would get the normal image ID (with the original size, which I think
is in MediaStore.Images.Media). I can't get the form of the query. The
code that I have is the following but I can't obtain the real image ID
(in the IDImage variable):

int columnIndex = 0;
String[] projection = {MediaStore.Images.Thumbnails._ID,
MediaStore.Images.Thumbnails.DATA};

// It is necessary to use EXTERNAL_CONTENT_URI of Thumbnails
because it contains the
// little image and not the original
Cursor cursor =
managedQuery(MediaStore.Images.Thumbnails.EXTERNAL_CONTENT_URI,
 projection,
 null,
 null,
 null);

if(cursor != null)
{
cursor.moveToPosition(position);

columnIndex =
cursor.getColumnIndexOrThrow(MediaStore.Images.Thumbnails.DATA);
String imagePath = cursor.getString(columnIndex);

columnIndex =
cursor.getColumnIndexOrThrow(MediaStore.Images.Thumbnails._ID);
String _IDThumbnails = cursor.getString(columnIndex);

String[] nProjection = {MediaStore.Images.Media._ID,

MediaStore.Images.Media.PICASA_ID};
String nSelection = MediaStore.Images.ImageColumns.PICASA_ID
+  =  + _IDThumbnails;

Cursor nCursor =
managedQuery(MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
  
nProjection, nSelection, null, null);

nCursor.moveToFirst();

columnIndex =
cursor.getColumnIndexOrThrow(MediaStore.Images.Media._ID);
String _IDImage = cursor.getString(columnIndex);

FileInputStream is = null;
BufferedInputStream bis = null;
try
{
is = new FileInputStream(new File(imagePath));
bis = new BufferedInputStream(is);

// Imagen is a class that I have defined
image = new Imagen(BitmapFactory.decodeStream(bis),
_IDImage);
}
catch(Exception e)
{

}
finally
{
try
{
if(bis != null)
bis.close();

if(is != null)
is.close();

cursor.close();
projection = null;
}
catch(Exception e)
{

}
}
}

Thank you. Regards,
Jesús

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Save image on SD card

2010-06-23 Thread ReyLith
Hi!

I'm developing an image editor on android. I have a problem when I
have to save the image. If I save the image with a outputstream, I can
save the image but my program and android's gallery can't see the new
image. If I save the image with MediaStore.Images.Media.insertImage, I
can see the saved image but the problem it's that this function save a
little image called thumbnails which I don't know what to do.

Thank you. Regards,

Jesús

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Permission

2010-04-20 Thread ReyLith
Hi!
I am devoloping an application of image editor. I allways do it by
using the resources in the drawable carpet. Now I changed it to use
the resources in the SD card. I don't change the code of the image
access but the program allways produce an error if I intent to set
the
value of a pixel. The program works correctly if I try to read the
pixel but if I try to modify it fails. I think this is a permissions
error but I added the following:

uses-permission
android:name=com.android.editorImagenes.permission.WRITE_EXTERNAL_STORAGE
/uses-permission
uses-permission
android:name=com.android.editorImagenes.permission.WRITE_OWNER_DATA/
uses-permission

And everything remains exactly the same. I'm desperate. A thing
happens is that if I try to do the scaling or rotating the image
using
a matrix postrotate, etc, the program works correctly and as of this
moment I can use the SetPixel without causing error.
I need help please. Thank you very much.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Permission

2010-04-19 Thread ReyLith
Hi!

I am devoloping an application of image editor. I allways do it by
using the resources in the drawable carpet. Now I changed it to use
the resources in the SD card. I don't change the code of the image
access but the program allways produce an error if I intent to set the
value of a pixel. The program works correctly if I try to read the
pixel but if I try to modify it fails. I think this is a permissions
error but I added the following:

uses-permission
android:name=com.android.editorImagenes.permission.WRITE_EXTERNAL_STORAGE/
uses-permission
uses-permission
android:name=com.android.editorImagenes.permission.WRITE_OWNER_DATA/
uses-permission

And everything remains exactly the same. I'm desperate. A thing
happens is that if I try to do the scaling or rotating the image using
a matrix postrotate, etc, the program works correctly and as of this
moment I can use the SetPixel without causing error.

I need help please. Thank you very much.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Finish activity

2010-04-04 Thread ReyLith
Hi!

I have a problem with my application. During the execution of it, I
have some buttons which execute other activities when I click on them.
The way I am realising it is:

private OnClickListener scaleImage = new OnClickListener()
{
   public void onClick(View v)
   {
   Intent intent = new Intent();
   intent.setClass(main.this, Scale.class);
   startActivity(intent);

   update();
   }
};

The other activity finish it execution using the function finish(). I
have a problem. When the activity finish, the function update() should
be executed. However it doesn't run until I click on other button. I
don't know the reason, the function update() is just bellow of
startActivity.

Thank you very much. Regards.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

To unsubscribe, reply using remove me as the subject.


[android-developers] How can I do it?

2010-03-21 Thread ReyLith
Hi!

I am developing an image editor for Android OS. I want to resize the
image and I know how can I do it. The problem is the way I want to do
it. I want two scrools in the screen representing the horizontal and
vertical size and initiality located in the middle of the scrools. If
I move any of them back, the image will become smaller in that
direction and if I move any of them forward the image will become high
in that direction. Is it possible?

Thank you very much. A greeting.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

To unsubscribe from this group, send email to 
android-developers+unsubscribegooglegroups.com or reply to this email with the 
words REMOVE ME as the subject.


[android-developers] Modify the value of pixel

2010-03-21 Thread ReyLith
Hi!

I am trying to modify the value of the pixel of an imagen. I have
achieved it using the functions getPixel and setPixel of Bitmap. Now I
have a questions. I want to realise many operations with the pixels of
an image and I need that such operations are done quickly. What is
better to use the functions provided by the library or used bookstore
Bitmap image editing as jjil?

Thank you very much. A greeting.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

To unsubscribe from this group, send email to 
android-developers+unsubscribegooglegroups.com or reply to this email with the 
words REMOVE ME as the subject.


[android-developers] Re: Image Edition

2010-03-15 Thread ReyLith
Thank for you respond.

I am already using intent for moving from one activity to another and
I have declared it in the androidmanifest. The code that I am using is
the following:

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

Gallery g = (Gallery) findViewById(R.id.Gallery);
g.setAdapter(new ImageAdapter(this));

g.setOnItemClickListener(new OnItemClickListener()
{
public void onItemClick(AdapterView parent, View v, int
position, long id)
{
//Toast.makeText(Editor.this,  + position,
Toast.LENGTH_SHORT).show();
}
});

ImageButton abrir = (ImageButton)
findViewById(R.id.ImageButton01);
abrir.setOnClickListener(abrirImagen);

ImageButton cerrar = (ImageButton)
findViewById(R.id.ImageButton01);
cerrar.setOnClickListener(cerrarPrograma);
}

   /*private OnClickListener abrirImagen = new OnClickListener()
{
   public void onClick(View v)
   {
   Intent intent = new Intent();
   intent.setClass(Editor.this, Rotar.class);
   startActivity(intent);
   finish();
   }
};*/

   private OnItemClickListener seleccionImagen = new
OnItemClickListener()
{
   public void onItemClick(AdapterView parent, View v, int
position, long id)
   {
   Intent intent = new Intent();
   intent.setClass(Editor.this, Rotar.class);
   startActivity(intent);
   finish();
   }
};

The commented function is where I use the botton and the non-commented
funcion is where I want to go to another activity. If someone wants I
can put the complete code but I think that there isn't neccesary. As
you can see I use intents for open the other activity but I don't know
how I can pass the selected image.

Greetings.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: Image Edition

2010-03-15 Thread ReyLith
Thanks all for the info. I have learned to use Bundle of extras and
GridView but I can't found the error that I am commiting. I have
modified the code:

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

GridView gridview = (GridView) findViewById(R.id.gridview);
gridview.setAdapter(new ImageAdapter(this));

/*g.setOnClickListener(new OnItemClickListener(){
public void onItemClick(AdapterView parent, View v, int
position, long id) {

}
});*/
}

public class ImageAdapter extends BaseAdapter
{
private Context mContext;

private Integer[] mThumbIds = {
R.drawable.sample_1,
R.drawable.sample_2,
R.drawable.sample_3,
R.drawable.sample_4,
R.drawable.sample_5,
R.drawable.sample_6,
R.drawable.sample_7
};

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

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

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

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

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);

  imageView.setOnClickListener(new View.OnClickListener()
  {
@Override
public void onClick(View view)
{
Intent intent = new Intent();
intent.setClass(Editor.this, Rotar.class);
intent.putExtra(imagen,
String.valueOf(position)); -- I think that position has the position
of the image but I am not sure
startActivity(intent);
finish();
}
  });
}
else
{
  imageView = (ImageView) convertView;
}

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

In the second activity (whose name is Rotar) I am intenting to
recupere the position that I have selected in the gallery and I am
intenting as the following mode:

Bundle extras = getIntent().getExtras();
if(extras != null)
{
String value = extras.getString(imagen);
imagen = mThumbIds[Integer.getInteger(value)];
}

But when I click an image, the program finish with an error. The
imagen and mThumbids are declared as private variables in the
first of the class.

Thank again for your answer. A greeting.

On Mar 15, 10:02 am, Tarun Bakshi tarun.bak...@gmail.com wrote:
 You might use Bundle of extras to pass information from one activity to
 another activity.



 On Mon, Mar 15, 2010 at 2:26 PM, ReyLith jesus...@gmail.com wrote:
  Thank for you respond.

  I am already using intent for moving from one activity to another and
  I have declared it in the androidmanifest. The code that I am using is
  the following:

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

         Gallery g = (Gallery) findViewById(R.id.Gallery);
         g.setAdapter(new ImageAdapter(this));

         g.setOnItemClickListener(new OnItemClickListener()
         {
                 public void onItemClick(AdapterView parent, View v, int
  position, long id)
                 {
                         //Toast.makeText(Editor.this,  + position,
  Toast.LENGTH_SHORT).show();
                 }
         });

         ImageButton abrir = (ImageButton)
  findViewById(R.id.ImageButton01);
         abrir.setOnClickListener(abrirImagen);

         ImageButton cerrar = (ImageButton)
  findViewById(R.id.ImageButton01);
         cerrar.setOnClickListener(cerrarPrograma);
     }

    /*private OnClickListener abrirImagen = new OnClickListener()
     {
        public void onClick(View v)
        {
            Intent intent = new Intent();
            intent.setClass(Editor.this, Rotar.class);
            startActivity(intent);
            finish();
        }
     };*/

    private OnItemClickListener seleccionImagen = new
  OnItemClickListener()
     {
        public void onItemClick(AdapterView parent, View v, int
  position, long id)
        {
            Intent intent = new Intent();
            intent.setClass(Editor.this, Rotar.class

[android-developers] Image Edition

2010-03-14 Thread ReyLith
Hi!

I am starting in programming with Android. The first that I am doing
(later of reading the main tutorials in the official page and later of
executing the hello word example and so on) is to realise an image
editor application. I am having many problems with different parts.

The first that I want to show is a image selector (gallery) to the
user for selecting the image that he/she wanted to edit and later
start the real application. The problem is that when I use
setOnItemClickListener, I can't get start the second activity and if I
add a button and give the functionality to open the activity, I don't
know how to pass the selected image in the gallery and when I click on
the button the activity don't start. The method that I have used to
start the activity comes in most tutorial with setOnClickListener.

Other thing that I wanted is to show the images as a matrix or table
with 6-9 images in the same screen. I think it would be more pleasing.

The last questions that I have is if when I probe the application in a
movile, it should show the real images on the phone or the images in
the res/drawable.

Thank you very much. A greeting.

PD: Sorry for the doubts. I've been all afternoon searching and
searching and I have decided to enter desperate.

PD2: My English is average and there may be some mistakes. Sorry!

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Image Editing

2010-03-02 Thread ReyLith
Hi!

I'am starting with Android SDK. I want to develop a image editing
software but I don't find any computer vision library to Android SDK.
I see that I can use C/C++ code with Android NDK and I can use OpenCv
library. Do you think that it is the better option?.

Thank. A greeting.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en