Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
Posts: 326
Registered: ‎02-02-2009
My Device: Not Specified

get timezone and memory capacity

Hi friends,

1. How to get device time zone for example GMT + 07:00  Bangkok

 

2. how to get device total memory size

 

thanks in advances

Developer
Posts: 905
Registered: ‎02-07-2009
My Device: BlackBerry Torch 9800
My Carrier: Globe Telecom

Re: get timezone and memory capacity

Developer
Posts: 326
Registered: ‎02-02-2009
My Device: Not Specified

Re: get timezone and memory capacity

thanks for ur valuable replay

 

1. i want the time zone ex: GMT +5.30, GMT -1.30 and not the time

 

2. when I used MemoryStats class

MemoryStats mstatus = Memory.getPersistentStats();//new MemoryStats();
                writer.write(String.valueOf((mstatus.getAllocated()+mstatus.getFree())/8192));

Developer
Posts: 326
Registered: ‎02-02-2009
My Device: Not Specified

Re: get timezone and memory capacity

[ Edited ]

I have got GMT offset form getRawOffset() method which is    19800000 for my device

how to convert this number to time? ex: GMT +5:30

 
Message Edited by mbasheerk on 09-28-2009 07:38 AM
Message Edited by mbasheerk on 09-28-2009 07:40 AM
Developer
Posts: 326
Registered: ‎02-02-2009
My Device: Not Specified

Re: get timezone and memory capacity

how to get device memory size in MB

Highlighted
Developer
Posts: 43
Registered: ‎09-28-2009
My Device: Not Specified

Re: get timezone and memory capacity

Hi mbasheerk,

 

getRawOffset() returns the time in miliseconds to be added to UTC, also note it does not cater for daylight savings time. So if you want to go this route then use

long milliseconddifference = Calendar.getInstance().setTime((long)0).getTimeInMillis() - getRawOffset();

/*Then to convert the milliseconds to seconds / 1000; to convert seconds to minutes / 60; and lastly minutes to hours /60*/

 

//so the final setup will be

 

int gmt = (Calendar.getInstance().setTime((long)0).getTimeInMillis() - getRawOffset())/1000/60/60;

 

 

 

 

For the memory, if it is in bytes then convert it to kilobytes, so bytes / 1024 = value in Kb, if it is in Kilobytes then convert it to megabytes, so kilobytes / 1024 = megabytes. So the default value is in bytes, as such you will getMemory() / 1024 / 1024 to get the value in Megabytes.

 

Hope this helps.

 

Regards

 

Developer
Posts: 326
Registered: ‎02-02-2009
My Device: Not Specified

Re: get timezone and memory capacity

is there any method to get Device Memory and Application Memory, these memory can be viewed from Option -> Memory
Developer
Posts: 112
Registered: ‎07-19-2009
My Device: Not Specified

Re: get timezone and memory capacity

[ Edited ]

Use the following 

 

Time Zone:

System.getProperty("user.timezone") 

 

 

Memory:  

 

RAM

     MemoryStats memoryStats;

     memoryStats = Memory.getRAMStats();

 

     ramMemory = memoryStats.getAllocated();

    

     ramMemory = memoryStats.getFree();

 

FLASH 

MemoryStats memoryStats;

     memoryStats = Memory.getFlashStats();

 

    

     flashMemory = memoryStats.getAllocated();

     

     flashMemory = memoryStats.getFree();

     

 

 

Divide the obtained memory from 1048576

Message Edited by sahil_khanna on 10-01-2009 07:14 AM