這個是通過http請求傳遞的,POST傳遞。

成都創(chuàng)新互聯(lián)專注于企業(yè)成都全網(wǎng)營銷、網(wǎng)站重做改版、杭州網(wǎng)站定制設計、自適應品牌網(wǎng)站建設、H5頁面制作、商城系統(tǒng)網(wǎng)站開發(fā)、集團公司官網(wǎng)建設、外貿(mào)網(wǎng)站制作、高端網(wǎng)站制作、響應式網(wǎng)頁設計等建站業(yè)務,價格優(yōu)惠性價比高,為杭州等各大城市提供網(wǎng)站開發(fā)制作服務。
在java中通過調(diào)用http對象,設置post請求,傳遞groupids數(shù)組即可,數(shù)組傳不了就序列化傳遞
android中activity中向service傳遞參數(shù),有如下方法:
1.在Activity里注冊一個BroadcastReceiver,Service完成某個任務就可以發(fā)一個廣播,接收器收到廣播后通知activity做相應的操作。
2.使用bindService來關聯(lián)Service和Application,應用.apk里的所有組件一般情況都運行在同一個進程中,所以不需要用到IPC,bindService成功后,Service的Client可以得到Service返回的一個iBinder引用,具體的參見Service的文檔及onBind的例子,這樣Service的引用就可以通過返回的iBinder對象得到,如
public class LocalService extends Service {
// This is the object that receives interactions from clients. See
// RemoteService for a more complete example.
private final IBinder mBinder = new LocalBinder();
public class LocalBinder extends Binder {
LocalService getService() {
return LocalService.this;
}
}
@Override
public IBinder onBind(Intent intent) {
return mBinder;
}
}
之后Client通過這個iBinder對象得到Service對象引用之后,可以直接和Service通訊,比如讀取Service中的值或是調(diào)用Service的方法。
第一個頁面跳轉(zhuǎn) 傳遞值
Button bn1=(Button)findViewById(R.id.btn_Login); //跳轉(zhuǎn)
bn1.setOnClickListener(new OnClickListener(){
@Override
public void onClick(View v) {
Intent intent=new Intent(tiaoz.this,nexts.class);
//傳值
EditText txt_username=(EditText)findViewById(R.id.edit_username);
EditText txt_password=(EditText)findViewById(R.id.edit_password);
Bundle bundle = new Bundle();
bundle.putString("key_username", txt_username.getText().toString());
bundle.putString("key_password", txt_password.getText().toString());
intent.putExtras(bundle);
startActivity(intent);
finish();
}
});
第二個頁面接收值
Bundle bunde = this.getIntent().getExtras();
String strs="用戶名:"+bunde.getString("key_username").toString()+"密碼:"+bunde.getString("key_password").toString();
//改變文本框的文本內(nèi)容
show.setText(strs);
網(wǎng)頁題目:android傳參數(shù),android intent傳值
文章起源:http://chinadenli.net/article0/dseipoo.html
成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供品牌網(wǎng)站制作、品牌網(wǎng)站設計、網(wǎng)站營銷、外貿(mào)建站、軟件開發(fā)、小程序開發(fā)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)