Array of Resource Files

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Leke Ekundayo
    New Member
    • Jun 2011
    • 5

    Array of Resource Files

    How can I create an array of resource files in J2ME
  • ayarowji
    Banned
    New Member
    • Aug 2010
    • 2

    #2
    if you have your images in your resources, it has no sense to have them in an array: you've already them in a collection (resorices) from which you can get any by name, and the name is a string you can build

    Private Function GetImageResourc eByName(ByVal picNumber As Integer) As Bitmap
    Dim picName As String = "DL" & picNumber.ToStr ing
    Return DirectCast(My.R esources.Resour ceManager.GetOb ject(picName), Bitmap)
    End Function

    Comment

    • Leke Ekundayo
      New Member
      • Jun 2011
      • 5

      #3
      Thanks. It is an array of *.txt files.
      I am trying to build something like a library of books, chapter, verses and text. all the chapters are in different txt files as resources. To put them in an array so that I will be able to use
      Record Store to call any verse.
      Is it possible to use

      Code:
      private String Matthew(){
          InputStream is = getClass().getResourceAsStream("*.txt");
          StringBuffer sb = new StringBuffer();
          try{
          int chars, x = 0;
          while ((chars = is.read()) != -1){
          sb.append((char) chars);
          }
          return sb.toString();
          }catch (Exception e){}
          return null;
          }
      Last edited by Dheeraj Joshi; Aug 4 '11, 10:25 AM. Reason: Fixed code tags.

      Comment

      Working...