This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* This is a POST request example | |
| * use it for sending request with parameters and getting response frome server | |
| */ | |
| // Sending POST request to server and getting response as a String | |
| String responseFromServer = startUrlConnection("http://www.some_website.domain", | |
| "parameter1="+parameter_variable1+"¶meter2="+parameter_variable2); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Отрывок кода. ДОМ парсер | |
| //Проблема такова: ДОМ читает все тэги кроме text... Интересно, в чем же проблема? | |
| DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); | |
| DocumentBuilder db = dbf.newDocumentBuilder(); | |
| Document doc = db.parse(XMLFile); | |
| NodeList nList = doc.getElementsByTagName("param"); //это парент нод | |
| Node nNode = nList.item(1); | |
| Element eElement = (Element) nNode; | |
| System.out.println("Value : " + getTagValue("text", eElement)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class GetActivity extends Activity { | |
| @Override | |
| public void onCreate(Bundle savedInstanceState) { | |
| super.onCreate(savedInstanceState); | |
| setContentView(R.layout.get_activity_layout); | |
| Intent myIntent= getIntent(); | |
| String parameter = myIntent.getStringExtra("paramKey"); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class AndroidSaxFeedParser extends BaseFeedParser { | |
| public AndroidSaxFeedParser(String feedUrl) { | |
| super(feedUrl); | |
| } | |
| public List<Message> parse() { | |
| RssHandler handler = new RssHandler(); | |
| try { | |
| Xml.parse(this.getInputStream(), Xml.Encoding.UTF_8, handler); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import android.app.Activity; | |
| import android.os.Bundle; | |
| public class MyActivity extends Activity { | |
| /** Called when the activity is first created. */ | |
| @Override | |
| public void onCreate(Bundle savedInstanceState) { | |
| super.onCreate(savedInstanceState); | |
| setContentView(R.layout.main); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.io.IOException; | |
| import java.util.ArrayList; | |
| import java.util.List; | |
| import org.apache.http.HttpResponse; | |
| import org.apache.http.NameValuePair; | |
| import org.apache.http.client.ClientProtocolException; | |
| import org.apache.http.client.HttpClient; | |
| import org.apache.http.client.entity.UrlEncodedFormEntity; | |
| import org.apache.http.client.methods.HttpPost; | |
| import org.apache.http.impl.client.DefaultHttpClient; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.io.BufferedReader; | |
| import java.io.IOException; | |
| import java.io.InputStreamReader; | |
| import java.net.URI; | |
| import org.apache.http.HttpResponse; | |
| import org.apache.http.client.methods.HttpGet; | |
| import org.apache.http.impl.client.DefaultHttpClient; | |
| public class HttpClient { | |
| public void executeHttpGet() throws Exception { | |
| BufferedReader in = null; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.io.IOException; | |
| import org.xmlpull.v1.XmlPullParser; | |
| import org.xmlpull.v1.XmlPullParserException; | |
| import android.app.Activity; | |
| import android.content.res.Resources; | |
| import android.content.res.XmlResourceParser; | |
| import android.os.Bundle; | |
| import android.widget.TextView; |