哪位Android大神解释一下 5
packagecom.example.zzzz;importorg.json.JSONException;importorg.json.JSONObject;import...
package com.example.zzzz;
import org.json.JSONException;
import org.json.JSONObject;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.app.Activity;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;
import android.widget.Toast;
public class MainActivity extends Activity {
String url = "http://192.168.0.81:8000";
boolean Boolean1;
boolean Boolean2;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final ImageView imageView1 = (ImageView)findViewById(R.id.imageView2);
final ImageView imageView2 = (ImageView)findViewById(R.id.imageView3);
final ImageView imageView3 = (ImageView)findViewById(R.id.imageView4);
final ImageView imageView4 = (ImageView)findViewById(R.id.imageView5);
imageView2.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
Boolean1=!Boolean1;
if(Boolean1){
doPostCmd(url, "lamp=257;");
imageView1.setImageResource(R.drawable.lamp_on);
imageView2.setImageResource(R.drawable.btn_switch_on);
}
else
{
doPostCmd(url, "lamp=256;");
imageView1.setImageResource(R.drawable.lamp_off);
imageView2.setImageResource(R.drawable.btn_switch_off);
}
}
});
imageView4.setOnClickListener(new OnClickListener() {
@Override
public void onCli 展开
import org.json.JSONException;
import org.json.JSONObject;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.app.Activity;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;
import android.widget.Toast;
public class MainActivity extends Activity {
String url = "http://192.168.0.81:8000";
boolean Boolean1;
boolean Boolean2;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final ImageView imageView1 = (ImageView)findViewById(R.id.imageView2);
final ImageView imageView2 = (ImageView)findViewById(R.id.imageView3);
final ImageView imageView3 = (ImageView)findViewById(R.id.imageView4);
final ImageView imageView4 = (ImageView)findViewById(R.id.imageView5);
imageView2.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
Boolean1=!Boolean1;
if(Boolean1){
doPostCmd(url, "lamp=257;");
imageView1.setImageResource(R.drawable.lamp_on);
imageView2.setImageResource(R.drawable.btn_switch_on);
}
else
{
doPostCmd(url, "lamp=256;");
imageView1.setImageResource(R.drawable.lamp_off);
imageView2.setImageResource(R.drawable.btn_switch_off);
}
}
});
imageView4.setOnClickListener(new OnClickListener() {
@Override
public void onCli 展开
1个回答
2018-10-22 · 百度知道合伙人官方认证企业
关注
展开全部
解释哪里?全解释?
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询