Respacted Sir,
Could u send me solution for, i am sending my code
herewith which is written in java
/*..............................To Extract specific data from web
page......................................*/
import java.net.URL;
import java.net.URLConnection;
//import java.io.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
//import java.util.TimerTask.*;
//import java.util.Date.*;
import java.util.*;
import java.sql.Date;
import java.util.Scanner;
import java.util.StringTokenizer;
import java.util.Timer;
import java.util.TimerTask;
import java.util.logging.Handler;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class mobile //implements Runnable
{
private static String
tag1,tag2,tag3,tag4,tag5,tag6,tag7,tag8,tag9,tag10,tag11,tag12,tag13,tag14,tag15,tag16,tag17,tag18,tag19,tag20;
public static void main(String args[]) {
try {
for(;;)
{
int connectTimeout = 10;
int readTimeout = 20;
URL url = new URL("http://money.rediff.com/mobile/");
URLConnection urlConn = (URLConnection) url.openConnection();
urlConn.setDoOutput(true);
urlConn.setDoInput(true);
urlConn.setDoOutput(true); // 20 Seconds
Connect Timeout
urlConn.setConnectTimeout(connectTimeout *
1000); // 20 Minutes ReadTimeout
urlConn.setReadTimeout(readTimeout * 1000);
try{
urlConn.connect();
}catch(java.net.SocketTimeoutException ex)
{
String msg = "Could not able to establish the connection
between ur machine and money.rediff.com";
System.out.println(msg);
}
String out = null;
try{
out = new
StreamToString().convertStreamToString(urlConn.getInputStream());
// System.out.println(out);
}
catch(java.net.SocketTimeoutException ex){
String msg = "money.rediff.com is not responding";
System.out.println(msg);
}
String tip="<h3
style=\"font-size:14px;\">([^\"]+)</h3>";
Pattern p1=Pattern.compile(tip);
Matcher m1=p1.matcher(out);
if(m1.find())
{
System.out.println(m1.group(1)+"\n\n");
}
String tips1="<[Br][bR]><B>([^\"]+)</B>([^\"]+)<a
href=\".*?.*?.*?.*?\"[^>]*>([^\"]+)</a>([^\"]+)";
Pattern p2=Pattern.compile(tips1);
Matcher m2=p2.matcher(out);
if(m2.find())
{
int a=m2.group(4).indexOf(".");
tag1=m2.group(1)+"\n\t"+m2.group(2)+"\t"+m2.group(3).toUpperCase()+m2.group(4);//.substring(0,a);
if(m2.find())
{
int b=m2.group(4).indexOf(".");
tag2=m2.group(1)+"\n\t"+m2.group(2)+"\t"+m2.group(3).toUpperCase()+m2.group(4);//.substring(0,
b);
if(m2.find())
{
int c=m2.group(4).indexOf(".");
tag3=m2.group(1)+"\n\t"+m2.group(2)+"\t"+m2.group(3).toUpperCase()+m2.group(4);//.substring(0,
c);
if(m2.find())
{
int d=m2.group(4).indexOf(".");
tag4=m2.group(1)+"\n\t"+m2.group(2)+"\t"+m2.group(3).toUpperCase()+m2.group(4);//.substring(0,
d);*/
if(m2.find())
{
int e=m2.group(4).indexOf(".");
tag5=m2.group(1)+"\n\t"+m2.group(2)+"\t"+m2.group(3).toUpperCase()+m2.group(4);//.substring(0,e);
if(m2.find())
{
int f=m2.group(4).indexOf(".");
tag6=m2.group(1)+"\n\t"+m2.group(2)+"\t"+m2.group(3).toUpperCase()+m2.group(4);//.substring(0,
f);
if(m2.find())
{
int g=m2.group(4).indexOf(".");
tag7=m2.group(1)+"\n\t"+m2.group(2)+"\t"+m2.group(3).toUpperCase()+m2.group(4);//.substring(0,
g);
if(m2.find())
{
int h=m2.group(4).indexOf(".");
tag8=m2.group(1)+"\n\t"+m2.group(2)+"\t"+m2.group(3).toUpperCase()+m2.group(4);//.substring(0,
h);
if(m2.find())
{
int i=m2.group(4).indexOf(".");
tag9=m2.group(1)+"\n\t"+m2.group(2)+"\t"+m2.group(3).toUpperCase()+m2.group(4);//.substring(0,i);
if(m2.find())
{
int j=m2.group(4).indexOf(".");
tag10=m2.group(1)+"\n\t"+m2.group(2)+"\t"+m2.group(3).toUpperCase()+m2.group(4);//.substring(0,j);
if(m2.find())
{
int k=m2.group(4).indexOf(".");
tag11=m2.group(1)+"\n\t"+m2.group(2)+"\t"+m2.group(3).toUpperCase()+m2.group(4);//.substring(0,k);
if(m2.find())
{
int l=m2.group(4).indexOf(".");
tag12=m2.group(1)+"\n\t"+m2.group(2)+"\t"+m2.group(3).toUpperCase()+m2.group(4);//.substring(0,l);
if(m2.find())
{
int m=m2.group(4).indexOf(".");
tag13=m2.group(1)+"\n\t"+m2.group(2)+"\t"+m2.group(3).toUpperCase()+m2.group(4);//.substring(0,m);
if(m2.find())
{
int n=m2.group(4).indexOf(".");
tag14=m2.group(1)+"\n\t"+m2.group(2)+"\t"+m2.group(3).toUpperCase()+m2.group(4);//.substring(0,n);
if(m2.find())
{
int o=m2.group(4).indexOf(".");
tag15=m2.group(1)+"\n\t"+m2.group(2)+"\t"+m2.group(3).toUpperCase()+m2.group(4);//.substring(0,o);
if(m2.find())
{
int p=m2.group(4).indexOf(".");
tag16=m2.group(1)+"\n\t"+m2.group(2)+"\t"+m2.group(3).toUpperCase()+m2.group(4);//.substring(0,p);
if(m2.find())
{
int q=m2.group(4).indexOf(".");
tag17=m2.group(1)+"\n\t"+m2.group(2)+"\t"+m2.group(3).toUpperCase()+m2.group(4);//.substring(0,q);
if(m2.find())
{
int r=m2.group(4).indexOf(".");
tag18=m2.group(1)+"\n\t"+m2.group(2)+"\t"+m2.group(3).toUpperCase()+m2.group(4);//.substring(0,r);
if(m2.find())
{
int s=m2.group(4).indexOf(".");
tag19=m2.group(1)+"\n\t"+m2.group(2)+"\t"+m2.group(3).toUpperCase()+m2.group(4);//.substring(0,s);
if(m2.find())
{
int t=m2.group(4).indexOf(".");
tag20=m2.group(1)+"\n\t"+m2.group(2)+"\t"+m2.group(3).toUpperCase()+m2.group(4);//.substring(0,t);
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
System.out.println(tag1+"\n\n"+tag2+"\n\n"+tag3+"\n\n"+tag4+"\n\n"+tag5+"\n\n"+tag6+"\n\n"+tag7+"\n\n"+tag8+"\n\n"+tag9+"\n\n"+tag10+"\n\n"+tag11+"\n\n"+tag12+"\n\n"+tag13+"\n\n"+tag14);
Thread.sleep(5000);
}
}
catch (Exception ex) {
ex.printStackTrace();
throw new RuntimeException("Exception occured in
testDownApplicationTurnedGreenByTraffic", ex);
}
}
}
On Mon, Dec 20, 2010 at 9:33 PM, TreKing <[email protected]> wrote:
> On Mon, Dec 20, 2010 at 3:27 AM, Ravindra Chavan <
> [email protected]> wrote:
>
>> I thought that i got this error due to main thread. Is it like
>> that?
>
>
> If you're reading data from the network on the main thread ... yes, that
> would probably cause an ANR.
>
>
> -------------------------------------------------------------------------------------------------
> TreKing <http://sites.google.com/site/rezmobileapps/treking> - Chicago
> transit tracking app for Android-powered devices
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]<android-developers%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en