Skip to content
This repository has been archived by the owner on Aug 9, 2019. It is now read-only.

NativePickerDialog - Could not find method android.app.AlertDialog$Builder #39

Open
Vit025 opened this issue Oct 30, 2013 · 2 comments
Open

Comments

@Vit025
Copy link

Vit025 commented Oct 30, 2013

Hi! I have a problem with NativePickerDialog on Android 2.3.3 (Samsung Galaxy S GT-I9000). NativePickerDialog not displayed at all, AS3 does not report any errors but adb logcat shows the following:

adb logcat

D/NativeDialogs: Extension.initialize
D/NativeDialogs: Extension.createContext extId: PickerDialogContext
D/PickerDialogContext( 9673): Registering Extension Functions
I/dalvikvm( 9673): Could not find method android.app.AlertDialog$Builder., referenced from method pl.mateuszmackowiak.nativeANE.functoins.NativePickerDialogContext$PickerDialog.
W/dalvikvm( 9673): VFY: unable to resolve direct method 197: Landroid/app/AlertDialog$Builder;. (Landroid/content/Context;I)V
D/dalvikvm( 9673): VFY: replacing opcode 0x70 at 0x0006
D/dalvikvm( 9673): VFY: dead code 0x0009-001b in Lpl/mateuszmackowiak/nativeANE/functoins/NativePickerDialogContext$PickerDialog;. (Lpl/mateuszmackowiak/nativeANE/functoins/NativePickerDialogContext;Lcom/adobe/fre/FREContext;Landroid/content/Context;Ljava/lang/String;Ljava/lang/String;Lcom/adobe/fre/FREArray;[I[DI)V

AS3

import flash.display.Sprite;
import flash.events.ErrorEvent;
import flash.events.Event;
import flash.events.MouseEvent;
import pl.mateuszmackowiak.nativeANE.dialogs.NativeAlertDialog;
import pl.mateuszmackowiak.nativeANE.dialogs.NativePickerDialog;
import pl.mateuszmackowiak.nativeANE.dialogs.support.PickerList;
import pl.mateuszmackowiak.nativeANE.events.NativeDialogEvent;
import pl.mateuszmackowiak.nativeANE.events.NativeDialogListEvent;

public class As3TestProject extends Sprite {

    private var picker:NativePickerDialog;
    private var frame:int = 0;

    public function As3TestProject() {
        super();
        createButtons();
    }

    public function createButtons():void {
        var circle:Sprite = new Sprite();
        circle.graphics.beginFill(0xFF794B);
        circle.graphics.drawCircle(150, 150, 30);
        circle.graphics.endFill();
        addChild(circle);

        var circle2:Sprite = new Sprite();
        circle2.graphics.beginFill(0x000000);
        circle2.graphics.drawCircle(150, 150, 30);
        circle2.graphics.endFill();
        circle2.x = 200;
        addChild(circle2);
        circle.addEventListener(MouseEvent.CLICK, onPickerButtonClicked);
        circle2.addEventListener(MouseEvent.CLICK, onsPickerButtonClicked);
    }

    public function mess(message:*):void {
        var s:String = String(message);
        trace(s + "\n");
    }

    protected function onPickerButtonClicked(event:MouseEvent):void {
        NativeAlertDialog.showAlert("Jagniecina", "Men", Vector.<String>(["Bekon", "Inne"]), trace);
    }

    protected function onsPickerButtonClicked(event:MouseEvent):void {
        createNativePickerDialog();
    }

    protected function createNativePickerDialog():void {
        if (!NativePickerDialog.isSupported) {
            trace("VF >>", this, ":: createNativePickerDialog: NOT SUPPORTED");
            return;
        }
        picker ||= new NativePickerDialog();
        var pickerlist1:PickerList = new PickerList(["HAHAHA", "ATATAT", "tatasd"], 1);
        pickerlist1.addEventListener(NativeDialogListEvent.LIST_CHANGE, mess);
        var pickerlist2:PickerList = new PickerList(["affasf", "sagasdg", "ah5we", "fdsad"], 2);
        pickerlist2.addEventListener(NativeDialogListEvent.LIST_CHANGE, mess);
        picker.dataProvider = Vector.<PickerList>([pickerlist1, pickerlist2]);
        picker.addEventListener(NativeDialogEvent.CLOSED, readAllSelectedValuesFromPickers);
        picker.addEventListener(NativeDialogEvent.OPENED, pickerOpenedHandler);
        picker.addEventListener(NativeDialogEvent.CANCELED, pickerCanceledHandler);
        picker.addEventListener(ErrorEvent.ERROR, pickerErrorHandler);
        picker.title = "test title";
        picker.show();
    }

    private function onPickerStatus(e:Event):void {
        trace("VF >>", this, ":: onPickerStatus:", e.type);
    }

    private function pickerErrorHandler(e:ErrorEvent):void {
        trace("VF >>", this, ":: pickerErrorHandler:", e.text);
    }

    private function pickerCanceledHandler(e:NativeDialogEvent):void {
        trace("VF >>", this, ":: pickerCanceledHandler:");
    }

    private function pickerOpenedHandler(e:NativeDialogEvent):void {
        trace("VF >>", this, ":: pickerOpenedHandler:");
    }

    private function readSelectedValuesFromPickerList(event:NativeDialogListEvent):void {
        mess("\n=====00000========000000");
        mess(event);
        mess("selectedIndex: " + pickerList.selectedIndex);
        mess("selectedItem: " + pickerList.selectedItem);
        mess("=====00000========000000\n");
    }

    private function readAllSelectedValuesFromPickers(event:NativeDialogEvent):void {
        var v:Vector.<PickerList> = picker.dataProvider;
        var pickerList:PickerList;
        mess("\n=====00000========000000");
        mess(event);
        for (var i:int = 0; i < v.length; i++) {
            pickerList = v[i];
            mess("pickerlist " + i);
            mess("selectedIndex: " + pickerList.selectedIndex);
            mess("selectedItem: " + pickerList.selectedItem);
        }
        mess("=====00000========000000\n");

        picker.dispose();
    }

}

NativeAlertDialog works without any problems in example above.
Could you please tell me what is wrong? Thank you

@kyleward
Copy link

Hi,

Did you manage to solve this? I'm having the same issue?

@ahmadarif
Copy link

Hi,
I can't use event.buttonIindex or event.index, please solve this :D

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants