Get all the images of devices, but how do I know in what images is seclected

Hello

in my application I want to show all the images in the first screen, after selecting any image in all we will see in the next screen (full screen) actually I get all images but problem how do I know what image is clicked

I used this code...

package mypackage;

import java.io.IOException;
import java.io.InputStream;
to import java.util.Enumeration;
import java.util.Vector;

Import javax.microedition.io.Connector;
Import javax.microedition.io.file.FileConnection;

Import net.rim.device.api.math.Fixed32;
Import net.rim.device.api.system.Bitmap;
Import net.rim.device.api.system.EncodedImage;
Import net.rim.device.api.ui.Field;
Import net.rim.device.api.ui.Manager;
Import net.rim.device.api.ui.component.BitmapField;
Import net.rim.device.api.ui.component.ButtonField;
Import net.rim.device.api.ui.container.FlowFieldManager;
Import net.rim.device.api.ui.container.MainScreen;
Import net.rim.device.api.util.Comparator;
Import net.rim.device.api.util.SimpleSortingVector;

/**
* A class that extends the class screen, which offers default standard
* behavior for BlackBerry GUI applications.
*/
/ public final class screen extends MyScreen
{

private static final String DEVICE_DIR_PATH = System
.getProperty ("fileconn.dir.photos");
private static final String SD_IMAGE_DIR_PATH = System
.getProperty ("fileconn.dir.memorycard.photos");
private static final String OS6_CAMERA_PATH = "file:///store/home/user/camera/";
private static final String OS6_SD_CARD_PATH = "file:///SDCard/BlackBerry/camera/";

public static final int DEVICE_AND_SD = 0;
public static final int DEVICE_MEM = 1;
public static final int SD_CARD = 2;
public static final int OS6_CAMERA = 3;
public static final int OS6_SD_CAMERA = 4;
public static final int DEVICE_ALL = 5;
private static String [] _allImagePaths = null;
private EncodedImage [encodedbitmap];
Private bitmap image in Bitmap [];
private BitmapField [imagebitmapField];

int dataSize;
private ButtonField [] bitmapf;

/**
* Creates a new object of MyScreen
*/
public MyScreen()
{
Set the displayed title of the screen
setTitle ("MyTitle");

String [] imagePaths = getImagePaths (DEVICE_ALL);
FlowFieldManager imageFlowField = FlowFieldManager(Manager.VERTICAL_SCROLL | nouveau Manager.VERTICAL_SCROLLBAR);
If (imagePaths! = null & imagePaths.length > 0) {}
encodedbitmap = new EncodedImage [imagePaths.length];
image bitmap = new Bitmap [imagePaths.length];
imagebitmapField = new BitmapField [imagePaths.length];

for (int i = 0; i)< imagepaths.length;="" i++)="">
encodedbitmap [i] = loadEncodedImage ([i] imagePaths);
[i] bitmap image is scaleImage (encodedbitmap [i], 200, 100);.
imagebitmapField [i] = new BitmapField(bitmap[i],Field.FOCUSABLE);
imageFlowField.add (imagebitmapField [i]);
}
}
Add (imageFlowField);

}

public Bitmap image scaleImage (EncodedImage img, int width, int height) {}

int currentWidthF32 = Fixed32.toFP (img.getWidth ());
int currentHeightF32 = Fixed32.toFP (img.getHeight ());

If (height == 0) {}
int requiredWidth = Fixed32.toFP (width);
int x = Fixed32.div (currentHeightF32, currentWidthF32);
int y = Fixed32.mul (x, requiredWidth);
int scaleX = Fixed32.div (currentWidthF32, requiredWidth);
int scaleY = Fixed32.div (currentHeightF32, y);
IMG = img.scaleImage32 (scaleX, scaleY);
} else {}
int currentWidthFixed32 = Fixed32.toFP (img.getWidth ());
int currentHeightFixed32 = Fixed32.toFP (img.getHeight ());
int requiredHeightFixed32 = Fixed32.toFP (height);
int requiredWidthFixed32 = Fixed32.toFP (width);
int scaleXFixed32 = Fixed32.div (currentWidthFixed32,
requiredWidthFixed32);
int scaleYFixed32 = Fixed32.div (currentHeightFixed32,
requiredHeightFixed32);
IMG = img.scaleImage32 (scaleXFixed32, scaleYFixed32);

}
Return img.getBitmap ();
}

protected EncodedImage loadEncodedImage (String filePath) {}

FileConnection connection = null;
Byte [] byteArray = null;
Image EncodedImage = null;
Bitmap bitmap image = null;
Try
{
Connection = (FileConnection) Connector.Open (FilePath);
If (Connection.Exists ())
{
byteArray = byte [(int) connection.fileSize (new)];
InputStream inputStream = connection.openInputStream ();
inputStream.read (byteArray);
inputStream.close ();
image = EncodedImage.createEncodedImage (byteArray, 0, -1);
}
Connection.Close;
}
catch (System.Exception e)
{
System.out.println ("Exception" + try ());
}
return image;

}

public static String [] getImagePaths (int source) {}

If get path for all do this recursively
If (source == DEVICE_ALL) {}
If (_allImagePaths! = null) {}
Return _allImagePaths;
}

OS6 device Gallery
String [] os6CameraSDPaths =
getImagePaths (OS6_SD_CAMERA);

OS6 Gallery of SD card
String [] os6CameraPaths =
getImagePaths (OS6_CAMERA);

SD card Gallery
String [] sdCardPaths = getImagePaths (SD_CARD);
Gallery of the device
String [] devicePaths =
getImagePaths (DEVICE_MEM);

Combine the two in an ImageViewer
int numOS6CameraSDPaths = os6CameraSDPaths! = null? os6CameraSDPaths.length
: 0 ;
int numOS6CameraPaths = os6CameraPaths! = null? os6CameraPaths.length
: 0 ;
int numSDCardPaths = sdCardPaths! = null? sdCardPaths.length: 0;
int numDevicePaths = devicePaths! = null? devicePaths.length: 0;

int totalNumPaths = numDevicePaths + numSDCardPaths
+ numOS6CameraPaths + numOS6CameraSDPaths;
If (totalNumPaths > 0) {}
String of paths [] = new String [totalNumPaths];

If (os6CameraSDPaths! = null) {}
System.arraycopy (os6CameraSDPaths, 0, 0, paths)
numOS6CameraSDPaths);
}
If (os6CameraPaths! = null) {}
System.arraycopy (os6CameraPaths, 0, paths,)
(numOS6CameraSDPaths, numOS6CameraPaths);
}
If (sdCardPaths! = null) {}
System.arraycopy (sdCardPaths, 0, numOS6CameraSDPaths)
+ numOS6CameraPaths, numSDCardPaths);
}
If (devicePaths! = null) {}
System.arraycopy (devicePaths, 0, paths, numOS6CameraSDPaths)
+ numOS6CameraPaths, + numSDCardPaths,
numDevicePaths);
}

_allImagePaths = sortPaths (paths);

Return _allImagePaths;
} else {}
Returns a null value.
}
}

Set the path to look for
String imagePath = DEVICE_DIR_PATH;
If (source == SD_CARD) {}
imagePath = SD_IMAGE_DIR_PATH;
}

If (source == OS6_CAMERA) {}
imagePath = OS6_CAMERA_PATH;
}

If (source == OS6_SD_CAMERA) {}
imagePath = OS6_SD_CARD_PATH;
}

Listed in the directory looking for image files
ImagePaths vector = new Vector();
FileConnection imageDir = null;
try {}
imageDir = Connector.open (imagePath) (FileConnection);
If (imageDir! = null) {}
Enumeration = imageDir.list ();

imageDir.close ();
While (enumeration.hasMoreElements ()) {}
String imageName = (String) enumeration.nextElement ();
If (isSupported (imageName)) {}
imagePaths.addElement (imagePath + imageName);
}
}
}
} catch (Exception e) {}
XLogger.error (ImagePath.class, "cannot read file:")
+ e.getMessage ());
} {Finally
If (imageDir! = null) {}
try {}
imageDir.close ();
} catch (IOException e) {}
XLogger.error (ImagePath.class, "cannot close the file:")
+ e.getMessage ());
}
}
}

If there is no images don't return the null value
If (imagePaths.size)<= 0)="">
Returns a null value.
}

Return the results in an array of strings
_allImagePaths = new String [imagePaths.size ()];
imagePaths.copyInto (_allImagePaths);
Return _allImagePaths;
}

private static String [] sortPaths (String [] paths) {}
Sort the paths of the time, where modified files.
Class PathAndLastModified {}

timeStamp long private;
private String path;

{} public void setTimeStamp (long timeStamp)
this.timeStamp = timeStamp;
}

{} public void setPath (String path)
This.Path = path;
}

public String GetExtension() {}
Returns the path;
}
}

Comparator to sort paths
Comparator pathComparator = new Comparator() {}
public int compare (Object o1, Object o2) {}
If (((PathAndLastModified) o1) .timeStamp)< ((pathandlastmodified)o2).timestamp="" )="">
Return 1;
} ElseIf (((PathAndLastModified) o1) .timeStamp > .timeStamp (o2 (PathAndLastModified))) {}
Returns - 1;
} else {}
return 0;
}

Return (int) (((PathAndLastModified) o2) .timeStamp - .timeStamp (o1 (PathAndLastModified)));
}
};

Add the paths to the vector sorting
SimpleSortingVector sortedPaths = new SimpleSortingVector();
sortedPaths.setSortComparator (pathComparator);
for (int i = 0; i)< paths.length;="" i++)="">
String filePath = path [i];
long lastModified = 0;

FileConnection baseConn = null;
try {}
baseConn = (FileConnection), Connector.open (paths [i]);
lastModified = baseConn.lastModified ();

PathAndLastModified pathAndLastModified = new PathAndLastModified();
pathAndLastModified.setPath (filePath);
pathAndLastModified.setTimeStamp (lastModified);

sortedPaths.addElement (pathAndLastModified);
} catch (Exception e) {}
Do nothing
} {Finally
{if(baseConn!=null)}
try {}
baseConn.close ();
} catch (IOException e) {}
Do nothing
}
}
}
}
sortedPaths.reSort ();

Browse to create an array of sorted paths
String [] sortedArray = new String [sortedPaths.size ()];
for (int i = 0; i)
sortedArray [i] = ((PathAndLastModified) sortedPaths.elementAt (i)) .getPath ();
}

Return sortedArray;
}

private static Boolean isSupported (image String) {}
Make sure that the image is of the correct type
If (image == null) {}
Returns false;
}
check the directory
If (image.indexOf("/") > = 0) {}
Returns false;
}

int delimiterIndex = image.indexOf(".");
If (delimiterIndex ==-1) {}
probably a directory
Returns false;
}

the text is a list of extensions supported
String [] extensions = {".jpg", ".jpeg"};
for (int i = 0; i)< extensions.length;="" i++)="">
If (image.length () > extensions [i] .length ()) {}
Dim ext = image.substring (image.length)
(-extensions [i] .length ());
If (ext.equalsIgnoreCase (extensions [i])) {}
Returns true;
}
}
}
Returns false;
}
}

my suggestion was supposed to replace navigationclick on-screen.
If you want to ignore it for the field that you do not have to use getLeafFieldWithFocus.

I suggest that you think your code, don't write things and try to operate, fist think about something and then implement.
our projects at the University were generally 80% design, 20% of coding - it was strange at first, but it produced a lot more code.

Tags: BlackBerry Developers

Similar Questions

  • Import image - error 'cannot get all the files for this device. "

    Try to import images from my camera - Canon T3i.  Using both the SD card inserted into a reader and camera with battery connected USB Gets the error "unable to get all the files on this device. Please make sure that the equipment is connected correctly, or that the battery is charged. Files that have been achieved so far will be sent to multimedia elements. "All updates installed, running Vista x 64, 10 elements.

    Okay, found the problem.  Apparently the PSE does not like RAID1 arrays, which is a bit ironic, beings that she deals with photos, and people tend to do not like losing pictures.  Newho, if anyone has this problem in the future, as workaround for Adobe not have their stuff together, rather than import directly to a RAID 1 has HARD drive table, import them on another drive, then copy them to your RAID array.  Very disruptive and I wish adobe would just fix their problems (no other program has this issue, even video editing software... «and RAID 1 should really be used for that), but to use it as a workaround if necessary.»

  • I recently changed my IE but when I try to import the Favorites I get only the first two files. How can I get my favorite of all THE? s

    I followed the advice and imported IE Favorites, but only the first two files have met. How can I get all THE files across please?

    Wow. I think I will like Firefox if the aid is so easily available, quick and as good as this. Fixed right away
    Thank you very much
    Kevod

  • I created signatures and look OK in preferences, but I can't use them.  It worked once, but I don't know how or why.  I don't get all the dialog boxes.

    I created signatures and look OK in preferences, but I can't use them.  It worked once, but I don't know how or why.  I don't get all the dialog boxes.

    Thank you.  I read the article you quoted, as well as others, several

    times.  Creation has been problem free.

    My problem is that AID has never said, that I could find, HELP or

    TIP to search for a tool called certificates.  I searched,

    Signatures, Signatures Digital and many others but they lead no where.

    I think that HELP need HELP.

  • My screen on my laptop is amplified and can not get all the info on the screen... How to make all this fit?

    My screen seems to be enlarged and cannot get all the info on the screen... How to make all this fit?

    Go to the website of the manufacturer of your laptop > drivers and downloads Section > key in your model number > look for the latest Vista drivers > download/install them.

    http://Windows.Microsoft.com/en-AU/Windows-Vista/change-screen-resolution

    Change the screen resolution

    Screen resolution refers to the clarity of the text and images on your screen. At higher resolutions, items appear sharper. They appear also smaller, so more items adapted to the screen. At lower resolutions, fewer items adapted to the screen, but they are larger and easier to see. At very low resolutions, however, images may have serrated edges.

    See you soon,.

    Mick Murphy - Microsoft partner

  • I use LRM6 with Win7.  Cannot display all of the subfolders on external drive with photos.  Can't see most recent used folders.  How can I get all the records to display in the tree when the library module?

    I use LRM6 with Win7.  Cannot display all of the subfolders on external drive with photos.  Can't see most recent used folders.  How can I get all the records to display in the tree when the library module?

    Syrup72 wrote:

    Why I see pictures when I click on the tab all the photos above, which do not show in the tree on the G: drive?

    DSC_2429 is in the shown locaton and present in all the Photos, but there is no folder "Tulsa"... "in the tree.

    The left pane is a "choose one". "All photos" are just that. 'G' is a different option.

    Lightroom is not a file Explorer. He knows only the drives and files that you have imported the photos of. If LR shows not all of the photos that are on your hard drive, it is because you did not import all photos.

    If LR shows you a photo in "all photos" but do not show it in the folder you think he is in, go to "all photos", select the image, right click "view in the library folder. This will show you where LR think the picture is.

  • I get all the time can not download anything 'Windows cannot access the specified device, path or file. You can't have the permissions to access the have__appropriate element. »

    Original title: problems cannot do anything

    Windows cannot access the specified device, path or file. You can't have__appropriate the permissions to access the item. I get it all the time can not download anything

    Hi birdylod,

    ·         What version of the operating system is installed on the computer?

    ·         You did changes to the computer before the show?

    ·         You use Internet Explorer? If so, what version are you using?

    ·         What files you download?

    Follow these methods.

    Method 1: Performs a search using the Microsoft safety scanner.

    http://www.Microsoft.com/security/scanner/en-us/default.aspx

    Note: The data files that are infected must be cleaned only by removing the file completely, which means that there is a risk of data loss.

    Method 2: Follow these steps:

    Step 1: Start the computer in safe mode with network and check if the problem persists.

    Startup options (including safe mode)

    http://Windows.Microsoft.com/en-us/Windows7/advanced-startup-options-including-safe-mode

    Step 2: If the problem does not persist in safe mode with networking, perform a clean boot to see if there is a software conflict as the clean boot helps eliminate software conflicts.

    Note: After completing the steps in the clean boot troubleshooting, follow the link step 7 to return the computer to a Normal startupmode.

    Method 3: Scan the file system (CFS) auditor to repair corrupted files.

    How to use the System File Checker tool to fix the system files missing or corrupted on Windows Vista or Windows 7

    http://support.Microsoft.com/kb/929833

    For reference:

    What to know before applying permissions to a file or folder

  • computer crashed, have windows vista, indented leave, all the documents lost, can I get all the files, how do

    computer crashed, have windows vista, indented leave, all the documents lost, can I get all the files, how to do it, in simple terms,

    Thank you.

    If by "computer of new beginning" you mean that you have started your recovery or disk restore factory set and reinstalled Windows, then the ability to recover your files is practically zero.  You can try a utility like Recuva (http://www.piriform.com/recuva) but since you have rewritten the entire hard drive, it is highly unlikely that anything will be recoverable.

  • How can I get all the permissions Admin with Windows 8?

    I have recently installed Windows 8 on a used laptop that I bought and I'm trying to clean it up, but he always tells me I'm not allowed to watch even some files. How can I get all the PERMISSIONS ADMINISTRATOR?

    You must use the run as administrator command. So if you run a program or a file, just click and click on run as administrator. If you delete something, you must have an administrator account.

  • delete all the images in the Lightroom mobile, but those in the collections

    Hello

    After using Lightroom for mobile on my Apple TV, I realized that, other than the images I've grouped in collections, all the photos I took with my iPhone are available under the "images" tab

    I don't want that, so I disabled the feature to add.

    How can I delete all these images from Lightroom on mobile?

    I want to only keep those in my collections. Also, I don't want to delete the pictures that I took with the iPhone from the mobile, only from Lightroom.

    I hope someone can help,

    Thank you in advance.

    Thank you once again, Mohit.

    I thought... a work around in Lightroom, I created a collection called mobile DELETE... so I went to all the "Lightroom Photos' and choose ' copy in...» »

    I then could quickly select hundreds of photos at once and have all those I want to deleted in the new collection.

    Finally, the desktop version of Lightroom, I can select all the images in the collection DELETE and get rid of them.

  • How to get all the fonts in the paragraph?

    Hi all

    Especially in Indesign Javascript list how to get all the fonts section (without a loop in each character).  For example, I used "Minion Pro" to the first character and all other characters are "Zapf Dingbats" fonts. I use code below to get the paragraph font. But it shows only first typeface. If multiple fonts are used for including the paragraph then I need all the list fonts or result "undefined".

    var myPara = app.selection [0] .paragraphs [0];

    Alert (myPara.appliedFont.FontFamily);

    Thank you and best regards,

    Robert S

    var myPara = app.selection [0] .paragraphs [0];

    Alert (myPara.textStyleRanges.everyItem (.appliedFont));

  • How can I get all the ID of SQL the same SQL literals change?

    My SQL statement is the same throughout, but only changing the literals, and therefore the SQL ID, i.e. SQL ID change also. How can I get all the SQL ID this SQL?

    Hello

    the FORCE_MATCHING_SIGNATURE column is also entered in the ASH / historical AWR views V$ ACTIVE_SESSION_HISTORY / DBA_HIST_ACTIVE_SESS_HISTORY / DBA_HIST_SQLSTAT.

    .. and after all, you can join these views as described with DBA_HIST_SQLTEXT, if necessary.

    DBA_HIST_SQLTEXT displays the text of SQL statements belonging to shared SQL cursors captured in the repository of the workload. This perspective captures information from V$ SQL and is used with the DBA_HIST_SQLSTAT view.

    Concerning

    Stefan

    P.S.: AWR is only based on the captured of course SQLs.

  • How can I exchange all the images in a slideshow with the new

    I have 18 slideshows each is another contest for our photo club. How can I exchange all the images of each slide show with new images that our club competitions begin? I'm reluctant to just delete the slide show because I will take it all back. I want to leave the form of size and format of the show, but just share all the current images with new ones. I hope there is a quick way to remove and replace all the images for each show? Each slideshow has about 40 pictures and I have 18 shows

    Thank you for your help

    1. activate the "images" tab in the control panel

    2. Select a thumbnail.

    3. right click and choose "same."

    4. press on "BACKSPACE".

    5. open the control panel and load the new images.

  • How do I get all the SQL executed by my session?

    How do I get all the SQL executed by my session?

    Published by: user11300376 on 01/28/2013 11:27

    user11300376 wrote:
    I had tried, brings itself however only select table v $ session.

    Executed orders:

    SELECT * FROM MBS_ITEM;

    SELECT b.sql_id, b.sql_text
    SESSION $ v a, v$ sql b
    WHERE a.sql_id = b.sql_id;

    The output result:

    SQL_ID SQL_TEXT
    1 4qg3bft0w37rt SELECT b.sql_id, b.sql_text FROM session $ v a, v$ sql b WHERE a.sql_id = b.sql_

    The listed application is good, but does not limit the output of your session - it should return data from all sessions.

    You must add an AND condition in the WHERE clause to limit your session. You can try this (untested)

     where audsid=(select userenv('sessionid') from dual);
    

    You can also perform a SQL trace and tkprof to obtain data to SQL executed the trace start and end of the trace.

  • Creating GIF images, how to edit all the images at once?

    Hey everybody. So I now how to make GIFS images already. The problem I have is that I can't find a way to edit all the images at once. I want to brighten them up and add curves, perhaps refine.

    I tried to select all layers, but all image editing in grayed out options and were not available.

    I really want to change individually the 58 frames, lol.

    Is there a way to edit all at once?

    PS - I use Photoshop CS3, if that helps!

    Thank you very much!

    Mike

    Have you tried to convert all layers to a smart object or group together them? Then apply your effects to the dynamic object or group.

Maybe you are looking for

  • Sort plug-ins today

    I noticed that the apps in today are not classified as I will display them whenever I start my cool iMac. I am assured that in system preferences > Notifications the manually by App is enabled. Seems that this setting has no effect. Ideas?

  • Cannot display the Flash content after Norton Utilities scan

    I did a scan of Norton Utilities yesterday, and afterwards various sites Web looked very odd in Firefox. Worse, I've lost the ability to view videos embedded on websites such as the BBC, YouTube, etc. Other tests this morning show that the problem is

  • Export videos without losing the creation date

    In pictures 1.0.1 I am trying to export worth several years of videos to put on an external hard drive to save space on my main machine, but when I export them (via drag + drop on the desktop), they lose their date of creation - and, therefore, their

  • Is - this RAM is compatible with the IdeaPad Z575?

    Yesterday afternoon, I purchased a Lenovo IdeaPad Z575 for $499.00 from this link: [url]http://www.newegg.com/Product/Product.aspx?Item=N82E16834246328 [url] Obviously, it didn't come in the mail again. I'm looking to upgrade the RAM in the laptop. I

  • Development parameters do not transfer to the deployment.

    Hi all I use TestStand with parallel process model to test 16 DUT. After much head banging I discovered I needed to include TestExec.ini to force deployment to use the parallel model.  What other files I need to include parameters to be transferred t