[Galaxy S II Android Development] remuntada78:
Thanks, it's hard for me to know what i'm missing, i can say to you that i tried to create a simple app with eclipse to extract the random code,when i've decompiled that app,the code was divided in two smali:

.class public Lcom/grigview/MainActivity;
.super Landroid/app/Activity;
.source "MainActivity.java"

# instance fields
.field private mImageIds:[Ljava/lang/Integer;

# direct methods
.method public constructor <init>()V
.locals 3

.prologue
.line 9
invoke-direct {p0}, Landroid/app/Activity;-><init>()V

.line 10
[COLOR="Red"] const/4 v0, 0x3

new-array v0, v0, [Ljava/lang/Integer;

const/4 v1, 0x0

.line 11
const v2, 0x7f020003

invoke-static {v2}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

move-result-object v2

aput-object v2, v0, v1

const/4 v1, 0x1

.line 12
const/high16 v2, 0x7f02

invoke-static {v2}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

move-result-object v2 [COLOR="Cyan"]this code create the array with the image[/COLOR]

aput-object v2, v0, v1

const/4 v1, 0x2

.line 13
const v2, 0x7f020001

invoke-static {v2}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

move-result-object v2

aput-object v2, v0, v1

iput-object v0, p0, Lcom/grigview/MainActivity;->mImageIds:[Ljava/lang/Integer;[/COLOR]

.line 9
return-void
.end method

.method static synthetic access$0(Lcom/grigview/MainActivity;)[Ljava/lang/Integer;
.locals 1
.parameter

.prologue
.line 10
iget-object v0, p0, Lcom/grigview/MainActivity;->mImageIds:[Ljava/lang/Integer;

return-object v0
.end method

# virtual methods
.method protected onCreate(Landroid/os/Bundle;)V
.locals 4
.parameter "savedInstanceState"

.prologue
.line 17
invoke-super {p0, p1}, Landroid/app/Activity;->onCreate(Landroid/os/Bundle;)V

.line 18
const/high16 v3, 0x7f03

invoke-virtual {p0, v3}, Lcom/grigview/MainActivity;->setContentView(I)V

.line 19
[COLOR="Lime"] new-instance v2, Ljava/util/Random;

invoke-direct {v2}, Ljava/util/Random;-><init>()V [COLOR="Cyan"]this code invoke Random [/COLOR]

.line 21
.local v2, rand:Ljava/util/Random;[/COLOR]
const v3, 0x7f050001 [COLOR="Cyan"]this id is the layout where to show random image[/COLOR]

invoke-virtual {p0, v3}, Lcom/grigview/MainActivity;->findViewById(I)Landroid/view/View;

move-result-object v0

.line 23
.local v0, background:Landroid/view/View;
const v3, 0x7f050002

invoke-virtual {p0, v3}, Lcom/grigview/MainActivity;->findViewById(I)Landroid/view/View;

move-result-object v1

.line 24
.local v1, button:Landroid/view/View;
new-instance v3, Lcom/grigview/MainActivity$1;

invoke-direct {v3, p0, v0, v2}, Lcom/grigview/MainActivity$1;-><init>(Lcom/grigview/MainActivity;Landroid/view/View;Ljava/util/Random;)V

invoke-virtual {v1, v3}, Landroid/view/View;->setOnClickListener(Landroid/view/View$OnClickListener;)V

.line 35
return-void
.end method

.class Lcom/grigview/MainActivity$1;
.super Ljava/lang/Object;
.source "MainActivity.java"

# interfaces
.implements Landroid/view/View$OnClickListener;

# annotations
.annotation system Ldalvik/annotation/EnclosingMethod;
value = Lcom/grigview/MainActivity;->onCreate(Landroid/os/Bundle;)V
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
accessFlags = 0x0
name = null
.end annotation

# instance fields
.field final synthetic this$0:Lcom/grigview/MainActivity;

.field private final synthetic val$background:Landroid/view/View;

.field private final synthetic val$rand:Ljava/util/Random;

# direct methods
.method constructor <init>(Lcom/grigview/MainActivity;Landroid/view/View;Ljava/util/Random;)V
.locals 0
.parameter
.parameter
.parameter

.prologue
.line 1
iput-object p1, p0, Lcom/grigview/MainActivity$1;->this$0:Lcom/grigview/MainActivity;

iput-object p2, p0, Lcom/grigview/MainActivity$1;->val$background:Landroid/view/View;

iput-object p3, p0, Lcom/grigview/MainActivity$1;->val$rand:Ljava/util/Random;

.line 24
invoke-direct {p0}, Ljava/lang/Object;-><init>()V

return-void
.end method

# virtual methods
.method public onClick(Landroid/view/View;)V
.locals 4
.parameter "v"

.prologue
.line 29
iget-object v0, p0, Lcom/grigview/MainActivity$1;->val$background:Landroid/view/View;

iget-object v1, p0, Lcom/grigview/MainActivity$1;->this$0:Lcom/grigview/MainActivity;

#getter for: Lcom/grigview/MainActivity;->mImageIds:[Ljava/lang/Integer;
invoke-static {v1}, Lcom/grigview/MainActivity;->access$0(Lcom/grigview/MainActivity;)[Ljava/lang/Integer;

move-result-object v1

iget-object v2, p0, Lcom/grigview/MainActivity$1;->val$rand:Ljava/util/Random;

iget-object v3, p0, Lcom/grigview/MainActivity$1;->this$0:Lcom/grigview/MainActivity;

#getter for: Lcom/grigview/MainActivity;->mImageIds:[Ljava/lang/Integer;
invoke-static {v3}, Lcom/grigview/MainActivity;->access$0(Lcom/grigview/MainActivity;)[Ljava/lang/Integer;

[COLOR="Purple"] move-result-object v3

array-length v3, v3

invoke-virtual {v2, v3}, Ljava/util/Random;->nextInt(I)I

move-result v2

aget-object v1, v1, v2 [COLOR="Cyan"]this code make the random show[/COLOR]

invoke-virtual {v1}, Ljava/lang/Integer;->intValue()I

move-result v1

invoke-virtual {v0, v1}, Landroid/view/View;->setBackgroundResource(I)V[/COLOR]

.line 31
return-void
.end method

so i tried to extract it in only one method, You need to consider that i'm a noob :p so certainly i'm missing and wrong something