BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 11-02-2011, 11:05 AM   #1
bankkab
New Member
 
Join Date: Nov 2011
Model: 7100T
PIN: N/A
Carrier: Bike
Posts: 13
Default How to Read and Show String in file txt

Please Login to Remove!

Excuse me , I have a problem

this is my code
---
byte[] data = null;
FileConnection fconn = null;
DataInputStream is = null;
try {
fconn = (FileConnection) Connector.open("file:///D:/IP.txt", Connector.READ);
is = fconn.openDataInputStream();
data = IOUtilities.streamToBytes(is);
oxi = new LabelField(data);
add(oxi);
---

my IP.txt have string "Local Host"

Then Build and Run

String "LocalHost"

is not show in my app

helpme ,

thanks
Offline  
Old 11-02-2011, 12:56 PM   #2
Dougsg38p
BlackBerry Extraordinaire
 
Join Date: Mar 2008
Location: Austin, TX
Model: 9700
PIN: N/A
Carrier: T-Mobile
Posts: 1,644
Default Re: How to Read and Show String in file txt

LabelField expects an Object that implement tostring().

This does not describe byte[]

Try creating a String object form the bytes.
Offline  
Old 11-03-2011, 02:37 AM   #3
bankkab
New Member
 
Join Date: Nov 2011
Model: 7100T
PIN: N/A
Carrier: Bike
Posts: 13
Default Re: How to Read and Show String in file txt

Quote:
Originally Posted by Dougsg38p View Post
LabelField expects an Object that implement tostring().

This does not describe byte[]

Try creating a String object form the bytes.
thanks but....

how to create String object from the bytes.
Offline  
Old 11-03-2011, 07:15 AM   #4
Dougsg38p
BlackBerry Extraordinaire
 
Join Date: Mar 2008
Location: Austin, TX
Model: 9700
PIN: N/A
Carrier: T-Mobile
Posts: 1,644
Default Re: How to Read and Show String in file txt

Are you kidding me?

From the javadoc:

String

public String(byte[] bytes)

Construct a new String by converting the specified array of bytes using the platform's default character encoding. The length of the new String is a function of the encoding, and hence may not be equal to the length of the byte array.
Parameters:
bytes - The bytes to be converted into characters
Since:
JDK1.1

--------------------------------------------------------------------------------
Offline  
Closed Thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads for: How to Read and Show String in file txt
Thread Thread Starter Forum Replies Last Post
Losing Call Logs, SMS or Emails? Optimize your BB! How To Setup for max free memory! John Clark BlackBerry Help 1623 06-30-2022 04:06 PM
Mail read in Outlook show unread on BB NOLU BES Admin Corner 2 02-17-2010 11:27 AM
Read emails on BES do not show as Read on BB8830 roybeasley General Legacy Device Discussion 0 04-21-2008 05:17 AM
New 7130 sync errors sinverarity General Legacy Device Discussion 0 07-13-2006 11:28 AM
I want read messages from my client to show read on blackberry???? hartmas General BlackBerry Discussion 2 02-08-2006 11:37 AM


ASCO  EFHB8316G054 3/2-Way 3/8

ASCO EFHB8316G054 3/2-Way 3/8" General Service Solenoid Valve 24V DC UL Listed

$382.50



STASTO 21HT5ZOY160 GDH 2/2 Normally Open Solenoid Valve 3/4

STASTO 21HT5ZOY160 GDH 2/2 Normally Open Solenoid Valve 3/4" 24V DC 0-10 bar

$165.75



ASCO Miniature Solenoid Valve Cat No. 411L1124HVS 24 VDC 0.65 W 100 PSI picture

ASCO Miniature Solenoid Valve Cat No. 411L1124HVS 24 VDC 0.65 W 100 PSI

$40.00



Solenoid, picture

Solenoid,

$26.18



Cole Hersee (24059-BP) 12V Insulated SPST Continuous Duty Solenoid picture

Cole Hersee (24059-BP) 12V Insulated SPST Continuous Duty Solenoid

$28.89



SA-3786-12 603350 Fuel Shutoff Solenoid Kubota Compatible 721D2 21HP Grasshopper picture

SA-3786-12 603350 Fuel Shutoff Solenoid Kubota Compatible 721D2 21HP Grasshopper

$30.24







Copyright © 2004-2016 BlackBerryForums.com.
The names RIM © and BlackBerry © are registered Trademarks of BlackBerry Inc.