Hi all
i sent message and also recceive response using http Connection with MIDP 1.0 but i dont understand that how can i put processbar/Gauge at connection time.
Tanya
Hi all
i sent message and also recceive response using http Connection with MIDP 1.0 but i dont understand that how can i put processbar/Gauge at connection time.
Tanya
If you are looking for a Please wait screen/Progress bar, we already have some similar discussions, please check these links
http://discussion.forum.nokia.com/fo...highlight=wait
http://www.siemens-support.com/jive3...ID=72912#72912
http://forum.java.sun.com/thread.jsp...hreadID=481112
http://discussion.forum.nokia.com/fo...highlight=wait
http://discussion.forum.nokia.com/fo...ight=animation
Hope this helps!
Regards
Gopal
__________________
MobiQuil.com
An initiative by Developers for Developers.
http://www.mobiquil.com - Alpha - Launched.
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import javax.microedition.io.*;
import java.io.*;
import java.util.*;
public class CHttpConnection //implements Runnable
{
CHttpMsg iHttpMsg;
CUrlEncoder iUrlEncoder;
Display display;
/** Creates a new instance of HttpConnection */
public CHttpConnection(CHttpMsg iHttpMsg)
{
this.iHttpMsg = iHttpMsg;
}
public CHttpConnection()
{
System.out.println("In Default Constructor");
}
// FOR CONNECT TO THE SERVER.
public void fGetDetails(String username, String password)
{
String uname = username;
String pwd = password;
String urlstring = "http://www.devindia.net/DevIndia_Team/Script/address_book/clientvalidate.php";
String resultstring = "";
GetContent gc = null;
gc = new GetContent(urlstring, uname, pwd) ;
System.out.println("START");
Thread thr = new Thread(gc);
thr.start();
System.out.println("JOIN");
}
public class GetContent extends Thread
{
private String urlstring;
private String uname;
private String pwd;
private String message,msg;
private boolean disconn = false;
public GetContent(String urlstring, String uname, String pwd)
{
this.urlstring=urlstring;
this.uname = uname;
this.pwd = pwd;
}
public void run()
{
flag = false;
HttpConnection hc = null;
DataInputStream dis = null;
message = "";
msg="";
try
{
String url = urlstring+"?username="+uname+"&password="+pwd;
hc = (HttpConnection)Connector.open(iUrlEncoder.urlEncoder(url));
dis = new DataInputStream(hc.openInputStream());
int ch=0;
int j=1;
while((ch = dis.read()) != -1)
{
message = message + (char)ch;
//j=j+10;
//iHttpMsg.g.setValue(iHttpMsg.g.getValue()+j);
// iHttpMsg.fconnectstatus.append(String.valueOf((char)ch));
}
String test = message.toString();
int t = test.length();
System.out.println("Test: " + test);
String[] result = new String[t];
//String[] result = split(test, "<br>");
result = split(test, "<br>");
System.out.println(" Append to Screen ");
String login="", sms="", report="";
String pendingcr="", usedcr="", msg="";
int resultLength = result.length;
for(int i=0; i<=resultLength; i++)
{
if(resultLength > 2)
{
login = result[0];
pendingcr = result[1];
usedcr = result[2];
sms = result[3];
report = result[4];
msg = result[5];
}
else
{
login = result[0];
}
}
String[] chklogin = split(login, ":");
String[] chkflashsms = split(sms, ":");
String[] chkreport = split(report, ":");
//if(j>=100)
// iHttpMsg.fconnectstatus.delete(0); //delete GUAGE Progess Bar
// FOR CHECK LOGIN OR NOT.
iHttpMsg.fSetTitleConnectStatus(); //FOR SET TILE OF "Connect".
if(chklogin[1].equals("True"))
{
String str = "Login Successfully";
iHttpMsg.fconnectstatus.append(str+"\n");
}
else
{
String str = "Login Failed";
iHttpMsg.fconnectstatus.append(str+"\n");
}
iHttpMsg.fconnectstatus.append(pendingcr+"\n");
iHttpMsg.fconnectstatus.append(usedcr+"\n");
// FOR CHECK SUPPORT FOR FLASH SMS: [Yes/No]
if(chkflashsms[1].equals("0"))
{
strflash = false;
String str = chkflashsms[0] + ":No";
iHttpMsg.fconnectstatus.append(str+"\n");
}
else
{
strflash = true;
String str = chkflashsms[0] + ":Yes";
iHttpMsg.fconnectstatus.append(str+"\n");
}
// FOR CHECK SUPPORT FOR SMS REPORT: [Yes/No]
if(chkreport[1].equals("0"))
{
strreport=false;
String str = chkreport[0] + ":No";
iHttpMsg.fconnectstatus.append(str+"\n");
}
else
{
strreport=true;
String str = chkreport[0] + ":Yes";
iHttpMsg.fconnectstatus.append(str+"\n");
}
iHttpMsg.fconnectstatus.append(msg+"\n");
if(dis != null)
{
dis.close();
iHttpMsg.fconnectstatus.append("DIS Conn. CLOSE \n");
}
if(hc != null)
{
hc.close();
iHttpMsg.fconnectstatus.append("HTTP Conn. CLOSE \n");
}
flag = true;
fHttpConn();
}
catch(Exception e)
{
}
}
}
}
so please give me solution on which place how i will use process bar i saw all links but i face the problem.
Tanya