Notes
![]() ![]() Notes - notes.io |
import android.os.AsyncTask;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ListView;
import android.widget.TextView;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
public class MainActivity extends AppCompatActivity
{
Elements kurlar = new Elements();
SwipeRefreshLayout srl;
ListView lv;
BaseAdapter ba;
LayoutInflater li;
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
srl = (SwipeRefreshLayout) findViewById(R.id.srl);
srl.setRefreshing(true);
getKurlar();
srl.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener()
{
public void onRefresh()
{
getKurlar();
}
});
lv = (ListView) findViewById(R.id.lv);
li = LayoutInflater.from(this);
ba = new BaseAdapter()
{
public int getCount() {
return kurlar.size();
}
@Override
public Object getItem(int i) {
return null;
}
@Override
public long getItemId(int i) {
return 0;
}
@Override
public View getView(int i, View view, ViewGroup viewGroup) {
if (view == null)
view = li.inflate(R.layout.item, null);
TextView tvAd = (TextView) view.findViewById(R.id.tvAd);
TextView tvAlis = (TextView) view.findViewById(R.id.tvAlis);
TextView tvSatis = (TextView) view.findViewById(R.id.tvSatis);
Element kur = kurlar.get(i);
tvAd.setText( kur.select("Isim").text() );
tvAlis.setText( kur.select("ForexBuying").text() );
tvSatis.setText( kur.select("ForexSelling").text() );
return view;
}
};
lv.setAdapter(ba);
}
void getKurlar()
{
new AsyncTask<String, String, String>()
{
protected String doInBackground(String... strings)
{
try
{
kurlar = Jsoup
.connect("http://www.tcmb.gov.tr/kurlar/today.xml")
.timeout(30000)
.userAgent("Mozilla")
.get()
.select("Currency");
Log.e("x","Kur Sayisi : "+kurlar.size());
for (Element kur : kurlar)
{
String ad = kur.select("Isim").text();
String alis = kur.select("ForexBuying").text();
String satis = kur.select("ForexSelling").text();
Log.e("x",ad+" --> "+alis+" / "+satis);
}
} catch (Exception e) { Log.e("x","Hata : "+e); }
return null;
}
protected void onPostExecute(String s) {
srl.setRefreshing(false);
ba.notifyDataSetChanged();
}
}.execute();
}
}
![]() |
Notes is a web-based application for online taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000+ notes created and continuing...
With notes.io;
- * You can take a note from anywhere and any device with internet connection.
- * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
- * You can quickly share your contents without website, blog and e-mail.
- * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
- * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.
Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.
Easy: Notes.io doesn’t require installation. Just write and share note!
Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )
Free: Notes.io works for 14 years and has been free since the day it was started.
You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;
Email: [email protected]
Twitter: http://twitter.com/notesio
Instagram: http://instagram.com/notes.io
Facebook: http://facebook.com/notesio
Regards;
Notes.io Team