找传奇、传世资源到传世资源站!

android以get和post方式提交数据给WEB_完整实例源码下载_

8.5玩家评分(1人评分)
下载后可评
介绍 评论 失效链接反馈

package com.zb.sendtoweb;

import com.zb.service.SendService;

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

public class MainActivity extends Activity {
  private EditText titleTxt,timeTxt;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		titleTxt = (EditText)this.findViewById(R.id.title);
		timeTxt = (EditText)this.findViewById(R.id.time);
	}
  public void save(View view){
  	String title = titleTxt.getText().toString();
  	String time = timeTxt.getText().toString();
  	boolean flag;
		try {
			flag = SendService.add(title,time);
			System.out.println(flag "&&&&");
			if(flag){
	  		Toast.makeText(getApplicationContext(), "发送并保存成功", 1).show();
	  	}else{
	  		Toast.makeText(getApplicationContext(), "发送失败", 1).show();
	  	}
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
  }
	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.main, menu);
		return true;
	}

}

评论

发表评论必须先登陆, 您可以 登陆 或者 注册新账号 !


在线咨询: 问题反馈
客服QQ:174666394

有问题请留言,看到后及时答复