Last active
February 18, 2021 06:42
-
-
Save doyle-flutter/3b2333e58c6a55c51c6dde5e9dd70856 to your computer and use it in GitHub Desktop.
#06 백그라운드
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ... import 생략 | |
| public class MainActivity3 extends AppCompatActivity { | |
| @Override | |
| protected void onCreate(Bundle savedInstanceState) { | |
| super.onCreate(savedInstanceState); | |
| setContentView(R.layout.activity_main3); | |
| ConstraintLayout c = (ConstraintLayout) findViewById(R.id.main3); | |
| ResultReceiver mRecevier = new ResultReceiver(new Handler()){ | |
| @Override | |
| protected void onReceiveResult(int resultCode, Bundle resultData) { | |
| super.onReceiveResult(resultCode, resultData); | |
| Log.d("DOY", resultData.getString("key")); | |
| } | |
| }; | |
| Button backButton = new Button(this.getApplicationContext()); | |
| backButton.setText("백그라운드 서비스(HTTP)"); | |
| final Intent intent = new Intent(this, MyIntentService.class); | |
| intent.putExtra("INTENT_KEY_RECEIVER",mRecevier); | |
| View.OnClickListener backButtonListener = new View.OnClickListener() { | |
| @Override | |
| public void onClick(View view) { | |
| Log.d("DOY", "CLICK?"); | |
| startService(intent); | |
| } | |
| }; | |
| backButton.setOnClickListener(backButtonListener); | |
| c.addView(backButton); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment