SlideShare une entreprise Scribd logo
1  sur  5
Télécharger pour lire hors ligne
Create New Android Project in Eclipse.

1. Name of Project: - TestJSONWebService
2. Build Target: - Android (2.2)
3. Application Name: - TestWebService
4. Package Name: - parallelminds.webservice.com
5. Create Activity: - TestWebServiceActivity

Now our First Activity is TestWebServiceActivity which as followes.This class is used to make
a call JSON web service. using callWebService() method.


package parallelminds.testservice.com;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
import org.apache.http.HttpResponse;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.MenuItem.OnMenuItemClickListener;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;

public class TestServiceActivity extends ListActivity {

       LinearLayout objLinearLayout;
       TextView tv;
int receivedJArrayLength;
       private static String url = "http://202.71.142.203:8871/Service.svc/GetProjects";

        /** Called when the activity is first created. */
        @Override
        public void onCreate(Bundle savedInstanceState) {
                super.onCreate(savedInstanceState);
                setContentView(R.layout.main);
        this.setListAdapter(new ArrayAdapter <String>
(this,android.R.layout.simple_list_item_1,this.ParsedJson()));

       }

        // Method returning array list of JSON web-service
       private ArrayList<String> ParsedJson()
       {
               ArrayList<String> listItems = new ArrayList<String>();

               CallWebService objCallWebService = new CallWebService();

               JSONArray receivedJArray = objCallWebService.callWebService(url);
               receivedJArrayLength = receivedJArray.length();


               TextView showmsg = new TextView(this);
               showmsg.setText(msg);
               objLinearLayout.addView(showmsg);*/
               if (receivedJArray != null)

                      for (int i = 0; i < receivedJArrayLength; i++) {
                               try {

                                     String displayString = "";
                                     JSONObject jObj = receivedJArray.getJSONObject(i);

               displayString += "------------n";
               displayString += "Id :" + jObj.getString("Id") + "n";
               displayString += "Name :" + jObj.getString("Name") + "n";
               displayString += "KickOffNotes:"+jObj.getString("KickOffNotes") + "n";
               displayString += "Description :"+ jObj.getString("Description") + "n";
               displayString += "MemberCount :" + jObj.getString("MemberCount") + "n";
               displayString += "StartDate :"+ jObj.getString("StartDate") + "n";
               displayString += "DeliveryDate :"+ jObj.getString("DeliveryDate") + "n";
               displayString += "Status :" + jObj.getString("Status")+ "nn";
               displayString += "n********";
listItems.add(displayString);

                              } catch (JSONException e) {
                                      // TODO Auto-generated catch block
                                      e.printStackTrace();
                              }
                      }

              return listItems;
       }


}

This is our second class CallWebService
package parallelminds.testservice.com;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URI;
import java.net.URISyntaxException;
import org.apache.http.HttpResponse;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;
import org.json.JSONArray;
import org.json.JSONException;
import android.util.Log;

public class CallWebService {

       // This method is used to get JSONArray Object
       JSONArray callWebService(String serviceURL) {
               JSONArray jArray = null;
               // http get client
               HttpClient client = new DefaultHttpClient();
               HttpGet getRequest = new HttpGet();
               try {
                        // get the requested URI
                        getRequest.setURI(new URI(serviceURL));
               } catch (URISyntaxException e) {
                        Log.e("URISyntaxException", e.toString());
               }
               // read the response in the buffer
BufferedReader in = null;
    // the service response
    HttpResponse response = null;
    try {
             // call the requested url
             response = client.execute(getRequest);
    } catch (ClientProtocolException e) {
             Log.e("ClientProtocolException", e.toString());
    } catch (IOException e) {
             Log.e("IO exception", e.toString());
    }
    try {
             in = new BufferedReader(new InputStreamReader(response.getEntity()
                              .getContent()));
    } catch (IllegalStateException e) {
             Log.e("IllegalStateException", e.toString());
    } catch (IOException e) {
             Log.e("IO exception", e.toString());
    }
    StringBuffer buff = new StringBuffer("");
    String line = "";
    try {
             while ((line = in.readLine()) != null) {
                      buff.append(line);
             }
    } catch (IOException e) {
             Log.e("IO exception", e.toString());

    }

    try {
            in.close();
    } catch (IOException e) {
            Log.e("IO exception", e.toString());
    }
    // now we need to parse the response
    String result = buff.toString();

    try {
           jArray = new JSONArray(result);
    } catch (JSONException e) {
           Log.e("log_tag", "Error parsing data " + e.toString());
    }
    return jArray;
}
}


Now our main.xml is as follows.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
       android:orientation="vertical" android:layout_width="fill_parent"
       android:layout_height="fill_parent" android:id="@+id/MainLayoutPMTS">

       <ListView android:id="@id/android:list" android:layout_height="match_parent"
              android:layout_width="match_parent" ></ListView>

       <TextView android:id="@+id/webXml" android:layout_width="fill_parent"
             android:layout_height="fill_parent">
             </TextView>

</LinearLayout>

Contenu connexe

Tendances

Laporan multiclient chatting client server
Laporan multiclient chatting client serverLaporan multiclient chatting client server
Laporan multiclient chatting client servertrilestari08
 
Ensure code quality with vs2012
Ensure code quality with vs2012Ensure code quality with vs2012
Ensure code quality with vs2012Sandeep Joshi
 
Alexey Tsoy Meta Programming in C++ 16.11.17
Alexey Tsoy Meta Programming in C++ 16.11.17Alexey Tsoy Meta Programming in C++ 16.11.17
Alexey Tsoy Meta Programming in C++ 16.11.17LogeekNightUkraine
 
The Ring programming language version 1.6 book - Part 15 of 189
The Ring programming language version 1.6 book - Part 15 of 189The Ring programming language version 1.6 book - Part 15 of 189
The Ring programming language version 1.6 book - Part 15 of 189Mahmoud Samir Fayed
 
Reactive, component 그리고 angular2
Reactive, component 그리고  angular2Reactive, component 그리고  angular2
Reactive, component 그리고 angular2Jeado Ko
 
GoCracow #5 Bartlomiej klimczak - GoBDD
GoCracow #5 Bartlomiej klimczak - GoBDDGoCracow #5 Bartlomiej klimczak - GoBDD
GoCracow #5 Bartlomiej klimczak - GoBDDBartłomiej Kiełbasa
 
The secret unit testing tools no one ever told you about
The secret unit testing tools no one ever told you aboutThe secret unit testing tools no one ever told you about
The secret unit testing tools no one ever told you aboutDror Helper
 
Promise: async programming hero
Promise: async programming heroPromise: async programming hero
Promise: async programming heroThe Software House
 
Create a Customized GMF DnD Framework
Create a Customized GMF DnD FrameworkCreate a Customized GMF DnD Framework
Create a Customized GMF DnD FrameworkKaniska Mandal
 
The Ring programming language version 1.7 book - Part 16 of 196
The Ring programming language version 1.7 book - Part 16 of 196The Ring programming language version 1.7 book - Part 16 of 196
The Ring programming language version 1.7 book - Part 16 of 196Mahmoud Samir Fayed
 
Unit testing patterns for concurrent code
Unit testing patterns for concurrent codeUnit testing patterns for concurrent code
Unit testing patterns for concurrent codeDror Helper
 
Devoxx 2012 hibernate envers
Devoxx 2012   hibernate enversDevoxx 2012   hibernate envers
Devoxx 2012 hibernate enversRomain Linsolas
 
Lexical environment in ecma 262 5
Lexical environment in ecma 262 5Lexical environment in ecma 262 5
Lexical environment in ecma 262 5Kim Hunmin
 
How to build an AOP framework in ActionScript
How to build an AOP framework in ActionScriptHow to build an AOP framework in ActionScript
How to build an AOP framework in ActionScriptChristophe Herreman
 
The Ring programming language version 1.3 book - Part 30 of 88
The Ring programming language version 1.3 book - Part 30 of 88The Ring programming language version 1.3 book - Part 30 of 88
The Ring programming language version 1.3 book - Part 30 of 88Mahmoud Samir Fayed
 
JavaScript - i och utanför webbläsaren (2010-03-03)
JavaScript - i och utanför webbläsaren (2010-03-03)JavaScript - i och utanför webbläsaren (2010-03-03)
JavaScript - i och utanför webbläsaren (2010-03-03)Anders Jönsson
 
Ian 20150116 java script oop
Ian 20150116 java script oopIan 20150116 java script oop
Ian 20150116 java script oopLearningTech
 

Tendances (18)

Laporan multiclient chatting client server
Laporan multiclient chatting client serverLaporan multiclient chatting client server
Laporan multiclient chatting client server
 
Ensure code quality with vs2012
Ensure code quality with vs2012Ensure code quality with vs2012
Ensure code quality with vs2012
 
Alexey Tsoy Meta Programming in C++ 16.11.17
Alexey Tsoy Meta Programming in C++ 16.11.17Alexey Tsoy Meta Programming in C++ 16.11.17
Alexey Tsoy Meta Programming in C++ 16.11.17
 
The Ring programming language version 1.6 book - Part 15 of 189
The Ring programming language version 1.6 book - Part 15 of 189The Ring programming language version 1.6 book - Part 15 of 189
The Ring programming language version 1.6 book - Part 15 of 189
 
Reactive, component 그리고 angular2
Reactive, component 그리고  angular2Reactive, component 그리고  angular2
Reactive, component 그리고 angular2
 
GoCracow #5 Bartlomiej klimczak - GoBDD
GoCracow #5 Bartlomiej klimczak - GoBDDGoCracow #5 Bartlomiej klimczak - GoBDD
GoCracow #5 Bartlomiej klimczak - GoBDD
 
The secret unit testing tools no one ever told you about
The secret unit testing tools no one ever told you aboutThe secret unit testing tools no one ever told you about
The secret unit testing tools no one ever told you about
 
Promise: async programming hero
Promise: async programming heroPromise: async programming hero
Promise: async programming hero
 
Create a Customized GMF DnD Framework
Create a Customized GMF DnD FrameworkCreate a Customized GMF DnD Framework
Create a Customized GMF DnD Framework
 
The Ring programming language version 1.7 book - Part 16 of 196
The Ring programming language version 1.7 book - Part 16 of 196The Ring programming language version 1.7 book - Part 16 of 196
The Ring programming language version 1.7 book - Part 16 of 196
 
Unit testing patterns for concurrent code
Unit testing patterns for concurrent codeUnit testing patterns for concurrent code
Unit testing patterns for concurrent code
 
Devoxx 2012 hibernate envers
Devoxx 2012   hibernate enversDevoxx 2012   hibernate envers
Devoxx 2012 hibernate envers
 
meet.js - QooXDoo
meet.js - QooXDoomeet.js - QooXDoo
meet.js - QooXDoo
 
Lexical environment in ecma 262 5
Lexical environment in ecma 262 5Lexical environment in ecma 262 5
Lexical environment in ecma 262 5
 
How to build an AOP framework in ActionScript
How to build an AOP framework in ActionScriptHow to build an AOP framework in ActionScript
How to build an AOP framework in ActionScript
 
The Ring programming language version 1.3 book - Part 30 of 88
The Ring programming language version 1.3 book - Part 30 of 88The Ring programming language version 1.3 book - Part 30 of 88
The Ring programming language version 1.3 book - Part 30 of 88
 
JavaScript - i och utanför webbläsaren (2010-03-03)
JavaScript - i och utanför webbläsaren (2010-03-03)JavaScript - i och utanför webbläsaren (2010-03-03)
JavaScript - i och utanför webbläsaren (2010-03-03)
 
Ian 20150116 java script oop
Ian 20150116 java script oopIan 20150116 java script oop
Ian 20150116 java script oop
 

En vedette

Wyższe uczelnie w województwie pomorskim
Wyższe uczelnie w województwie pomorskimWyższe uczelnie w województwie pomorskim
Wyższe uczelnie w województwie pomorskimsiwonas
 
Przydatne adresy
Przydatne adresyPrzydatne adresy
Przydatne adresysiwonas
 
Adresy internetowe ministralne i up
Adresy internetowe ministralne i upAdresy internetowe ministralne i up
Adresy internetowe ministralne i upDksiwy261
 
Przygotowanie do rozmowy kwalifikacyjnej
Przygotowanie do rozmowy kwalifikacyjnejPrzygotowanie do rozmowy kwalifikacyjnej
Przygotowanie do rozmowy kwalifikacyjnejsiwonas
 
Presentacion Proyecto Final
Presentacion Proyecto FinalPresentacion Proyecto Final
Presentacion Proyecto FinalLorelyn Corona
 
A los menores de 18 años se debe pedir autorizacion a los padres para abortar...
A los menores de 18 años se debe pedir autorizacion a los padres para abortar...A los menores de 18 años se debe pedir autorizacion a los padres para abortar...
A los menores de 18 años se debe pedir autorizacion a los padres para abortar...Linda Garnica
 
Presentación Hardware
Presentación HardwarePresentación Hardware
Presentación Hardwarejuanjohetfield
 
SF026 Chapter 2 CAPACITOR AND DIELECTRICS BP6 2014/2015
SF026 Chapter 2 CAPACITOR AND DIELECTRICS BP6 2014/2015SF026 Chapter 2 CAPACITOR AND DIELECTRICS BP6 2014/2015
SF026 Chapter 2 CAPACITOR AND DIELECTRICS BP6 2014/2015Yusri Yusop
 
Natura Especial Natal 2012
 Natura Especial Natal 2012 Natura Especial Natal 2012
Natura Especial Natal 2012Natalia Dias
 
Market Entry Strategy - Southern India
Market Entry Strategy  - Southern IndiaMarket Entry Strategy  - Southern India
Market Entry Strategy - Southern IndiaJames Dellinger
 
An Invitation to Change the Verb
An Invitation to Change the VerbAn Invitation to Change the Verb
An Invitation to Change the Verbjenniferplucker
 
Rodzaje umów o pracę
Rodzaje umów o pracęRodzaje umów o pracę
Rodzaje umów o pracęsiwonas
 
SF026 Chapter 3: Electric Current and Direct Current BP6 2014/2015 (3.6-3.9)
SF026 Chapter 3: Electric Current and Direct Current BP6 2014/2015 (3.6-3.9)SF026 Chapter 3: Electric Current and Direct Current BP6 2014/2015 (3.6-3.9)
SF026 Chapter 3: Electric Current and Direct Current BP6 2014/2015 (3.6-3.9)Yusri Yusop
 

En vedette (20)

Wyższe uczelnie w województwie pomorskim
Wyższe uczelnie w województwie pomorskimWyższe uczelnie w województwie pomorskim
Wyższe uczelnie w województwie pomorskim
 
Przydatne adresy
Przydatne adresyPrzydatne adresy
Przydatne adresy
 
Adresy internetowe ministralne i up
Adresy internetowe ministralne i upAdresy internetowe ministralne i up
Adresy internetowe ministralne i up
 
Pesquisa de campo!
Pesquisa de campo!Pesquisa de campo!
Pesquisa de campo!
 
Przygotowanie do rozmowy kwalifikacyjnej
Przygotowanie do rozmowy kwalifikacyjnejPrzygotowanie do rozmowy kwalifikacyjnej
Przygotowanie do rozmowy kwalifikacyjnej
 
Presentacion Proyecto Final
Presentacion Proyecto FinalPresentacion Proyecto Final
Presentacion Proyecto Final
 
Salto largo
Salto largoSalto largo
Salto largo
 
Dia dos pais 2012
Dia dos pais 2012Dia dos pais 2012
Dia dos pais 2012
 
Trabajo
TrabajoTrabajo
Trabajo
 
A los menores de 18 años se debe pedir autorizacion a los padres para abortar...
A los menores de 18 años se debe pedir autorizacion a los padres para abortar...A los menores de 18 años se debe pedir autorizacion a los padres para abortar...
A los menores de 18 años se debe pedir autorizacion a los padres para abortar...
 
Presentación Hardware
Presentación HardwarePresentación Hardware
Presentación Hardware
 
Separata pnp 2014
Separata pnp 2014Separata pnp 2014
Separata pnp 2014
 
SF026 Chapter 2 CAPACITOR AND DIELECTRICS BP6 2014/2015
SF026 Chapter 2 CAPACITOR AND DIELECTRICS BP6 2014/2015SF026 Chapter 2 CAPACITOR AND DIELECTRICS BP6 2014/2015
SF026 Chapter 2 CAPACITOR AND DIELECTRICS BP6 2014/2015
 
Practica 3
Practica 3Practica 3
Practica 3
 
Natura Especial Natal 2012
 Natura Especial Natal 2012 Natura Especial Natal 2012
Natura Especial Natal 2012
 
Market Entry Strategy - Southern India
Market Entry Strategy  - Southern IndiaMarket Entry Strategy  - Southern India
Market Entry Strategy - Southern India
 
An Invitation to Change the Verb
An Invitation to Change the VerbAn Invitation to Change the Verb
An Invitation to Change the Verb
 
Rodzaje umów o pracę
Rodzaje umów o pracęRodzaje umów o pracę
Rodzaje umów o pracę
 
Visit Galveston
Visit GalvestonVisit Galveston
Visit Galveston
 
SF026 Chapter 3: Electric Current and Direct Current BP6 2014/2015 (3.6-3.9)
SF026 Chapter 3: Electric Current and Direct Current BP6 2014/2015 (3.6-3.9)SF026 Chapter 3: Electric Current and Direct Current BP6 2014/2015 (3.6-3.9)
SF026 Chapter 3: Electric Current and Direct Current BP6 2014/2015 (3.6-3.9)
 

Similaire à Jason parsing

Client server part 12
Client server part 12Client server part 12
Client server part 12fadlihulopi
 
Stop Making Excuses and Start Testing Your JavaScript
Stop Making Excuses and Start Testing Your JavaScriptStop Making Excuses and Start Testing Your JavaScript
Stop Making Excuses and Start Testing Your JavaScriptRyan Anklam
 
Beautiful java script
Beautiful java scriptBeautiful java script
Beautiful java scriptÜrgo Ringo
 
Test-driven Development with AEM
Test-driven Development with AEMTest-driven Development with AEM
Test-driven Development with AEMJan Wloka
 
Tips and Tricks of Developing .NET Application
Tips and Tricks of Developing .NET ApplicationTips and Tricks of Developing .NET Application
Tips and Tricks of Developing .NET ApplicationJoni
 
Note Use Java Write a web server that is capable of processing only.pdf
Note Use Java Write a web server that is capable of processing only.pdfNote Use Java Write a web server that is capable of processing only.pdf
Note Use Java Write a web server that is capable of processing only.pdffatoryoutlets
 
JJUG CCC 2011 Spring
JJUG CCC 2011 SpringJJUG CCC 2011 Spring
JJUG CCC 2011 SpringKiyotaka Oku
 
13 networking, mobile services, and authentication
13   networking, mobile services, and authentication13   networking, mobile services, and authentication
13 networking, mobile services, and authenticationWindowsPhoneRocks
 
比XML更好用的Java Annotation
比XML更好用的Java Annotation比XML更好用的Java Annotation
比XML更好用的Java Annotationjavatwo2011
 
Web CrawlersrcedusmulylecrawlerController.javaWeb Crawler.docx
Web CrawlersrcedusmulylecrawlerController.javaWeb Crawler.docxWeb CrawlersrcedusmulylecrawlerController.javaWeb Crawler.docx
Web CrawlersrcedusmulylecrawlerController.javaWeb Crawler.docxcelenarouzie
 
CouchDB on Android
CouchDB on AndroidCouchDB on Android
CouchDB on AndroidSven Haiges
 
Protocol-Oriented Networking
Protocol-Oriented NetworkingProtocol-Oriented Networking
Protocol-Oriented NetworkingMostafa Amer
 
Creating a Facebook Clone - Part XXVII - Transcript.pdf
Creating a Facebook Clone - Part XXVII - Transcript.pdfCreating a Facebook Clone - Part XXVII - Transcript.pdf
Creating a Facebook Clone - Part XXVII - Transcript.pdfShaiAlmog1
 
code for quiz in my sql
code for quiz  in my sql code for quiz  in my sql
code for quiz in my sql JOYITAKUNDU1
 
How to make Ajax work for you
How to make Ajax work for youHow to make Ajax work for you
How to make Ajax work for youSimon Willison
 

Similaire à Jason parsing (20)

Client server part 12
Client server part 12Client server part 12
Client server part 12
 
Ajax - a quick introduction
Ajax - a quick introductionAjax - a quick introduction
Ajax - a quick introduction
 
Stop Making Excuses and Start Testing Your JavaScript
Stop Making Excuses and Start Testing Your JavaScriptStop Making Excuses and Start Testing Your JavaScript
Stop Making Excuses and Start Testing Your JavaScript
 
Beautiful java script
Beautiful java scriptBeautiful java script
Beautiful java script
 
Test-driven Development with AEM
Test-driven Development with AEMTest-driven Development with AEM
Test-driven Development with AEM
 
Tips and Tricks of Developing .NET Application
Tips and Tricks of Developing .NET ApplicationTips and Tricks of Developing .NET Application
Tips and Tricks of Developing .NET Application
 
Note Use Java Write a web server that is capable of processing only.pdf
Note Use Java Write a web server that is capable of processing only.pdfNote Use Java Write a web server that is capable of processing only.pdf
Note Use Java Write a web server that is capable of processing only.pdf
 
JJUG CCC 2011 Spring
JJUG CCC 2011 SpringJJUG CCC 2011 Spring
JJUG CCC 2011 Spring
 
13 networking, mobile services, and authentication
13   networking, mobile services, and authentication13   networking, mobile services, and authentication
13 networking, mobile services, and authentication
 
比XML更好用的Java Annotation
比XML更好用的Java Annotation比XML更好用的Java Annotation
比XML更好用的Java Annotation
 
Php sql-android
Php sql-androidPhp sql-android
Php sql-android
 
servlets
servletsservlets
servlets
 
Web CrawlersrcedusmulylecrawlerController.javaWeb Crawler.docx
Web CrawlersrcedusmulylecrawlerController.javaWeb Crawler.docxWeb CrawlersrcedusmulylecrawlerController.javaWeb Crawler.docx
Web CrawlersrcedusmulylecrawlerController.javaWeb Crawler.docx
 
CouchDB on Android
CouchDB on AndroidCouchDB on Android
CouchDB on Android
 
Protocol-Oriented Networking
Protocol-Oriented NetworkingProtocol-Oriented Networking
Protocol-Oriented Networking
 
Android dev 3
Android dev 3Android dev 3
Android dev 3
 
Server1
Server1Server1
Server1
 
Creating a Facebook Clone - Part XXVII - Transcript.pdf
Creating a Facebook Clone - Part XXVII - Transcript.pdfCreating a Facebook Clone - Part XXVII - Transcript.pdf
Creating a Facebook Clone - Part XXVII - Transcript.pdf
 
code for quiz in my sql
code for quiz  in my sql code for quiz  in my sql
code for quiz in my sql
 
How to make Ajax work for you
How to make Ajax work for youHow to make Ajax work for you
How to make Ajax work for you
 

Plus de parallelminder

Restoring SharePoint Frontend server
Restoring SharePoint Frontend serverRestoring SharePoint Frontend server
Restoring SharePoint Frontend serverparallelminder
 
Windows azure development setup
Windows azure development setupWindows azure development setup
Windows azure development setupparallelminder
 
Project Server 2010 and Sharepoint 2010 integration with BI
Project Server 2010 and Sharepoint 2010 integration with BIProject Server 2010 and Sharepoint 2010 integration with BI
Project Server 2010 and Sharepoint 2010 integration with BIparallelminder
 
Digital asset management sharepoint 2010
Digital asset management sharepoint 2010Digital asset management sharepoint 2010
Digital asset management sharepoint 2010parallelminder
 
Share point 2010 enterprise single server farm installation
Share point 2010 enterprise single server farm installationShare point 2010 enterprise single server farm installation
Share point 2010 enterprise single server farm installationparallelminder
 
Share point 2010 enterprise single server farm installation
Share point 2010 enterprise single server farm installationShare point 2010 enterprise single server farm installation
Share point 2010 enterprise single server farm installationparallelminder
 
SharePoint2010 single server farm installation
SharePoint2010 single server farm installationSharePoint2010 single server farm installation
SharePoint2010 single server farm installationparallelminder
 
Sharepoint 2010 Object model topology
Sharepoint 2010 Object model topologySharepoint 2010 Object model topology
Sharepoint 2010 Object model topologyparallelminder
 
How to install / configure / setup language pack in SharePoint 2010
How to install / configure / setup language pack in SharePoint 2010How to install / configure / setup language pack in SharePoint 2010
How to install / configure / setup language pack in SharePoint 2010parallelminder
 
Formbased authentication in asp.net
Formbased authentication in asp.netFormbased authentication in asp.net
Formbased authentication in asp.netparallelminder
 
Master Pages In Asp.net
Master Pages In Asp.netMaster Pages In Asp.net
Master Pages In Asp.netparallelminder
 
Nevigation control in asp.net
Nevigation control in asp.netNevigation control in asp.net
Nevigation control in asp.netparallelminder
 
Parallel minds silverlight
Parallel minds silverlightParallel minds silverlight
Parallel minds silverlightparallelminder
 
Parallelminds.web partdemo1
Parallelminds.web partdemo1Parallelminds.web partdemo1
Parallelminds.web partdemo1parallelminder
 
Parallelminds.asp.net web service
Parallelminds.asp.net web serviceParallelminds.asp.net web service
Parallelminds.asp.net web serviceparallelminder
 
Parallelminds.asp.net with sp
Parallelminds.asp.net with spParallelminds.asp.net with sp
Parallelminds.asp.net with spparallelminder
 

Plus de parallelminder (16)

Restoring SharePoint Frontend server
Restoring SharePoint Frontend serverRestoring SharePoint Frontend server
Restoring SharePoint Frontend server
 
Windows azure development setup
Windows azure development setupWindows azure development setup
Windows azure development setup
 
Project Server 2010 and Sharepoint 2010 integration with BI
Project Server 2010 and Sharepoint 2010 integration with BIProject Server 2010 and Sharepoint 2010 integration with BI
Project Server 2010 and Sharepoint 2010 integration with BI
 
Digital asset management sharepoint 2010
Digital asset management sharepoint 2010Digital asset management sharepoint 2010
Digital asset management sharepoint 2010
 
Share point 2010 enterprise single server farm installation
Share point 2010 enterprise single server farm installationShare point 2010 enterprise single server farm installation
Share point 2010 enterprise single server farm installation
 
Share point 2010 enterprise single server farm installation
Share point 2010 enterprise single server farm installationShare point 2010 enterprise single server farm installation
Share point 2010 enterprise single server farm installation
 
SharePoint2010 single server farm installation
SharePoint2010 single server farm installationSharePoint2010 single server farm installation
SharePoint2010 single server farm installation
 
Sharepoint 2010 Object model topology
Sharepoint 2010 Object model topologySharepoint 2010 Object model topology
Sharepoint 2010 Object model topology
 
How to install / configure / setup language pack in SharePoint 2010
How to install / configure / setup language pack in SharePoint 2010How to install / configure / setup language pack in SharePoint 2010
How to install / configure / setup language pack in SharePoint 2010
 
Formbased authentication in asp.net
Formbased authentication in asp.netFormbased authentication in asp.net
Formbased authentication in asp.net
 
Master Pages In Asp.net
Master Pages In Asp.netMaster Pages In Asp.net
Master Pages In Asp.net
 
Nevigation control in asp.net
Nevigation control in asp.netNevigation control in asp.net
Nevigation control in asp.net
 
Parallel minds silverlight
Parallel minds silverlightParallel minds silverlight
Parallel minds silverlight
 
Parallelminds.web partdemo1
Parallelminds.web partdemo1Parallelminds.web partdemo1
Parallelminds.web partdemo1
 
Parallelminds.asp.net web service
Parallelminds.asp.net web serviceParallelminds.asp.net web service
Parallelminds.asp.net web service
 
Parallelminds.asp.net with sp
Parallelminds.asp.net with spParallelminds.asp.net with sp
Parallelminds.asp.net with sp
 

Dernier

ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfOverkill Security
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusZilliz
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024The Digital Insurer
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 

Dernier (20)

ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 

Jason parsing

  • 1. Create New Android Project in Eclipse. 1. Name of Project: - TestJSONWebService 2. Build Target: - Android (2.2) 3. Application Name: - TestWebService 4. Package Name: - parallelminds.webservice.com 5. Create Activity: - TestWebServiceActivity Now our First Activity is TestWebServiceActivity which as followes.This class is used to make a call JSON web service. using callWebService() method. package parallelminds.testservice.com; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.net.URI; import java.net.URISyntaxException; import java.util.ArrayList; import org.apache.http.HttpResponse; import org.apache.http.client.ClientProtocolException; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.DefaultHttpClient; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import android.app.ListActivity; import android.content.Intent; import android.os.Bundle; import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.view.MenuItem.OnMenuItemClickListener; import android.view.View; import android.widget.ArrayAdapter; import android.widget.LinearLayout; import android.widget.ListView; import android.widget.TextView; import android.widget.Toast; public class TestServiceActivity extends ListActivity { LinearLayout objLinearLayout; TextView tv;
  • 2. int receivedJArrayLength; private static String url = "http://202.71.142.203:8871/Service.svc/GetProjects"; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); this.setListAdapter(new ArrayAdapter <String> (this,android.R.layout.simple_list_item_1,this.ParsedJson())); } // Method returning array list of JSON web-service private ArrayList<String> ParsedJson() { ArrayList<String> listItems = new ArrayList<String>(); CallWebService objCallWebService = new CallWebService(); JSONArray receivedJArray = objCallWebService.callWebService(url); receivedJArrayLength = receivedJArray.length(); TextView showmsg = new TextView(this); showmsg.setText(msg); objLinearLayout.addView(showmsg);*/ if (receivedJArray != null) for (int i = 0; i < receivedJArrayLength; i++) { try { String displayString = ""; JSONObject jObj = receivedJArray.getJSONObject(i); displayString += "------------n"; displayString += "Id :" + jObj.getString("Id") + "n"; displayString += "Name :" + jObj.getString("Name") + "n"; displayString += "KickOffNotes:"+jObj.getString("KickOffNotes") + "n"; displayString += "Description :"+ jObj.getString("Description") + "n"; displayString += "MemberCount :" + jObj.getString("MemberCount") + "n"; displayString += "StartDate :"+ jObj.getString("StartDate") + "n"; displayString += "DeliveryDate :"+ jObj.getString("DeliveryDate") + "n"; displayString += "Status :" + jObj.getString("Status")+ "nn"; displayString += "n********";
  • 3. listItems.add(displayString); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } } return listItems; } } This is our second class CallWebService package parallelminds.testservice.com; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.net.URI; import java.net.URISyntaxException; import org.apache.http.HttpResponse; import org.apache.http.client.ClientProtocolException; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.DefaultHttpClient; import org.json.JSONArray; import org.json.JSONException; import android.util.Log; public class CallWebService { // This method is used to get JSONArray Object JSONArray callWebService(String serviceURL) { JSONArray jArray = null; // http get client HttpClient client = new DefaultHttpClient(); HttpGet getRequest = new HttpGet(); try { // get the requested URI getRequest.setURI(new URI(serviceURL)); } catch (URISyntaxException e) { Log.e("URISyntaxException", e.toString()); } // read the response in the buffer
  • 4. BufferedReader in = null; // the service response HttpResponse response = null; try { // call the requested url response = client.execute(getRequest); } catch (ClientProtocolException e) { Log.e("ClientProtocolException", e.toString()); } catch (IOException e) { Log.e("IO exception", e.toString()); } try { in = new BufferedReader(new InputStreamReader(response.getEntity() .getContent())); } catch (IllegalStateException e) { Log.e("IllegalStateException", e.toString()); } catch (IOException e) { Log.e("IO exception", e.toString()); } StringBuffer buff = new StringBuffer(""); String line = ""; try { while ((line = in.readLine()) != null) { buff.append(line); } } catch (IOException e) { Log.e("IO exception", e.toString()); } try { in.close(); } catch (IOException e) { Log.e("IO exception", e.toString()); } // now we need to parse the response String result = buff.toString(); try { jArray = new JSONArray(result); } catch (JSONException e) { Log.e("log_tag", "Error parsing data " + e.toString()); } return jArray; }
  • 5. } Now our main.xml is as follows. <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:id="@+id/MainLayoutPMTS"> <ListView android:id="@id/android:list" android:layout_height="match_parent" android:layout_width="match_parent" ></ListView> <TextView android:id="@+id/webXml" android:layout_width="fill_parent" android:layout_height="fill_parent"> </TextView> </LinearLayout>