Ⅰ android開發如何點擊一個文本框跳轉到網頁
在文本框獲取焦點時,觸發下面的代碼即可:
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("www.sohu.com"));
startActivity(intent);
Ⅱ android如何與webservice傳輸文件
不肯能只有1mb把,我和你的做法一樣的,4mb的文件也沒有問題
Ⅲ Android web service教程
本帖最後由 悲觀主義者一枚 於 2015-1-31 17:55 編輯
使用SpringMvc開發Android WebService入門教程
1.首先大家先創建一個JavaWeb項目
2.然後加入SpringMVC所依賴的jar包文件到WebRootWEB-INFlib 文件夾下,jar包含文件如下圖
3.我們在WebRootWEB-INF 目錄下創建一個spring-servlet.xml文件,粘入如下代碼
XML代碼
http://cloudbbs.org/forum.php?mod=viewthread&tid=31880
Ⅳ 求助Android如何實現按鈕button跳轉到webview
給按鈕添加一個監聽,通過Intent實現跳轉就好了
Ⅳ android端怎麼調用webservice介面
在Android平台調用Web Service需要依賴於第三方類庫ksoap2,它是一個SOAP Web service客戶端開發包,主要用於資源受限制的Java環境如Applets或J2ME應用程序(CLDC/ CDC/MIDP)。認真讀完對ksoap2的介紹你會發現並沒有提及它應用於Android平台開發,沒錯,在Android平台中我們並不會直接使用ksoap2,而是使用ksoap2 android。KSoap2 Android 是Android平台上一個高效、輕量級的SOAP開發包,等同於Android平台上的KSoap2的移植版本。
Ksoap2-android jar包下載
Ⅵ Android WebRTC完整入門教程02: 本地回環
上一篇: Android WebRTC完整入門教程01: 使用相機
在上一篇中完成了WebRTC最基本的使用--相機的使用. 這一篇將介紹WebRTC中最核心的概念PeerConnection , 給同一手機中的前後攝像頭建立虛擬的連接, 相互傳輸畫面.
PeerConnection也就是Peer-to-Peer connection(P2P), 就是兩個"人"的連接. 雙方分別創建PeerConnection對象, 然後向對方發送自己的網路狀況ICE和多媒體編碼格式SDP(因為這時候連接還沒建立, 所以發送內容是通過伺服器完成的). 當雙方網路和編碼格式協商好後, 連接就建立好了, 這時從PeerConnection中能獲取到對方的MediaStream數據流, 也就能播放對方的音視頻了.
Interactive Connectivity Establishment, 互動式連接建立. 其實是一個整合STUN和TURN的框架, 給它提供STUN和TURN伺服器地址, 它會自動選擇優先順序高的進行NAT穿透.
Session Description Protocol: 會話描述協議. 發送方的叫Offer, 接受方的叫Answer, 除了名字外沒有區別. 就是一些文本描述本地的音視頻編碼和網路地址等.
Ⅶ Android開發中,怎麼把按鈕鏈接到web,比如鏈接到百度等,在線等,急急急!!!
package com.;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
public class Bai extends Activity {
private Button Bai = null;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Bai = (Button)findViewById(R.id.);
Bai.setOnClickListener(new MyButtonListener());
}
class MyButtonListener implements OnClickListener{
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Uri uri = Uri.parse("http://www..com");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
}
}
}
<?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"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello"
/>
<Button
android:id="@+id/"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Bai"
/>
</LinearLayout>
Ⅷ android怎麼調用webservice
WebService是一種基於SOAP協議的遠程調用標准,通過webservice可以將不同操作系統平台、不同語言、不同技術整合到一塊。在Android SDK中並沒有提供調用WebService的庫,因此,需要使用第三方的SDK來調用WebService。PC版本的WEbservice客戶端庫非常豐富,例如Axis2,CXF等,但這些開發包對於Android系統過於龐大,也未必很容易移植到Android系統中。因此,這些開發包並不是在我們的考慮范圍內。適合手機的WebService客戶端的SDK有一些,比較常用的有Ksoap2,可以從http://code.google.com/p/ksoap2-android/downloads/list進行下載;將下載的ksoap2-android-assembly-2.4-jar-with-dependencies.jar包復制到Eclipse工程的lib目錄中,當然也可以放在其他的目錄里。同時在Eclipse工程中引用這個jar包。
具體調用調用webservice的方法為:
(1) 指定webservice的命名空間和調用的方法名,如:
SoapObject request =new SoapObject(http://service,」getName」);
SoapObject類的第一個參數表示WebService的命名空間,可以從WSDL文檔中找到WebService的命名空間。第二個參數表示要調用的WebService方法名。
(2) 設置調用方法的參數值,如果沒有參數,可以省略,設置方法的參數值的代碼如下:
Request.addProperty(「param1」,」value」);
Request.addProperty(「param2」,」value」);
要注意的是,addProperty方法的第1個參數雖然表示調用方法的參數名,但該參數值並不一定與服務端的WebService類中的方法參數名一致,只要設置參數的順序一致即可。
(3) 生成調用Webservice方法的SOAP請求信息。該信息由SoapSerializationEnvelope對象描述,代碼為:
SoapSerializationEnvelope envelope=new
SoapSerializationEnvelope(SoapEnvelope.VER11);
Envelope.bodyOut = request;
創建SoapSerializationEnvelope對象時需要通過SoapSerializationEnvelope類的構造方法設置SOAP協議的版本號。該版本號需要根據服務端WebService的版本號設置。在創建SoapSerializationEnvelope對象後,不要忘了設置SOAPSoapSerializationEnvelope類的bodyOut屬性,該屬性的值就是在第一步創建的SoapObject對象。
(4) 創建HttpTransportsSE對象。通過HttpTransportsSE類的構造方法可以指定WebService的WSDL文檔的URL:
HttpTransportSE ht=new HttpTransportSE(「http://192.168.18.17:80
/axis2/service/SearchNewsService?wsdl」);
(5)使用call方法調用WebService方法,代碼:
ht.call(null,envelope);
Call方法的第一個參數一般為null,第2個參數就是在第3步創建的SoapSerializationEnvelope對象。
(6)使用getResponse方法獲得WebService方法的返回結果,代碼:
SoapObject soapObject =( SoapObject) envelope.getResponse();
以下為簡單的實現一個天氣查看功能的例子:
publicclass WebService extends Activity {
privatestaticfinal String NAMESPACE ="http://WebXml.com.cn/";
// WebService地址
privatestatic String URL ="http://www.webxml.com.cn/
webservices/weatherwebservice.asmx";
privatestaticfinal String METHOD_NAME ="getWeatherbyCityName";
privatestatic String SOAP_ACTION ="http://WebXml.com.cn/
getWeatherbyCityName";
private String weatherToday;
private Button okButton;
private SoapObject detail;
@Override
publicvoid onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
okButton = (Button) findViewById(R.id.ok);
okButton.setOnClickListener(new Button.OnClickListener() {
publicvoid onClick(View v) {
showWeather();
}
});
}
privatevoid showWeather() {
String city ="武漢";
getWeather(city);
}
@SuppressWarnings("deprecation")
publicvoid getWeather(String cityName) {
try {
System.out.println("rpc------");
SoapObject rpc =new SoapObject(NAMESPACE, METHOD_NAME);
System.out.println("rpc"+ rpc);
System.out.println("cityName is "+ cityName);
rpc.addProperty("theCityName", cityName);
AndroidHttpTransport ht =new AndroidHttpTransport(URL);
ht.debug =true;
SoapSerializationEnvelope envelope =new SoapSerializationEnvelope(
SoapEnvelope.VER11);
envelope.bodyOut = rpc;
envelope.dotNet =true;
envelope.setOutputSoapObject(rpc);
ht.call(SOAP_ACTION, envelope);
SoapObject result = (SoapObject) envelope.bodyIn;
detail = (SoapObject) result
.getProperty("getWeatherbyCityNameResult");
System.out.println("result"+ result);
System.out.println("detail"+ detail);
Toast.makeText(WebService.this, detail.toString(),
Toast.LENGTH_LONG).show();
parseWeather(detail);
return;
} catch (Exception e) {
e.printStackTrace();
}
}
privatevoid parseWeather(SoapObject detail)
throws UnsupportedEncodingException {
String date = detail.getProperty(6).toString();
weatherToday ="今天:"+ date.split("")[0];
weatherToday = weatherToday +"\n天氣:"+ date.split("")[1];
weatherToday = weatherToday +"\n氣溫:"
+ detail.getProperty(5).toString();
weatherToday = weatherToday +"\n風力:"
+ detail.getProperty(7).toString() +"\n";
System.out.println("weatherToday is "+ weatherToday);
Toast.makeText(WebService.this, weatherToday,
Toast.LENGTH_LONG).show();
}
}