XyApp/src/com/dy/SendActivity.java

(开头部分) 2KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

package com.dy;

import java.net.URLDecoder;
import java.net.URLEncoder;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.StrictMode;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

public class SendActivity extends Activity {
	/** Called when the activity is first created. */
	private Button button;
	private EditText text;
	private String gid;
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.one);
		StrictMode.ThreadPolicy policy=new StrictMode.ThreadPolicy.Builder().permitAll().build();
		StrictMode.setThreadPolicy(policy);
		button = (Button) this.findViewById(R.id.Button);
		button.setOnClickListener(myListener1);
		Bundle extras = this.getIntent().getExtras();
		gid=  extras.getString("gid");
		text = (EditText) findViewById(R.id.Text);
	}

	// 发送
	private OnClickListener myListener1 = new Button.OnClickListener() {

		public void onClick(View v) {
			Declare declare = (Declare) getApplicationContext();
			int myid = declare.getId();
			String content = text.getText().toString();
			try {
				String url = HttpUtil.BASE_URL
						+ "QLiuyanAddServlet?myid="
						+ myid
						+ "&content="
						+ URLEncoder.encode(
								URLEncoder.encode(content, "UTF-8"), "UTF-8");
				// 查询返回结果
				String result = HttpUtil.queryStringForPost(url);
				result = URLDecoder.decode(result, "UTF-8");
				System.out.println("=========================@@@####  "
						+ result);
				if(!result.equals("0")){
					Toast.makeText(getApplicationContext(), "留言成功", 1).show();
				}
				
			} catch (Exception e) {

				Toast.makeText(getApplicationContext(), "", 1).show();
			}
后面还有 13 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。