| Back to Questions Page |
| |
| Question |
I have a problem wtih a program.
The program logic is like this..........
from a class which extends midlet class i create object of
a class(say canobj(word)) which extends canvas class by
passing a string.
the next statement is display.setCurrent(canobj);
Everything is fine but the paint(Graphics g) method is not
executed. What may the problem. please suggest me the
answer. |
Rank |
Answer Posted By |
|
Question Submitted By :: Shiva034 |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | Hey,
check out the following code. See if u get any clue from
this. Your display needs to be initialised first..hope ur
doin tat in ur code.. unless u do tat ur paint wudn't be
called at all. try to display a form instead of a canvas and
see if display is causing the problem. hope this was helpful
to u.
public class Mainscreen extends MIDlet implements
CommandListener{
Display display;
public Mainscreen(){
display = Display.getDisplay(this);
setcommandListener(this);
}
public void startApp(){
Form f = new Form("ShowCanvas"){
f.addCommand(Command.OK);
f.setcommandListener(this);
display.setcurrent(f);
}
}
public void DestroyApp(boolean t){
notifyDestroyed();
}
public void pauseApp(){
}
public void commandAction(Command c ,Displayable d){
if(c==Command.OK){
showDetails();
}
}
}
public void showDetails() {
Canvas canvas = new Canvas() {
protected void paint(Graphics g) {
g.setColor(255, 255, 255);
g.fillRect(0, 0, getWidth(), getHeight());
g.setColor(0, 0, 0);
g.setFont(font_med);
g.drawString("HI anonymous",10, 0, 0);
}
};
canvas.addCommand(Commands.Back);
canvas.setCommandListener(this);
display.setcurrent(canvas);
}  |
| Shelly |
| |
| |
| Answer | With the same flow,the paint(Graphics g) will execute.
If not executes then do not display.setCurrent(canobj) here.
Go to the Canvas class & take a Display object & initialize
it with the MIDlet call display object.Then from the Canvas
class constructor call a method,where first call repaint()
method,then serviceRepaint() method,then call
display.setCurrent(this).It will work like bellow..
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
public class TestView extends MIDlet {
CanvasView canObj;
static Display DISPLAY;
public void startApp() {
String word = "Hi Susanta";
DISPLAY = Display.getDisplay(this);
canObj = new CanvasView(word,this);
}
public void pauseApp() {
}
public void destroyApp(boolean unconditional) {
notifyDestroyed();
}
}
class CanvasView extends Canvas implements CommandListener{
Display display;
String str="";
Command exit;
TestView midlet;
public CanvasView(String str,TestView midlet){
this.midlet = midlet;
display = TestView.DISPLAY;
this.str = str;
exit = new Command("Exit",Command.EXIT,0);
addCommand(exit);
setCommandListener(this);
callPaint();
}
protected void paint(Graphics g){
setFullScreenMode(true);
g.setColor(0,0,200);
g.fillRect(getWidth()/2-40,getHeight()/2-20,80,40);
g.setColor(255,255,255);
g.drawString(str,getWidth()/2,getHeight()/2-10,g.HCENTER|g.TOP);
}
public void callPaint(){
repaint();
serviceRepaints();
display.setCurrent(this);
}
public void commandAction(Command command,Displayable disp){
if(command == exit){
midlet.destroyApp(true);
}
}
}  |
| Susanta Mandal |
| |
| |
| Question |
What is the difference between MIDP 1.0 and MIDP 2.0? |
Rank |
Answer Posted By |
|
Question Submitted By :: Guest |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | MIDP 1.0 - Does not support floating point
MIDP 2.0 -it support floating point  |
| Kumar |
| |
| |
|
|
| |
| Answer | 1.0 doesnot support GPRS
where as 2.0 supports GPRS  |
| Amit Joshi |
| |
| |
| Answer | Full Canvas will work in MIDP 2.0
but not possible in MIDP 1.0
Push Registry is added in MIDP 2.0
but not possibly in MIDP 1.0
Game API added in MIDP 2.0
not added in the MIDP 1.0  |
| Veeresh |
| |
| |
| Answer | Sprite is available in MIDP2.0 but it is not added in MIDP
1.0  |
| Sivakumar.s.m |
| |
| |
| Answer | Spacer and CustomItem added in MIDP2.0 but these are not
present in MIDP 1.0  |
| Manish |
| |
| |
| Answer | MIDP 1.0 does not support MMAPI
MIDP 2.0 Supports MMAPI  |
| B.chandra Sai Mohan |
| |
| |
| Answer | MIDP 1.0 does not support HTMLS, MIDP 2.0 DOES  |
| Amar |
| |
| |
| Question |
What is the difference between CLDC 1.0 and CLDC 1.1? |
Rank |
Answer Posted By |
|
Question Submitted By :: Guest |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | CLCD 1.0 does not have support for floating points while
CLDC 1.1 does.  |
| Chris |
| |
| |
| Answer | in cldc 1.1 addition of weak references
not in cldc 1.0  |
| Manish |
| |
| |
| Answer | cldc 1.0 and cldc 1.1 both support String and StringBuffer.
CLDC 1.0------->equalsIgnoreCase() is not present
CLDC 1.1 --------->equalsIgnoreCase() is present
CLDC 1.0--->insert(),append() methods is absent in String
Buffer which i spresent in CLDC 1.1
ValueOf()--->which provide conversions b/w floating point
types and strings is present in CLDC1.1 which is absent in 1.0
No Object Finalization in CLDC 1.0 and 1.1  |
| B.chandra Sai Mohan |
| |
| |
| Answer | Form.deleteAll() not present in MIDP1.0
Form.deleteAll() present in MIDP2.0  |
| Biswa |
| |
| |
| Question |
I have problem with connection between Database and
Wireless device, plz send me a sample code. |
Rank |
Answer Posted By |
|
Question Submitted By :: Chang |
| This Interview Question Asked @ Mascon |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | I also have problem with database and wireless toolkit
connection send reply if you get answer for this problem.
DON't forgot it.  |
| Prabhu |
| |
| |
| Answer | pls to me also  |
| Ganesan |
| |
| |
| Question |
Explain about RMI OP ? |
Rank |
Answer Posted By |
|
Question Submitted By :: Guest |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | The RMI Optional Package (RMI OP) is a subset of J2SE 1.3's
RMI functionality used in CDC-based profiles that
incorporate the Foundation Profile, such as the Personal
Basis Profile and the Personal Profile. The RMIOP cannot be
used with CLDC-based profiles because they lack object
serialization and other important features found only in
CDC-based profiles. RMIOP supports most of the J2SE RMI
functionality, including the Java Remote Method Protocol,
marshalled objects, distributed garbage collection,
registry-based object lookup, and network class loading, but
not HTTP tunneling or the Java 1.1 stub protocol.  |
| Guest |
| |
| |
| Question |
What is optional package ? |
Rank |
Answer Posted By |
|
Question Submitted By :: Guest |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | An optional package is a set of J2ME APIs providing services
in a specific area, such as database access or multimedia.
Unlike a profile, it does not define a complete application
environment, but rather is used in conjunction with a
configuration or a profile. It extends the runtime
environment to support device capabilities that are not
universal enough to be defined as part of a profile or that
need to be shared by different profiles. J2ME RMI and the
Mobile Media RMI are examples of optional packages.  |
| Guest |
| |
| |
| Answer | Optional Api is used to provide additional functionality
that can be included for a configuration or profile.
possible future stack will be CLDC1.1/MIDP2.0+MMAPI.
Ex: MMAPI,javax.microedition.lcdui.game,will come under
optional API  |
| B.chandra Sai Mohan |
| |
| |
| Question |
What is JCP ? |
Rank |
Answer Posted By |
|
Question Submitted By :: Guest |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | java community process  |
| Jagadishwar |
| |
| |
| Question |
What is OTA ? |
Rank |
Answer Posted By |
|
Question Submitted By :: Guest |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | Over The Air generally simmulates the dowloading of the
application of the application on to the mobile using GPRS
connection.  |
| Jagadishwar |
| |
| |
| Answer | OTA means Over The Air, which is a concept. The following
are the examples which uses this concept.
OTA provisioning - Means provisioning a mobile handset over
the air using PUSH messages
Firmware Upgrade OTA - Which is used to upgrade or downgrade
the firmware of a device.
There is a possibility to have a newer versions of the
applications/ MIDLETS which are already installed in the
device. But the user can download the updated SW and install
it with out going to the service center.  |
| Santosh Kumar |
| |
| |
| Question |
What is WAE ? |
Rank |
Answer Posted By |
|
Question Submitted By :: Guest |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | The Wireless Application Environment (WAE) provides a
application framework for small devices. WAE leverages other
technologies such as WAP, WTP, and WSP.
 |
| Guest |
| |
| |
| Question |
What is SSL ? |
Rank |
Answer Posted By |
|
Question Submitted By :: Guest |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | secure socket layer  |
| Guest |
| |
| |
| Question |
What is LAN ? |
Rank |
Answer Posted By |
|
Question Submitted By :: Guest |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | local area network  |
| Guest |
| |
| |
| Answer | local area network  |
| Varsha Vilas Kalebag |
| |
| |
| Question |
What is PDAP ? |
Rank |
Answer Posted By |
|
Question Submitted By :: Guest |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | The Personal Digital Assistant Profile (PDAP) is a J2ME
profile specification designed for small platforms such as
PalmOS devices. You can think of PDAs as being larger than
mobile phones but smaller than set-top boxes. PDAP is built
on top of CLDC and will specify user interface and
persistent storage APIs. PDAP is currently being developed
using the Java Community Process (JCP).
 |
| Guest |
| |
| |
|
| |
|
Back to Questions Page |