Skip to main content

Using platformRequest() from another Class

3 replies [Last post]
ckurtm
Offline
Joined: 2008-03-12
Points: 0

I know it might not exactly be LWUIT related, but i'm using lwuit :-), I have two Forms, and have a class in a different file that has a form designing method, that also has a Class that runs a dialog to show info from calling midlet:
something like this?

--------in midlet class: ------------------
Display.init(this);
Form one = new Form("First form");
Form two = new Form("2nd form");
Designer designer = new Designer();
designer.design(two);
one.show;

. ....................

-------in Designer classe's design method -----------------
void design(Form f){
Commad call = new Command("call");
f.addCommandListener(......)
....................................

}
}//end design method

________________________

my question is, how would i go about implementing a way for the call command to initiate a call for
the calling Midlet using platformrequest, from the second class's design method?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
chen

Hi,
If I understood you what you would like to do is to intiate a phone
call, what you need to do is simply pass the MIDlet reference to the 2nd
class and then just call MIDlet.platformRequest(
);

Regards,
Chen

lwuit-users@mobileandembedded.org wrote:
> I know it might not exactly be LWUIT related, but i'm using lwuit :-), I have two Forms, and have a class in a different file that has a form designing method, that also has a Class that runs a dialog to show info from calling midlet:
> something like this?
>
> [b]--------in midlet class: ------------------[/b]
> [i]Display.init(this);
> Form one = new Form("First form");
> Form two = new Form("2nd form");
> Designer designer = new Designer();
> designer.design(two);
> one.show;[/i]
> . ....................
>
> [b]-------in Designer classe's design method -----------------[/b]
> [i] void design(Form f){
> Commad call = new Command("call");
> f.addCommandListener(......)
> ....................................
>
> }
> }//end design method[/i]
>
> ________________________
>
>
> my question is, how would i go about implementing a way for the call command to initiate a call for
> the calling Midlet using platformrequest, from the second class's design method?
> [Message sent by forum member 'ckurtm' (ckurtm)]
>
> http://forums.java.net/jive/thread.jspa?messageID=279060
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
> For additional commands, e-mail: users-help@lwuit.dev.java.net
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
For additional commands, e-mail: users-help@lwuit.dev.java.net

ckurtm
Offline
Joined: 2008-03-12
Points: 0

I tried passing reference but i guess my problem, is i then try to initiate the call from within an inner class within the second Class, like below, if i change the [i]design[/i] method to [i]design(Midlet m)[/i], ,i still have the issue that i'm invoking this from an action listener thats a inner class within this;
the code below is what i did, and it does'nt work for obvious reasons, my question is how can i then implement this:
[b]
---------design method ------[/b]
[i]public void design(MIDlet m,Form form){
form.addCommandListener(new )
Button callBtn = new Button("Call");
callBtn.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
try {
m.platformRequest("tel:78209232323");
} catch (ConnectionNotFoundException ex) {
ex.printStackTrace();
}
}
});
}[/i]

chen

Hi,
Try to declare the method like this:

public void design(*final *MIDlet m,Form form)

Regards,
Chen

lwuit-users@mobileandembedded.org wrote:
> I tried passing reference but i guess my problem, is i then try to initiate the call from within an inner class within the second Class, like below, if i change the [i]design[/i] method to [i]design(Midlet m)[/i], ,i still have the issue that i'm invoking this from an action listener thats a inner class within this;
> the code below is what i did, and it does'nt work for obvious reasons, my question is how can i then implement this:
> [b]
> ---------design method ------[/b]
> [i]public void design(MIDlet m,Form form){
> form.addCommandListener(new )
> Button callBtn = new Button("Call");
> callBtn.addActionListener(new ActionListener() {
> public void actionPerformed(ActionEvent arg0) {
> try {
> m.platformRequest("tel:78209232323");
> } catch (ConnectionNotFoundException ex) {
> ex.printStackTrace();
> }
> }
> });
> }[/i]
> [Message sent by forum member 'ckurtm' (ckurtm)]
>
> http://forums.java.net/jive/thread.jspa?messageID=279089
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
> For additional commands, e-mail: users-help@lwuit.dev.java.net
>
>
>

[att1.html]