NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

package com.example.nami.namicollege;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;

import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;

import javax.net.ssl.HttpsURLConnection;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;

public class MainActivity extends AppCompatActivity {
TextView textt;
Button btn;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}

public void load_clicked(View view){

Thread thread = new Thread(new Runnable() {
@Override
public void run() {
try {
String s ="";

URL url = new URL("http://169.254.198.128:8888/nami/newtest.php");//makingconnection with server
URLConnection connection = url.openConnection();
HttpsURLConnection httpsURLConnection = (HttpsURLConnection) connection;//typecast
int reponsecode = httpsURLConnection.getResponseCode();//gets responsecode
int l = httpsURLConnection.getContentLength();

if (reponsecode == HttpsURLConnection.HTTP_OK){
InputStream in = httpsURLConnection.getInputStream();
InputStreamReader inn = new InputStreamReader(in);
BufferedReader bin = new BufferedReader(inn);

do {
s = s+ bin.readLine() + "n";

}

while (s.length()< l);
in.close();
}

Log.d("NAMI",s );
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
Document dom = db.parse(new ByteArrayInputStream(s.getBytes()));

Element docelement = dom.getDocumentElement();
NodeList nl = docelement.getElementsByTagName("record");

for(int i =0; i< nl.getLength();i++){
Element entry = (Element)nl.item(i);
Element id = (Element)entry.getElementsByTagName("id").item(0);
Element name = (Element)entry.getElementsByTagName("name").item(0);
Element address= (Element)entry.getElementsByTagName("address").item(0);
String valueid = id.getFirstChild().getNodeValue();
String valuename = name.getFirstChild().getNodeValue();
String valueaddress = address.getFirstChild().getNodeValue();
Log.d("NAMI", valueid +"," + valuename +" ," + address + ",");
}

}
catch (Exception e){
e.printStackTrace();
}

}
});

thread.start();
}
}
     
 
what is notes.io
 

Notes.io is a web-based application for 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 12 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

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.