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

27
LINES

< > BotCompany Repo | #1005200 // androidShowClickableImageAndText - show clickable full-screen image plus text underneath

JavaX fragment (include)

1  
import android.app.Activity;
2  
import android.widget.*;
3  
import android.graphics.*;
4  
5  
static void androidShowClickableImageAndText(final S imageID, final int borderColor, final Runnable onClick, final S text) {
6  
  thread "showimg" {
7  
    LinearLayout ll = new LinearLayout(androidContext());
8  
    ll.setOrientation(ll.VERTICAL);
9  
    
10  
    ImageView iv = new ImageView(androidContext());
11  
    iv.setBackgroundColor(borderColor);
12  
    iv.setImageBitmap(BitmapFactory.decodeFile(loadLibrary(imageID).getPath()));
13  
    if (onClick != null)
14  
      iv.setOnClickListener(new View.OnClickListener() {
15  
        public void onClick(View v) {
16  
          call(onClick);
17  
        }
18  
      });
19  
    ll.addView(iv);
20  
    
21  
    TextView tv = new TextView(androidContext());
22  
    tv.setText(text);
23  
    ll.addView(tv);
24  
    
25  
    androidShow(ll);
26  
  }
27  
}

Author comment

Began life as a copy of #1005198

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1005200
Snippet name: androidShowClickableImageAndText - show clickable full-screen image plus text underneath
Eternal ID of this version: #1005200/1
Text MD5: 9196755a01199ee68bbf7d31f5b7560d
Author: stefan
Category: javax android
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-10-22 01:02:08
Source code size: 841 bytes / 27 lines
Pitched / IR pitched: No / No
Views / Downloads: 516 / 519
Referenced in: [show references]