Libraryless. Click here for Pure Java version (914L/6K/22K).
1 | !752 |
2 | |
3 | import android.app.*; |
4 | import android.widget.*; |
5 | import android.view.*; |
6 | import android.view.View; |
7 | import android.view.KeyEvent; |
8 | import android.view.inputmethod.*; |
9 | import android.text.*; |
10 | |
11 | m {
|
12 | static Activity androidContext; |
13 | |
14 | p {
|
15 | androidContext.runOnUiThread(runnable {
|
16 | final EditText et = new EditText(androidContext); |
17 | et.setSingleLine (); |
18 | androidContext.setContentView(et); |
19 | |
20 | et.setOnEditorActionListener(new TextView.OnEditorActionListener() {
|
21 | public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
|
22 | if ((event != null && (event.getKeyCode() == KeyEvent.KEYCODE_ENTER)) || (actionId == EditorInfo.IME_ACTION_DONE)) {
|
23 | |
24 | S line = et.getText().toString().trim(); |
25 | saveSecretTextFile("slack-token.txt", line);
|
26 | |
27 | Toast.makeText(androidContext, "Token saved!", Toast.LENGTH_SHORT).show(); |
28 | } |
29 | return false; |
30 | } |
31 | }); |
32 | }); |
33 | } |
34 | } |
Began life as a copy of #1001079
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, nbgitpuheiab, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1002653 |
| Snippet name: | Android: Enter & save Slack token |
| Eternal ID of this version: | #1002653/1 |
| Text MD5: | 5ed102f6d0424f9fc5f140e11afce7a4 |
| Transpilation MD5: | f9fabef7ba898460052b8cb827464825 |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX source code (Android) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2016-02-10 03:31:37 |
| Source code size: | 1014 bytes / 34 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 859 / 1345 |
| Referenced in: | [show references] |