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)

import android.app.Activity;
import android.widget.*;
import android.graphics.*;

static void androidShowClickableImageAndText(final S imageID, final int borderColor, final Runnable onClick, final S text) {
  thread "showimg" {
    LinearLayout ll = new LinearLayout(androidContext());
    ll.setOrientation(ll.VERTICAL);
    
    ImageView iv = new ImageView(androidContext());
    iv.setBackgroundColor(borderColor);
    iv.setImageBitmap(BitmapFactory.decodeFile(loadLibrary(imageID).getPath()));
    if (onClick != null)
      iv.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
          call(onClick);
        }
      });
    ll.addView(iv);
    
    TextView tv = new TextView(androidContext());
    tv.setText(text);
    ll.addView(tv);
    
    androidShow(ll);
  }
}

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: 514 / 516
Referenced in: [show references]