yukuku / android-color-picker

Automatically exported from code.google.com/p/android-color-picker
0 stars 0 forks source link

I am getting an error when i try to call the color picker. #2

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
i get an error on the last line 

dialog.show();

I imported the library. 
and Setup my permissions in the manifest
also i changed the libraries sdk version to lvl 7 

Help? :D please

Original issue reported on code.google.com by danma...@gmail.com on 1 Mar 2011 at 12:02

GoogleCodeExporter commented 9 years ago
Please attach the complete stack trace from the logcat.

Possible reason is you need to pass in a "windowed" context, such as an 
Activity, instead of "non-windowed" context, such as Application 
(getApplicationContext() is one of them).

Original comment by yukuku on 1 Mar 2011 at 12:17

GoogleCodeExporter commented 9 years ago
At the moment I cant run the program to log anything in the trace 

im using the code as follows

// initialColor is the initially-selected color to be shown in the rectangle on 
the left of the arrow.
 // for example, 0xff000000 is black, 0xff0000ff is blue. Please be aware of the initial 0xff which is the alpha.

    AmbilWarnaDialog dialog = new AmbilWarnaDialog(designmode_createcards.this, 0xff0000ff, new OnAmbilWarnaListener() 
    {

        @Override
        public void onCancel(AmbilWarnaDialog dialog) {

        }

        @Override
        public void onOk(AmbilWarnaDialog dialog, int color) {

        }

    });

dialog.show();

Original comment by danma...@gmail.com on 1 Mar 2011 at 12:24

GoogleCodeExporter commented 9 years ago
and im importing the color picker with

import yuku.ambilwarna.AmbilWarnaDialog;
import yuku.ambilwarna.AmbilWarnaKotak;

Original comment by danma...@gmail.com on 1 Mar 2011 at 12:25

GoogleCodeExporter commented 9 years ago
Sorry, without a stack trace I can't help you with this.

Original comment by yukuku on 1 Mar 2011 at 12:26

GoogleCodeExporter commented 9 years ago
ok thank you! I think i figured out what it was... 

lol

i didn't import it right.

Original comment by danma...@gmail.com on 1 Mar 2011 at 12:31

GoogleCodeExporter commented 9 years ago
well I imported it right this time. still have an error on the dialog.show.

im calling it from a regular activity. 

so its a context issue .. hmm

Original comment by danma...@gmail.com on 1 Mar 2011 at 12:33

GoogleCodeExporter commented 9 years ago
You have to put it inside a function like this.  Thats what fixed my problem 
with the same issue.

public void colorpicker()
{
// initialColor is the initially-selected color to be shown in the rectangle on 
the left of the arrow.
 // for example, 0xff000000 is black, 0xff0000ff is blue. Please be aware of the initial 0xff which is the alpha.

    AmbilWarnaDialog dialog = new AmbilWarnaDialog(designmode_createcards.this, 0xff0000ff, new OnAmbilWarnaListener() 
    {

        @Override
        public void onCancel(AmbilWarnaDialog dialog) {

        }

        @Override
        public void onOk(AmbilWarnaDialog dialog, int color) {

        }

    });

dialog.show();
}

Original comment by JustinCo...@gmail.com on 22 Apr 2011 at 1:11

GoogleCodeExporter commented 9 years ago

Original comment by yukuku on 3 Nov 2011 at 7:59