¾ÛÅøÁî
46.¢½.168.138
46.¢½.168.129
46.¢½.168.161
46.¢½.168.136
46.¢½.168.145
46.¢½.168.162
46.¢½.168.144
46.¢½.168.140
115.¢½.135.198
46.¢½.168.139
 
°Ô½Ã¹° 88°Ç
   
¿øº»ÀÌ ¼öÁ¤ÀÌ ¾ÈµÇ´Â°ü°è·Î...(±¸±Û Ķ¸°´õ ¸®½ºÆ®JSON±Ü¾î¿À±â+ µî·Ï)
±Û¾´ÀÌ : ±èº´ÁÖ                   ³¯Â¥ : 2011-12-03 (Åä) 04:21 Á¶È¸ : 6700
1. ¿ì¼± Á¶»çÇغ»°á°ú ÀÌÀü¿¡ ¾Ë·Áµå¸°¹æ¹ýÀº. GDATA´Â ¾²±â,»èÁ¦ µîÀÇ À̺¥Æ®¸¸ »ç¿ë°¡´ÉÇϽʴϴÙ.
 
2. GDATA·Î´Â ¸®½ºÆ®¸¦ ½ºÄµºÒ°¡´ÉÇÕ´Ï´Ù. ¶ÇÇÑ ¾²±â »èÁ¦ µîÀÌ °¡´ÉÇÏ´Ù°í Çصµ ResponeÀ̳ª RequestÄڵ带 ¹ÞÀ» ¼ö ¾ø½À´Ï´Ù. (ÆÄ½Ì ¿ö´× ³ª¿É´Ï´Ù.)
 
3. µû¶ó¼­ À§ÀÇ ¸®½ºÆ® ½ºÄµ¹æ¹ý°ú + ¾Æ·¡ÀÇ GDATA ±Û µî·Ï¹æ½ÄÀ» ÇÕÄ£¹æ¹ýÀ» ³Ö¾îµ×½À´Ï´Ù.
 
À§ÀÇ ¼Ò½º¿Í ³»¿ëÀÌ ÀüüÀûÀ¸·Î ºñ½ÁÇϹǷÎ, µû·Î ÁÖ¼®À» ´ÞÁø ¾Ê°Ù½À´Ï´Ù.
<¼Ò½º>
package com.corea.Gdata;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Date;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParserFactory;
import org.json.JSONArray;
import org.json.JSONException;
import org.xml.sax.SAXNotRecognizedException;
import org.xml.sax.SAXNotSupportedException;
import org.xmlpull.v1.XmlPullParserException;
import org.xmlpull.v1.XmlPullParserFactory;
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.widget.TextView;
import android.widget.Toast;
import com.google.gdata.client.calendar.CalendarService;
import com.google.gdata.data.DateTime;
import com.google.gdata.data.Person;
import com.google.gdata.data.PlainTextConstruct;
import com.google.gdata.data.calendar.CalendarEventEntry;
import com.google.gdata.data.calendar.CalendarEventFeed;
import com.google.gdata.data.extensions.When;
import com.google.gdata.data.extensions.Where;
import com.google.gdata.util.AuthenticationException;
import com.google.gdata.util.ContentType;
import com.google.gdata.util.ServiceException;
public class Google_Gdata_Test extends Activity {
    /** Called when the activity is first created. */
 static String USER_ID;
 static String USER_Pass;
 static String APP_NAME;
 TextView text;
 static ArrayList<String> items;
 static ArrayList<String> items2;
 static ArrayList<String> items3;
 JSONArray arr;
 String ar;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
 
 
        USER_ID = "Áö¸ÞÀÏ °èÁ¤";
        USER_Pass = "ºñ¹Ð¹øÈ£";
        APP_NAME = "¾ÛÀ̸§";
        items = new ArrayList<String>();
        items2 = new ArrayList<String>();
        items3 = new ArrayList<String>();
        text = new TextView(this);
        text = (TextView)findViewById(R.id.text);
     
      authdata();
      if(ar!=null)
      {
       getList();
      
      }
      if(arr.length()!=0)
      {
       for(int i=0; i<arr.length(); i++)
       {
       try {
    text.append("\n"+arr.getString(i)+"\n");
   } catch (JSONException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
   }
       }
      }
      else{}
 
    }
   public void getList()
   {
  try {
     items3=new ArrayList<String>();
     URL url = new URL("http://www.google.com/calendar/feeds/"+USER_ID+"/private/full?alt=json");
     HttpURLConnection con = (HttpURLConnection)url.openConnection();
     con.setDoOutput(true);
     con.setRequestMethod("GET");
     con.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
     con.setRequestProperty("Authorization", "GoogleLogin auth="+ar);
     InputStream un = con.getInputStream();
     BufferedReader br = new BufferedReader(new InputStreamReader(un));
     String ud;
     arr = new JSONArray();
     while((ud=br.readLine())!=null)
     {
      arr.put(ud);
     }
     br.close();
  }
  catch (MalformedURLException e) {
   // TODO Auto-generated catch block
   e.printStackTrace();
  } catch (IOException e) {
 // TODO Auto-generated catch block
 e.printStackTrace();
}  
   }
   
   public void authdata()
   {
      items = new ArrayList<String>();
      
       URL url;
    try {
     url = new URL("https://www.google.com/accounts/ClientLogin ");
    
       HttpURLConnection con = (HttpURLConnection)url.openConnection();
       con.setDoOutput(true);
       con.setRequestMethod("POST");
       OutputStreamWriter out = new OutputStreamWriter(con.getOutputStream());
       out.write(
         "&Email="+USER_ID
        // +"&postId="+"1"
         //+"&commentId="+"9155368"
         +"&Passwd="+USER_Pass
         +"&source="+APP_NAME
         +"&service="+"cl");
       out.flush();
       InputStream put = con.getInputStream();
       out.close();
       BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
       String decodedString;
       while((decodedString = in.readLine())!=null)
       {
       items.add(decodedString);
       }
       in.close();
       ar = items.get(2).substring(5);
       System.out.println(ar);
    } catch (MalformedURLException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
    } catch (IOException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
    }  
   }

    public void AddEventSce(String Title, String Note, Date Startdate, Date EndDate, String Location)
    {
    Toast.makeText(getBaseContext(), "login..", Toast.LENGTH_SHORT).show();
    try {
  URL feedUrl = new URL("https://www.google.com/calendar/feeds/default/private/full?alt=json");
  
  CalendarEventEntry myEntry = new CalendarEventEntry();
  
  myEntry.setTitle(new PlainTextConstruct("Test_App","utf-8"));
  myEntry.setContent(new PlainTextConstruct("¾È³çÇϼ¼¿ä","utf-8"));
  Person author = new Person("Test_app",null,USER_ID);
  myEntry.getAuthors().add(author);
  DateTime startTime = new DateTime(new Date(2011-1900,12-1,3,12,0));
  startTime.setTzShift(9);
  DateTime endTime = new DateTime(new Date(2011-1900,12-1,3,13,0));
  endTime.setTzShift(9);
  When eventTimes = new When();
  eventTimes.setStartTime(startTime);
  eventTimes.setEndTime(endTime);
  myEntry.addTime(eventTimes);
  Where evLocaiton = new Where();
  evLocaiton.setValueString("¼­¿ï");
  myEntry.addLocation(evLocaiton); 
  CalendarService myService = new CalendarService("Test_App");
  myService.setUserCredentials(USER_ID,USER_Pass);
  ContentType ct = new ContentType();
//  ct.setType("application/json;charset=utf-8");
//  myService.setContentType(ct);
  myService.insert(feedUrl, myEntry);

 } catch (AuthenticationException e) {
  // TODO Auto-generated catch block
  e.printStackTrace();
 } catch (MalformedURLException e) {
  // TODO Auto-generated catch block
  e.printStackTrace();
 } catch (IOException e) {
  // TODO Auto-generated catch block
  e.printStackTrace();
 } catch (ServiceException e) {
  // TODO Auto-generated catch block
  e.printStackTrace();
 }
     
     
    }
}
 
* ±ÛÀ» µî·ÏÇϽǶ§ ²À ÇÊ¿äÇÑ °æ¿ì°¡ ¾Æ´Ï¸é °³ÀÎÁ¤º¸¸¦ ³²±âÁö ¸¶¼¼¿ä ^^ (¿¬¶ôó,À̸ÞÀÏÁÖ¼Ò,Áֹεî·Ï¹øÈ£ µî)




±èº´ÁÖ ´ÔÀÇ Tip&Tech ÃÖ½Å±Û [´õº¸±â]


   

°Ô½Ã¹° 88°Ç
¹øÈ£ Á¦¸ñ ±Û¾´ÀÌ ³¯Â¥ Á¶È¸
68     °£¸¸¿¡ ±Û¾²³×¿ä À̹ø¿£ launcherShortCut (¹Ù·Î°¡±â ¾ÆÀÌÄÜ)ÀÔ´Ï´Ù. Á¤¿ìÁø 07-24 4879
67  ¸ð¹ÙÀÏ ±¤°í¸¦ ÅëÇؼ­ ¾Û È«º¸ ÀÌ°æ¿ë 06-28 5700
66  Citirne Framework·Î °³¹ßÇÑ ¼îÇθô ¾Û ¼Ò½º °ø°³ÇÕ´Ï´Ù.(Android, iOS) +1 ¾¾Æ®¸°°³¹ß¡¦ 06-13 6254
65  À̹ø¿¡ °³¹ßÇÑ ¼îÇθô¾Û Àüü ¼Ò½ºÀÔ´Ï´Ù. +7 ¾¾Æ®¸°°³¹ß¡¦ 04-26 7180
64     À̹ø¿¡ °³¹ßÇÑ ¼îÇθô¾Û Àüü ¼Ò½ºÀÔ´Ï´Ù. ±è°æö 04-26 4764
63  Bitmap ÆÄÀÏ È¸Àü½ÃÅ°±â ±èÀºÈ£ 04-24 6242
62  BItmap size Resizing ½ÃÄÑÁֱ⠱èÀºÈ£ 04-24 5208
61  Image ÆÄÀÏÀÌ ÀúÀåµÇ´Â ¸®¾ó°æ·Î ¾Ë·ÁÁÖ±â. ±èÀºÈ£ 04-24 5478
60  Bitmap¿¡ Resource ³Ö±â ±èÀºÈ£ 04-24 4845
59  ÆùÀÇ Çϵå¿þ¾î Á¦¾î°ü·Ã ȤÀº Çϵå¿þ¾îÁ¢±Ù°ü·Ã ¾Û Á¦ÀÛ½Ã. ±èº´ÁÖ 02-29 5078
58  ÀÌŬ¸³½º ´ÜÃàÅ° +4 ÇÑÁ¾±Ô 03-29 3725
57  Layout Multiple Touch °£´Ü ±¸Çö. +1 ±èº´ÁÖ 01-20 4879
56  ¾Èµå·ÎÀ̵å Çػ󵵺° ÁÂÇ¥+ À̹ÌÁö Å©±â ¼öÁ¤Çϱâ(º¯Á¾µð½ºÇ÷¹ÀÌ´Â Àû¿ëx) ±èº´ÁÖ 01-18 13161
55  ³¯¾¾¾Û Á¦ÀÛÇϽô ºÐµé Âü°í¿ë. +1 ±èº´ÁÖ 01-06 8499
54  °¶·°½ÃS ¸¶ÄÏ ¿ë·® Á¦ÇÑ 30MB +6 ÀÌ°æ¿ë 12-14 6655
53  ±¸±Û Ä̸°´õ ¿¬µ¿Çϱâ. +6 ±èº´ÁÖ 11-30 7152
52     ±¸±Û Ä̸°´õ ¿¬µ¿Çϱâ + ±Û¾²±â. ±èº´ÁÖ 12-01 5668
51        ¿øº»ÀÌ ¼öÁ¤ÀÌ ¾ÈµÇ´Â°ü°è·Î...(±¸±Û Ķ¸°´õ ¸®½ºÆ®JSON±Ü¾î¿À±â+ µî·Ï) ±èº´ÁÖ 12-03 6701
50  °£´ÜÇÑ À§Á¬ ¸¸µé±â. +1 ±èº´ÁÖ 11-21 8028
49  ¾Æ·¡¿¡ À̾ Ƽ½ºÅ丮 ´ñ±Û ¼öÁ¤Çϱâ.(POSTÆí) +1 ±èº´ÁÖ 11-09 5013
 1  2  3  4  5  
 
 
 
Copyright ¨Ï wwwold.androidstudy.co.kr. All rights reserved.