public class MainActivity
extends Activity
{
TextView CountText;
Button btnStopService;
boolean flag = true;
Intent intentMyService;
BroadcastReceiver receiver;
String serviceData;
Toast toast;
boolean bool1;
boolean bool2;
public void onCreate(Bundle paramBundle)
{
super.onCreate(paramBundle);
setContentView(R.layout.activity_main);
this.intentMyService = new Intent(this, MyServiceIntent.class);
this.receiver = new MyMainLocalRecever();
this.CountText = ((TextView)findViewById(R.id.textCount));
this.btnStopService = ((Button)findViewById(R.id.btn_test));
this.btnStopService.setOnClickListener(new View.OnClickListener()
{
public void onClick(View paramAnonymousView)
{
if (MainActivity.this.flag) {
//MainActivity.this.btnStopService.setText("만보기 중지");
}
for (;;)
{
try
{
IntentFilter localIntentFilter = new IntentFilter("androy.");
MainActivity.this.registerReceiver(MainActivity.this.receiver, localIntentFilter);
MainActivity.this.startService(MainActivity.this.intentMyService);
Toast.makeText(MainActivity.this.getApplicationContext(), "start", Toast.LENGTH_SHORT).show();
MainActivity localMainActivity = MainActivity.this;
bool1 = MainActivity.this.flag;
bool2 = false;
if (!bool1) break label;
localMainActivity.flag = bool2;
return;
}
catch (Exception localException2)
{
Toast.makeText(MainActivity.this.getApplicationContext(), localException2.getMessage(), Toast.LENGTH_SHORT).show();
continue;
}
//MainActivity.this.btnStopService.setText("Go !!");
try
{
MainActivity.this.unregisterReceiver(MainActivity.this.receiver);
MainActivity.this.stopService(MainActivity.this.intentMyService);
Toast.makeText(MainActivity.this.getApplicationContext(), "stop", Toast.LENGTH_SHORT).show();
}
catch (Exception localException1)
{
Toast.makeText(MainActivity.this.getApplicationContext(), localException1.getMessage(), Toast.LENGTH_SHORT).show();
}
continue;
label:
bool2 = true;
}
}
});
}
class MyMainLocalRecever
extends BroadcastReceiver
{
MyMainLocalRecever() {}
public void onReceive(Context paramContext, Intent paramIntent)
{
MainActivity.this.serviceData = paramIntent.getStringExtra("serviceData");
MainActivity.this.CountText.setText(MainActivity.this.serviceData);
//Log.d("COUNT", MainActivity.this.serviceData);
Toast.makeText(MainActivity.this.getApplicationContext(), "walking", Toast.LENGTH_SHORT).show();
}
}
}
이런 소스를 구하게 되서 공부 중인데 저 부분이 빨간줄이 그어진 이유를 모르겠습니다
뭐가 문제일까요?...ㅠㅠ