hi guys . im developing an android application . this application must return Html Source code .acctualy it connects to a web site and must return its Html Source .
But It returns something difrent !
it jumps from some lines ! it does'nt read all of them , i dont know , maybe it just reads pair lines !
i have 30 lines in Source Code but it shows only 14 of them !
i will show you my java code, the Html and the output at the end .
pls look at it and help me .
Here This is my java Code :
public class MainActivity extends Activity {
protected String ShowHtml()
{
int LineCounter=0;
HttpURLConnection urlConnection = null;
String line="";
try
{
URL myUrl=new URL("http://10.0.2.2:80/mob1/Default.aspx");
urlConnection = (HttpURLConnection)myUrl.openConnection();
BufferedReader in = new BufferedReader (new InputStreamReader(urlConnection.getInputStream()));
while(in.readLine()!=null)
{
line=line+in.readLine().toString();
LineCounter++;
}
}
catch(Exception ex0)
{
Log.d("Error : ",ex0.toString());
}
finally
{
if(urlConnection!=null){urlConnection.disconnect(); }
}
int Count=line.length();
return line="Count: "+String.valueOf(Count)+"Line Counter"+LineCounter+"/ Start XML : "+line;
}
class RetrieveFeedTask extends AsyncTask<String, Void, String> {
protected String doInBackground(String... urls) {
try
{
return ShowHtml();
}
catch(Exception e)
{
return e.toString();
}
}
protected void onPostExecute(String Result) {
TextView mytxt2=(TextView)findViewById(R.id.txtReturn);
mytxt2.setText(Result);
}
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
new RetrieveFeedTask().execute();
}
}
Html Source Code :
<html xmlns="http://www.w3.org/1999/xhtml">
<head><title>
Hello
</title></head>
<body>
<form name="form1" method="post" action="Default.aspx" id="form1">
<div>
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUJNzgzNDMwNTMzZGRE1XcQ3ivQexlso8SYFW5dafVfqQ==" />
</div>
<div>
<div>position2</div>
<div>position3</div>
<div>position4</div>
<div>position5</div>
<div>position6</div>
<div>position7</div>
<div>position8</div>
</div>
</form>
</body>
</html>
Application Output :
<head><title>
</title></head>
<form name="form1" method="post" action="Default.aspx" id="form1">
<div>
<div>position3</div>
<div>position5</div>
<div>position7</div>
</div>
</body>