Notes![what is notes.io? What is notes.io?](/theme/images/whatisnotesio.png)
![]() ![]() Notes - notes.io |
import android.content.Intent;
import android.graphics.Bitmap;
import android.os.AsyncTask;
import android.provider.MediaStore;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import org.json.JSONArray;
import org.json.JSONException;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URL;
public class MainActivity extends AppCompatActivity {
public static String API_TC = "ilkprojem-152211";
public static String API_KEY = "AIzaSyD2dPEQ5D69qvocPWc7VjTHeg26mb4kJY";
Button button;
EditText ulke;
TextView a1,a2,a3,a4;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ulke = (EditText)findViewById(R.id.ulke);
final String secilenUlke = ulke.getText().toString();
button = (Button)findViewById(R.id.btn2);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
jsonParse js = new jsonParse(secilenUlke);
js.execute();
}
});
a1 = (TextView)findViewById(R.id.country);
a2 = (TextView)findViewById(R.id.capital);
a3 = (TextView)findViewById(R.id.lang);
a4 = (TextView)findViewById(R.id.nufus);
}
public class jsonParse extends AsyncTask<Void,Void,Void>{
String country,lang, capital;
int nufus;
String arama;
public jsonParse(String _arama){
arama = _arama;
}
@Override
protected Void doInBackground(Void... voids) {
String result;
try {
URL adres = new URL("https://restcountries.eu/rest/v1/name/"+arama);
BufferedReader bfReader = null;
StringBuilder sb = new StringBuilder();
bfReader = new BufferedReader(
new InputStreamReader(adres.openStream())
);
String line = null;
while((line = bfReader.readLine()) != null){
sb.append(line).append("n");
}
result = sb.toString();
bfReader.close();
JSONArray json = new JSONArray(result);
country = json.getJSONObject(0).getString("name");
capital = json.getJSONObject(0).getString("capital");
lang = json.getJSONObject(0).getString("demonym");
nufus = json.getJSONObject(0).getInt("population");
runOnUiThread(new Runnable() {
@Override
public void run() {
a1.setText("Ülke : "+country);
a2.setText("Başkent : "+capital);
a3.setText("Dil : "+lang);
a4.setText("Nufüs : "+nufus);
}
});
}catch(SecurityException e ){
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (JSONException e) {
e.printStackTrace();
}
return null;
}
@Override
protected void onPostExecute(Void aVoid) {
super.onPostExecute(aVoid);
}
}
}
![]() |
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