Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <div id="detay" class="grid_8 info beyazbg">
- <div class='detayici'>
- <h1 class="haberbaslik">
- <span id="ContentPlaceHolder1_Lbaslik">Son 5 yılın YGS konu soru dağılımı </span>
- </h1>
- <table border="0" cellpadding="0" cellspacing="0" width="490" style="border-collapse:
 collapse;width:370pt">
- <colgroup><col width="72" style="mso-width-source:userset;mso-width- alt:2633;width:54pt" />
- <col width="188" style="mso-width-source:userset;mso-width-alt:6875;width:141pt" />
- <col width="46" span="5" style="mso-width-source:userset;mso-width-alt:1682;
 width:35pt" />
- </colgroup><tbody><tr style="mso-height-source:userset;height:14.1pt">
- <td height="18" class="xl70" width="72" style="height:14.1pt;width:54pt">YGS
- MATEMATİK</td>
- <td class="xl65" width="188" style="border-left:none;width:141pt">KONULAR</td>
- <td class="xl64" width="46" style="border-left:none;width:35pt">2011</td>
- <td class="xl64" width="46" style="border-left:none;width:35pt">2012</td>
- <td class="xl64" width="46" style="border-left:none;width:35pt">2013</td>
- <td class="xl64" width="46" style="border-left:none;width:35pt">2014</td>
- <td class="xl64" width="46" style="border-left:none;width:35pt">2015</td>
- </tr>
- <tr style="mso-height-source:userset;height:14.1pt">
- <td height="18" class="xl71" width="72" style="height:14.1pt;width:54pt"> <span style="visibility:hidden;mso-ignore:visibility; text-decoration: underline;"> </span></td>
- <td class="xl66" style="border-top:none;border-left:none">RASYONEL SAYILAR</td>
- <td class="xl63" style="border-top:none;border-left:none">4</td>
- <td class="xl63" style="border-top:none;border-left:none">1</td>
- <td class="xl63" style="border-top:none;border-left:none"> </td>
- <td class="xl63" style="border-top:none;border-left:none">1</td>
- <td class="xl63" style="border-top:none;border-left:none">1</td>
- </tr>
- public class CikmisSorular extends Activity {
- private Button titleButton, descButton, logoButton, yazarlarButton;
- LinearLayout title_layout, desc_layout, logo_layout, yazarlar_layout;
- private ProgressDialog progressDialog;
- private static String URL = "http://www.utercih.com/rehberlik.aspx";
- private static String baseUrl = "http://www.utercih.com/rehberlik.aspx";
- private static String authorUrl = "http://www.utercih.com/rehberlik.aspx";
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_cikmis_sorular);
- titleButton = (Button)findViewById(R.id.buttonTitle);
- descButton = (Button)findViewById(R.id.buttonDesc);
- logoButton = (Button)findViewById(R.id.buttonImage);
- yazarlarButton = (Button)findViewById(R.id.buttonYazarlar);
- titleButton.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- new FetchTitle().execute(); // başlık çekmek için
- }
- });
- descButton.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- new FetchDescription().execute(); // açıklama çekmek için
- }
- });
- logoButton.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- new FetchImageLogo().execute(); // logo çekmek için
- }
- });
- yazarlarButton.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- new FetchYazarlar().execute(); // yazarlar kısmını çekmek için
- }
- });
- }
- private class FetchTitle extends AsyncTask<Void, Void, Void> {
- String title;
- @Override
- protected void onPreExecute() {
- super.onPreExecute();
- progressDialog = new ProgressDialog(CikmisSorular.this);
- progressDialog.setTitle("BAŞLIK");
- progressDialog.setMessage("Başlık Çekiliyor...");
- progressDialog.setIndeterminate(false);
- progressDialog.show();
- }
- @Override
- protected Void doInBackground(Void... params) {
- try{
- Document doc = Jsoup.connect(URL).get(); // web siteye bağlantıyı gerçeleştirme
- title = doc.title(); // ilgili sayfanın başlığını almak için
- }catch (Exception e){
- e.printStackTrace();
- }
- return null;
- }
- @Override
- protected void onPostExecute(Void aVoid) {
- title_layout = (LinearLayout)findViewById(R.id.title_layout);
- TextView txt_title = (TextView)findViewById(R.id.txt_title);
- title_layout.setVisibility(View.VISIBLE);
- txt_title.setText("Title: " + "" + title);
- progressDialog.dismiss();
- }
- }
- private class FetchDescription extends AsyncTask<Void, Void, Void> {
- String desc;
- @Override
- protected void onPreExecute() {
- super.onPreExecute();
- progressDialog = new ProgressDialog(CikmisSorular.this);
- progressDialog.setTitle("AÇIKLAMA");
- progressDialog.setMessage("Açıklama Çekiliyor...");
- progressDialog.setIndeterminate(false);
- progressDialog.show();
- }
- @Override
- protected Void doInBackground(Void... params) {
- try{
- Document doc = Jsoup.connect(URL).get();
- Elements elements = doc.select("div[class=detayici]"); // ilgili sayfanın açıklamasını almak için
- desc = elements.attr("content");
- }catch (Exception e){
- e.printStackTrace();
- }
- return null;
- }
- @Override
- protected void onPostExecute(Void aVoid) {
- desc_layout = (LinearLayout)findViewById(R.id.desc_layout);
- TextView txt_desc = (TextView)findViewById(R.id.txt_desc);
- desc_layout.setVisibility(View.VISIBLE);
- txt_desc.setText("Description: " + "" + desc);
- progressDialog.dismiss();
- }
- }
- private class FetchImageLogo extends AsyncTask<Void, Void, Void> {
- Bitmap bitmap;
- @Override
- protected void onPreExecute() {
- super.onPreExecute();
- progressDialog = new ProgressDialog(CikmisSorular.this);
- progressDialog.setTitle("LOGO");
- progressDialog.setMessage("Logo Çekiliyor...");
- progressDialog.setIndeterminate(false);
- progressDialog.show();
- }
- @Override
- protected Void doInBackground(Void... params) {
- try{
- Document doc = Jsoup.connect(baseUrl).get();
- Elements elements = doc.select("img[src]");
- String imgSrc = elements.attr("src");
- InputStream input = new java.net.URL(imgSrc).openStream();
- bitmap = BitmapFactory.decodeStream(input);
- }catch (Exception e){
- e.printStackTrace();
- }
- return null;
- }
- @Override
- protected void onPostExecute(Void aVoid) {
- logo_layout = (LinearLayout)findViewById(R.id.logo_layout);
- ImageView img_logo = (ImageView)findViewById(R.id.img_logo);
- logo_layout.setVisibility(View.VISIBLE);
- img_logo.setImageBitmap(bitmap);
- progressDialog.dismiss();
- }
- }
- private class FetchYazarlar extends AsyncTask<Void, Void, Void> {
- String authors;
- @Override
- protected void onPreExecute() {
- super.onPreExecute();
- progressDialog = new ProgressDialog(CikmisSorular.this);
- progressDialog.setTitle("YAZARLAR");
- progressDialog.setMessage("Yazarlar Çekiliyor...");
- progressDialog.setIndeterminate(false);
- progressDialog.show();
- }
- @Override
- protected Void doInBackground(Void... params) {
- try{
- Document doc = Jsoup.connect(authorUrl).get();
- Elements elements = doc.select("div[class=post-content]"); // class ismi post-content olan verileri çekmek için
- authors = elements.text();
- }catch (Exception e){
- e.printStackTrace();
- }
- return null;
- }
- @Override
- protected void onPostExecute(Void aVoid) {
- yazarlar_layout = (LinearLayout)findViewById(R.id.yazarlar_layout);
- TextView txt_yazarlar = (TextView)findViewById(R.id.txt_yazarlar);
- yazarlar_layout.setVisibility(View.VISIBLE);
- txt_yazarlar.setText(authors);
- progressDialog.dismiss();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement