shanmugi try

Greenhorn
+ Follow
since Jun 04, 2013
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by shanmugi try

String result;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sec);
et1 = (EditText) this.findViewById(R.id.editText1);
t1 = (TextView) this.findViewById(R.id.textView1);
t2 = (TextView) this.findViewById(R.id.textView2);
b1 = (Button) this.findViewById(R.id.button1);
b2 = (Button) this.findViewById(R.id.button2);
b1.setOnClickListener(new View.OnClickListener() {

@Override
public void onClick(View v) {
t2.setText(et1.getText());
result = et1.getText().toString();

}
});
b2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent i = new Intent(v.getContext(),ThirdActivity.class);
startActivity(i);
}
});
}
public String value(){
return result;
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.main, menu);
return true;
}

public class Text extends PagerAdapter{

Context context;
SecondActivity s = new SecondActivity();
private String[] textViewer = new String[]{
s.value(),
"Hai"

};
public ImageAdapter(Context context){
this.context= context;
}

@Override
public int getCount() {
return textViewer.length;
}

@Override
public boolean isViewFromObject(View view, Object object) {
return view==((TextView)object);
}
public Object instantiateItem(ViewGroup container, int position) {
TextView textView = new TextView(context);
textView.setText(textViewer[position]);
((ViewPager) container).addView(textView, 0);
return textView;
}

@Override
public void destroyItem(ViewGroup container, int position, Object object) {
((ViewPager) container).removeView((TextView) object);
}

}

I want the edit text value to be added in the View Pager.It is returning null value.Actual requirement is i want to pass the edit text value to a class which extends PagerAdapter
11 years ago
I am using JSOUP API to scrape the contents of the webpage.I am attaching the html source code and Java source code which i have tried.

Document document = Jsoup
.connect(
"http://sports.williamhill.com/bet/en-gb/betting/e/4509085/St-Patricks-v-Limerick.html")
.timeout(1000 * 1000).get();
Elements content = document.select("div.livePushContent");
Elements info = content.select("div#allMarketsTab");
Elements primerycollect = info.select("div#primaryCollectionContainer");

System.out.println("1..............................................");
System.out.println("No of Tab's: "
+ info.select("div#primaryCollectionContainer")
.select("div.marketHolderExpanded").size());
Elements market = primerycollect.select("table.tableData");
Elements tbody = market.select("tbody");
for (int i = 0; i < info.select("div#primaryCollectionContainer")
.select("div.marketHolderExpanded").size(); i++) {
int a = 1;
a+=i;
System.out.println("Tab No"+a+": "+info.select("div#primaryCollectionContainer")
.select("div.marketHolderExpanded").get(i)
.select("table.tableData").select("thead").select("tr")
.select("th[class~=leftPad title]").select("span").last().text());


}

Elements primerycollect1 = info.select("div#sur_collection_267");
System.out.println("..............................................");
System.out.println("2..............................................");
System.out.println("No of Tab's: "
+ info.select("div#sur_collection_267")
.select("div.marketHolderExpanded").size());
Elements market1 = primerycollect1.select("table.tableData");
Elements tbody1 = market1.select("tbody");
for (int i = 0; i < info.select("div#sur_collection_267")
.select("div.marketHolderExpanded").size(); i++) {
System.out.println("Tab No"+i+++": "+info.select("div#sur_collection_267")
.select("div.marketHolderExpanded")
.select("table.tableData")
.select("thead").select("tr")
.select("th[class~=leftPad title]").select("span").last().text());



}
System.out.println("3..............................................");
System.out.println("No of Tab's: "
+ info.select("div#sur_collection_25")
.select("div#collection25").size());
Elements primerycollect2 = info.select("div#sur_collection_25");
Elements market2 = primerycollect2.select("table.tableData");
Elements tbody2 = market2.select("tbody");
for (int i = 0; i < info.select("div#sur_collection_25")
.select("div#collection25").size(); i++) {
System.out.println("Tab No"+i+": "+info.select("div#sur_collection_25")
.select("div.collectionContainer displayBlock displayNone")
.select("div.marketHolderCollapsed").get(i)
.select("table.tableData").select("thead").select("tr")
.select("th[class~=leftPad title]").select("span").last().text());


}

System.out.println("..............................................");
The output iam getting is
1..............................................
No of Tab's: 10
Tab No1: Match Betting
Tab No2: Correct Score
Tab No3: Double Result
Tab No4: Draw No Bet
Tab No5: Match Handicaps
Tab No6: Double Chance
Tab No7: Both Teams To Score
Tab No8: 1st Half Betting
Tab No9: 2nd Half Betting
Tab No10: Total Match Goals Under/Over
..............................................
2..............................................
No of Tab's: 1
Tab No0: GOAL scored in the first 5 minutes? 00:00 - 04:59
3..............................................
No of Tab's: 1
..............................................




Now i am attaching the html source code
which i am not able to scrpe
<div id="sur_collection_25">
<div class="collectionHdr" id = "collection25Hdr">
<span class="collectionName" id = "collection25NameShow">
<a style="text-decoration: none;" href = "Javascript:toggleEvCol('collection25' , 25, '4509085');" >Goals</a>
</span>
<span class="collectionName displayNone" id = "collection25NameHide" style="color: #777777;">
Goals
</span>
<a class = "collectionShowLink displayInlineBlock" href = "Javascript:expandCollection('collection25', 25, '4509085')" id = "collection25Show" >Show All <span id = "collection25NumMkts" >30</span> Markets</a>
<a class = "collectionHideLink displayInlineBlock displayNone" href = "Javascript:collapseCollection('collection25')" id = "collection25Hide"
>Collapse</a>
<a class = "collectionWaitLink displayInlineBlock displayNone" id = "collection25Wait" ></a>
</div>

<div id="collection25" class="collectionContainer displayNone"></div>
<div class="clearBoth"></div>
<div class="collectionFtr"></div>
</div>
My Actual Requirement is i want to scrape all the tab names of the page like Match Betting,Correct Score,etc.For the attached html source code i am having 52 tabs.The problem occurs in the third part of the tag as you can see in the output.It should return St Patricks To Score Both Halves ,Limerick To Score Both Halves .etc .It is returning null values.I am not able to scrape.I want to know the reason behind that.Please help me.It is needed very urgently.They are updating the site frequently.If it is not having any tabs .Please inform me .i will mention the different url.
11 years ago