×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Regular Contributor
    Join Date
    Nov 2006
    Location
    Rajkot
    Posts
    430

    How to use Gauge/Process Bar when using HttpConnection?

    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

  2. #2
    Super Contributor
    Join Date
    Nov 2003
    Location
    Bangalore , India
    Posts
    4,430

    Re: How to use Gauge/Process Bar when using HttpConnection?

    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.

  3. #3
    Regular Contributor
    Join Date
    Nov 2006
    Location
    Rajkot
    Posts
    430

    Re: How to use Gauge/Process Bar when using HttpConnection?

    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

Similar Threads

  1. Dynamically change menu bar?
    By hanwang in forum Symbian User Interface
    Replies: 7
    Last Post: 2008-03-21, 06:48
  2. Wait progres bar Theme Studio v1.2.x v2.0 v3.0
    By Deltafox79 in forum Themes/Carbide.ui
    Replies: 2
    Last Post: 2007-09-19, 20:51
  3. Drawing Progress Bar?
    By SymbieRahul in forum Symbian User Interface
    Replies: 0
    Last Post: 2006-08-07, 08:57
  4. HttpConnection through a wap gw with Nokia 6600
    By ntalfer in forum Mobile Java Networking & Messaging & Security
    Replies: 4
    Last Post: 2006-01-20, 14:29
  5. Handling Progress Bar on Socket Connection
    By amitaggarwal in forum Symbian C++
    Replies: 2
    Last Post: 2004-09-30, 19:36

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •