maybe this is a very simple question...but i am a rather new beginner...please tolerate me.
I am now developing a drawing app and would like to allow user to choose color through a color picker.
I have seen the AmbilWarna dialog and has copied the following to my app:
package com.pearappx.drawing;
import com.pearmak.drawing.ui.dialog.AmbilWarnaDialog.OnAmbilWarnaListener;
// other codes and declarations
public OnClickListener setColorPickerDialogListener = new OnClickListener()
{
@Override
public void onClick(View v)
{
AmbilWarnaDialog dialog = new AmbilWarnaDialog(Doodlz.this, currtentColor, new OnAmbilWarnaListener()
{
@Override
public void onCancel(AmbilWarnaDialog dialog) { ;}
@Override
public void onOk(AmbilWarnaDialog dialog, int color)
{
colorRedBtn.setbackgroundcolor(color);
}
});
dialog.show();
};
};
There are many red underlines in the OnCLickListener block for quoting "AmbilWarnaDialog cannot be resolved to a type" . This maybe because the AmbilWarnaDialog not properly imported??
This is because there is also an error shown at the import part. I am importing by writing as:
import com.pearmak.drawing.ui.dialog.AmbilWarnaDialog.OnAmbilWarnaListener
; but it also underlines this phrase as the above error too.
I have followed http://developer.android.com/tools/projects/projects-eclipse.html already and has clicked "apply" before closing the reference dialog.
How could this be solved? Many thanks!!!
What you need is library project to place your Dialog into. Once you have that working, copy the *.jar
file out of the \bin
directory and import it into your main app. Be sure to modify your app's Build Path such that it includes the new *.jar
file.
for a great introduction to library projects, check out: http://www.vogella.com/articles/AndroidLibraryProjects/article.html. It's where i started and it worked like a champ for me.
good luck!