lsvife -4 Junior Poster in Training

could anybody help me..
im stack with this..
alert is not shown when i entered invalid username and password
but when i entered correct username and password it runs smoothly...
it only print what i want to print as a tracker....
this is the code:

if(c==login)
{
        display.setCurrent(agauge);
	loginmethod();
}

login method..called when button login is press

public void loginmethod()
{
	try{
	t4=new Thread(new Runnable()
	{
		public void run()
		{
	             String passwd=password.getString();
		String pass=passwd.trim();
		String usernme=username.getString();
		user=usernme.trim();
		//System.out.println(user);
		String url="http://192.168.178.101/server/tested/mobile/loginmobile.php?uid="+user+"&pwd="+pass;
		System.out.println(url);
		try
		{
			HttpConnection conn=(HttpConnection)Connector.open(url);
			InputStream is=conn.openInputStream();
			int data=0;
			String s="";
			while((data=is.read())!=-1)
			{
									
				s+=(char)data;	
				if(s.equals("ok"))
				{
					listcg();
					System.out.println("idiotness");
										
				}
			else
			if(s.equals("failed"))
			{
				alert1.setString("Invalid Username or Password!");//not shown
				display.setCurrent(alert1,frmlogin);
				display.setCurrentItem(username);
				username.setString("");
				password.setString("");
				System.out.println("Tracker...alert is not shown");
			}
		      }
		conn.close();
		t4.yield();
		}
		catch(Exception e)
		{
			alert.setString("Connection Error");
			display.setCurrentItem(username);
			display.setCurrent(alert,frmlogin);
		}
						
	}
	});t4.start();
	}catch(Exception et){et.printStackTrace();}
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.