Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6983811
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T18:28:06+00:00 2026-05-27T18:28:06+00:00

i am developing an simple blackberry application in BlackBerry – Java Plug-in for Eclipse.

  • 0

i am developing an simple blackberry application in BlackBerry – Java Plug-in for Eclipse. In that, i want to read data from an external text file. I had searched for this, and tried for some tips, like. But failed at last. I will describe my application…

my main file…

package com.nuc;

import net.rim.device.api.ui.UiApplication;
public class Launcher extends UiApplication
{
    public static void main(String[] args)
    {
        Launcher theApp = new Launcher();       
        theApp.enterEventDispatcher();
    }

    public Launcher()
    {        
        pushScreen(new MyScreen());
    }    
}

And then my app class is like….

package com.nuc;

import net.rim.device.api.ui.container.MainScreen;
import net.rim.device.api.ui.component.BasicEditField;
import net.rim.device.api.ui.component.Dialog;
import net.rim.device.api.ui.component.EditField;
import net.rim.device.api.ui.component.LabelField;
import net.rim.device.api.ui.container.GridFieldManager;
import net.rim.device.api.ui.Field;
import net.rim.device.api.ui.FieldChangeListener;

public final class MyScreen extends MainScreen implements FieldChangeListener
{
// declared variables...
    public MyScreen()
    {     
      //rest codes...

I want to show some details from a text file before my app starts, like the End User License Agreement.. ie, something which cames as the first line..

my first question is, where i need to put that text file… i got lots of guidance from net, but nothing worked for eclipse..
Secondly, then how can i read the file and put its content in a dialog.

So plz guide me how i can achieve it.. sample code will be appreciable, for i am new to this environment…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T18:28:07+00:00Added an answer on May 27, 2026 at 6:28 pm

    To add a file to your Eclipe project

    • right click on the res folder of your project structure, click on New, click on Untitled Text File and then enter some text and save the file.

    To read from a file and display on a dialog try something like the following code snippet:

    try {
        InputStream is = (InputStream) getClass().getResourceAsStream("/Text");
        String str = "";            
        int ch;
        while ((ch = is.read()) != -1) {
            str += (char)ch;
        }
        synchronized (UiApplication.getEventLock()) {
            Dialog.alert(str == null ? "Failed to read." : str);    
        }
    } catch (Exception e) {
        synchronized (UiApplication.getEventLock()) {
            Dialog.alert(e.getMessage() + " + " + e.toString());
        }
    }
    

    in the above code "/Text" is the file name. And if you got a NullPointerException then check the file name and path.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im developing a simple console application using java. I want to display currently running
I'm developing a simple protocol that is used to read/write integer values from/to a
I'm developing simple Windows Service sending and receiving data from remote web service. I
i'm developing simple cms application. i want to integrate number of hits for some
Im developing a simple console Application using java. The code is given below `
i am developing a simple calculator application in blackberry now, and i am new
I started developing simple application in WPF and XAML. I want to try accessign
im developing a simple access application that helps us to order the right products
Im developing a simple application that have a line like this: string[] values =
im developing a simple Mxml application using flex 3. I have used simple text

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.