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

33
LINES

< > BotCompany Repo | #1000419 // ImageView test (Android, in ScrollView)

JavaX source code (Android) [tags: use-pretranspiled] - run with: the app

Libraryless. Click here for Pure Java version (52L/1K/3K).

1  
!636
2  
3  
import android.app.Activity;
4  
import android.widget.*;
5  
import android.graphics.*;
6  
7  
main {
8  
  static Activity androidContext;
9  
  
10  
  psvm {
11  
    System.out.println("Hello world!");
12  
    System.out.println("androidContext = " + androidContext);
13  
    ImageView iv = new ImageView(androidContext);
14  
    
15  
    int w=256, h=256;
16  
    int[] pixels = new int[w*h];
17  
    for (int i=0; i < w*h; i++)
18  
      pixels[i] = i;
19  
20  
    Bitmap bitmap = Bitmap.createBitmap(pixels, w, h, Bitmap.Config.RGB_565);
21  
    iv.setImageBitmap(bitmap);
22  
23  
    final ScrollView sv = new ScrollView(androidContext);
24  
    sv.addView(iv);
25  
26  
    androidContext.runOnUiThread(new Runnable() {
27  
      public void run() {
28  
        androidContext.setContentView(sv);
29  
      }
30  
    });
31  
    print "yo"
32  
  }
33  
}

Author comment

Began life as a copy of #1000417

download  show line numbers  debug dex  old transpilations   

Travelled to 19 computer(s): adtiomwmedle, aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, exkalrxbqyxc, fumpprspadck, gwrvuhgaqvyk, hlxwmvgyfkur, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, ufhdzwgrioxs, vouqrxazstgt

No comments. add comment

Snippet ID: #1000419
Snippet name: ImageView test (Android, in ScrollView)
Eternal ID of this version: #1000419/1
Text MD5: 1cd8fc42a8f8b42188ebb2e95d364224
Transpilation MD5: cddec7e5a2b7fa9a9bdb8212cae5fff1
Author: stefan
Category: javax android
Type: JavaX source code (Android)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2015-10-06 18:59:47
Source code size: 783 bytes / 33 lines
Pitched / IR pitched: No / Yes
Views / Downloads: 528 / 492
Referenced in: [show references]