Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

30
LINES

< > BotCompany Repo | #1008233 // aButton - make Android Button

JavaX fragment (include)

1  
import android.app.*;
2  
import android.widget.Button;
3  
import android.view.*;
4  
import android.view.KeyEvent;
5  
import android.view.inputmethod.*;
6  
import android.text.*;
7  
8  
static Button aButton(S text, final Runnable action) {
9  
  final Button b = aButton(text);
10  
  if (action != null)
11  
    b.setOnClickListener(new View.OnClickListener() {
12  
      public void onClick(View v) {
13  
        temp holdInstance(b);
14  
        pcallF(action);
15  
      }
16  
    });
17  
  ret b;
18  
}
19  
20  
static Button aButton(S text) {
21  
  Button b = aButton();
22  
  b.setText(text);
23  
  ret b;
24  
}
25  
26  
static Button aButton() {
27  
  ret androidUI(func -> Button {
28  
    new Button(androidActivity())
29  
  });
30  
}

Author comment

Began life as a copy of #1008231

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1008233
Snippet name: aButton - make Android Button
Eternal ID of this version: #1008233/6
Text MD5: 7ffb0d6d21edf2d6b0ab2ffc99847750
Author: stefan
Category: javax / android
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-06-06 14:08:43
Source code size: 663 bytes / 30 lines
Pitched / IR pitched: No / No
Views / Downloads: 517 / 556
Version history: 5 change(s)
Referenced in: [show references]