[android-developers] Question about assets vs resources

2009-08-27 Thread longhairedsi

Hi

I have many ogg files in my app(around 1mb worth). Currently I'm
loading them from my sdcard from a folder that i manualy coppied
across. For distribution of my app where should i put the oggs? I
tried adding them as resources(R.) but it seemed to make my app take
an age to load, would this happen? Is assets the way to go? if so has
anyone got an example of loading an oog from assets? i can't get it to
work..

Cheers
Si
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Question about assets vs resources

2009-08-29 Thread longhairedsi

Hi Diane, thanks for the reply

Could I have a little clarification please? On app startup would the
resources and assets be loaded into memory or only when they are
used?  Something like this seems to be happening to my app. Since I
added the files I had on the sdcard to the assets folder the app takes
much longer to load on initial startup. If this is the case I think
copying the files to the sdcard on first run might be the way to go
(but much more work for monday ;) )

Thanks
Simon

On Aug 28, 3:06 am, Dianne Hackborn  wrote:
> Assets and resources are basically the same thing.  They are all entries in
> your zip files, resources have an associated table so you can retrieve the
> file by resource identifier (which may select amongst different files based
> on the configuration), while assets are just retrieved with a raw path in
> the zip.
>
> On Thu, Aug 27, 2009 at 4:35 PM, longhairedsi
> wrote:
>
>
>
> > Hi
>
> > I have many ogg files in my app(around 1mb worth). Currently I'm
> > loading them from my sdcard from a folder that i manualy coppied
> > across. For distribution of my app where should i put the oggs? I
> > tried adding them as resources(R.) but it seemed to make my app take
> > an age to load, would this happen? Is assets the way to go? if so has
> > anyone got an example of loading an oog from assets? i can't get it to
> > work..
>
> > Cheers
> > Si
>
> --
> Dianne Hackborn
> Android framework engineer
> hack...@android.com
>
> Note: please don't send private questions to me, as I don't have time to
> provide private support, and so won't reply to such e-mails.  All such
> questions should be posted on public forums, where I and others can see and
> answer them.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Very nasty error for no reason

2009-08-29 Thread longhairedsi

Hi

I've just changed my app to load an xml file from a raw resource
instead of from the sdcard. Every time i run the app it now fails in a
spectacular way. It just closes down, no exceptions. Log output is
below.

I'm not kidding, all i changed was the way an xml file is loaded. If
change back and it's fine

Please help!

Cheers
Simon


08-29 14:24:32.979: INFO/DEBUG(1236): *** *** *** *** *** *** *** ***
*** *** *** *** *** *** *** ***
08-29 14:24:32.979: INFO/DEBUG(1236): Build fingerprint: 'tmeu/kila_eu/
dream/trout:1.5/CRC37/150879:user/ota-rel-keys,release-keys'
08-29 14:24:32.979: INFO/DEBUG(1236): pid: 1710, tid: 1711  >>>
com.basementajax.microjam <<<
08-29 14:24:32.979: INFO/DEBUG(1236): signal 11 (SIGSEGV), fault addr
0004
08-29 14:24:32.979: INFO/DEBUG(1236):  r0 0004  r1 40021800  r2
0004  r3 ad32aa45
08-29 14:24:32.979: INFO/DEBUG(1236):  r4   r5   r6
ad344125  r7 4100afb8
08-29 14:24:32.989: INFO/DEBUG(1236):  r8 100ffcb0  r9 4100afb0  10
41a46450  fp 1071
08-29 14:24:32.989: INFO/DEBUG(1236):  ip ad36492c  sp 100ffc98  lr
ad32aa4f  pc afb045a8  cpsr 0010
08-29 14:24:33.309: INFO/DEBUG(1236):  #00  pc 45a8  /
system/lib/libcutils.so
08-29 14:24:33.309: INFO/DEBUG(1236):  #01  lr ad32aa4f  /
system/lib/libandroid_runtime.so
08-29 14:24:33.319: INFO/DEBUG(1236): stack:
08-29 14:24:33.319: INFO/DEBUG(1236): 100ffc58  
08-29 14:24:33.319: INFO/DEBUG(1236): 100ffc5c  00197e80  [heap]
08-29 14:24:33.319: INFO/DEBUG(1236): 100ffc60  
08-29 14:24:33.319: INFO/DEBUG(1236): 100ffc64  00169140  [heap]
08-29 14:24:33.319: INFO/DEBUG(1236): 100ffc68  100ffcc8
08-29 14:24:33.329: INFO/DEBUG(1236): 100ffc6c  00197e80  [heap]
08-29 14:24:33.329: INFO/DEBUG(1236): 100ffc70  423907a0
08-29 14:24:33.329: INFO/DEBUG(1236): 100ffc74  00c1
08-29 14:24:33.329: INFO/DEBUG(1236): 100ffc78  40021800
08-29 14:24:33.329: INFO/DEBUG(1236): 100ffc7c  00c2
08-29 14:24:33.329: INFO/DEBUG(1236): 100ffc80  
08-29 14:24:33.339: INFO/DEBUG(1236): 100ffc84  
08-29 14:24:33.339: INFO/DEBUG(1236): 100ffc88  
08-29 14:24:33.339: INFO/DEBUG(1236): 100ffc8c  
08-29 14:24:33.339: INFO/DEBUG(1236): 100ffc90  df002777
08-29 14:24:33.349: INFO/DEBUG(1236): 100ffc94  e3a070ad
08-29 14:24:33.349: INFO/DEBUG(1236): #00 100ffc98  
08-29 14:24:33.349: INFO/DEBUG(1236): 100ffc9c  ad32aa4f  /system/
lib/libandroid_runtime.so
08-29 14:24:33.359: INFO/DEBUG(1236): 100ffca0  100ffcd0
08-29 14:24:33.359: INFO/DEBUG(1236): 100ffca4  ad344135  /system/
lib/libandroid_runtime.so
08-29 14:24:33.359: INFO/DEBUG(1236): 100ffca8  410a99d0
08-29 14:24:33.359: INFO/DEBUG(1236): 100ffcac  ad00e3b8  /system/
lib/libdvm.so
08-29 14:24:33.359: INFO/DEBUG(1236): 100ffcb0  410a99d0
08-29 14:24:33.359: INFO/DEBUG(1236): 100ffcb4  000f7430  [heap]
08-29 14:24:33.369: INFO/DEBUG(1236): 100ffcb8  ad344125  /system/
lib/libandroid_runtime.so
08-29 14:24:33.369: INFO/DEBUG(1236): 100ffcbc  40021800
08-29 14:24:33.369: INFO/DEBUG(1236): 100ffcc0  410a99d0
08-29 14:24:33.369: INFO/DEBUG(1236): 100ffcc4  afe39dd0
08-29 14:24:33.369: INFO/DEBUG(1236): 100ffcc8  100ffcd0
08-29 14:24:33.369: INFO/DEBUG(1236): 100ffccc  ad040a8d  /system/
lib/libdvm.so
08-29 14:24:33.379: INFO/DEBUG(1236): 100ffcd0  4100afb0
08-29 14:24:33.379: INFO/DEBUG(1236): 100ffcd4  41c44fd4
08-29 14:24:33.379: INFO/DEBUG(1236): 100ffcd8  ad344125  /system/
lib/libandroid_runtime.so
08-29 14:24:33.379: INFO/DEBUG(1236): 100ffcdc  100ffd48
08-29 14:24:34.109: INFO/ActivityManager(62): Process
com.basementajax.microjam (pid 1710) has died.
08-29 14:24:34.119: INFO/WindowManager(62): WIN DEATH: Window{433928a8
com.basementajax.microjam/com.basementajax.microjam.MicroJam
paused=false}
08-29 14:24:34.119: INFO/DEBUG(1236): debuggerd committing suicide to
free the zombie!
08-29 14:24:34.129: DEBUG/Zygote(34): Process 1710 terminated by
signal (11)
08-29 14:24:34.169: INFO/DEBUG(1723): debuggerd: Aug  6 2009 17:14:09
08-29 14:24:34.179: INFO/WindowManager(62): WIN DEATH: Window{4343fbc8
com.basementajax.microjam/com.basementajax.microjam.MicroJam
paused=false}
08-29 14:24:34.199: INFO/WindowManager(62): Setting rotation to 0,
animFlags=0
08-29 14:24:34.219: INFO/WindowManager(62): Config changed:
{ scale=1.0 imsi=0/0 locale=en_GB touch=3 key=2/1/2 nav=3 orien=1 }
08-29 14:24:34.229: INFO/WindowManager(62): Config changed:
{ scale=1.0 imsi=0/0 locale=en_GB touch=3 key=2/1/2 nav=3 orien=1 }
08-29 14:24:34.239: WARN/SurfaceComposerClient(62): Destroying surface
while a transaction is open. Client 0x1f8ba8: destroying surface 0,
mTransactionOpen=1
08-29 14:24:34.239: WARN/WindowManager(62):
performLayoutAndPlaceSurfacesLocked called while in layout

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Goo

[android-developers] Re: Very nasty error for no reason

2009-08-29 Thread longhairedsi

Ok i found the problem. But don't ask my why this would cause a
problem, I have no idea!

It stems from me passing the inputstream into a method. This is what i
was doing.

//in the activity
InputStream filestream = null;
filestream = mCtx.getResources().openRawResource(R.raw.default_song);
Document songXml = parseSongAsset(filestream);
filestream.close();

//the method i used
public Document parseSongAsset(InputStream filestream ) {
try {

DocumentBuilder docBuilder = 
DocumentBuilderFactory.newInstance()
.newDocumentBuilder();
Document songXml = docBuilder.parse(filestream);
return songXml;
} catch (FileNotFoundException e) {


This is what i did to fix it

//in the activity
Document songXml = parseSongAsset();

//the method
protected Document parseSongAsset() {
try {
InputStream filestream = null;
filestream = mCtx.getResources().openRawResource
(R.raw.default_song);
DocumentBuilder docBuilder = 
DocumentBuilderFactory.newInstance()
.newDocumentBuilder();
Document songXml = docBuilder.parse(filestream);
return songXml;
} catch (FileNotFoundException e) {


Anyone got an idea why the the original would break things?

Thanks
Simon

On Aug 29, 2:40 pm, longhairedsi  wrote:
> Hi
>
> I've just changed my app to load an xml file from a raw resource
> instead of from the sdcard. Every time i run the app it now fails in a
> spectacular way. It just closes down, no exceptions. Log output is
> below.
>
> I'm not kidding, all i changed was the way an xml file is loaded. If
> change back and it's fine
>
> Please help!
>
> Cheers
> Simon
>
> 08-29 14:24:32.979: INFO/DEBUG(1236): *** *** *** *** *** *** *** ***
> *** *** *** *** *** *** *** ***
> 08-29 14:24:32.979: INFO/DEBUG(1236): Build fingerprint: 'tmeu/kila_eu/
> dream/trout:1.5/CRC37/150879:user/ota-rel-keys,release-keys'
> 08-29 14:24:32.979: INFO/DEBUG(1236): pid: 1710, tid: 1711  >>>
> com.basementajax.microjam <<<
> 08-29 14:24:32.979: INFO/DEBUG(1236): signal 11 (SIGSEGV), fault addr
> 0004
> 08-29 14:24:32.979: INFO/DEBUG(1236):  r0 0004  r1 40021800  r2
> 0004  r3 ad32aa45
> 08-29 14:24:32.979: INFO/DEBUG(1236):  r4   r5   r6
> ad344125  r7 4100afb8
> 08-29 14:24:32.989: INFO/DEBUG(1236):  r8 100ffcb0  r9 4100afb0  10
> 41a46450  fp 1071
> 08-29 14:24:32.989: INFO/DEBUG(1236):  ip ad36492c  sp 100ffc98  lr
> ad32aa4f  pc afb045a8  cpsr 0010
> 08-29 14:24:33.309: INFO/DEBUG(1236):          #00  pc 45a8  /
> system/lib/libcutils.so
> 08-29 14:24:33.309: INFO/DEBUG(1236):          #01  lr ad32aa4f  /
> system/lib/libandroid_runtime.so
> 08-29 14:24:33.319: INFO/DEBUG(1236): stack:
> 08-29 14:24:33.319: INFO/DEBUG(1236):     100ffc58  
> 08-29 14:24:33.319: INFO/DEBUG(1236):     100ffc5c  00197e80  [heap]
> 08-29 14:24:33.319: INFO/DEBUG(1236):     100ffc60  
> 08-29 14:24:33.319: INFO/DEBUG(1236):     100ffc64  00169140  [heap]
> 08-29 14:24:33.319: INFO/DEBUG(1236):     100ffc68  100ffcc8
> 08-29 14:24:33.329: INFO/DEBUG(1236):     100ffc6c  00197e80  [heap]
> 08-29 14:24:33.329: INFO/DEBUG(1236):     100ffc70  423907a0
> 08-29 14:24:33.329: INFO/DEBUG(1236):     100ffc74  00c1
> 08-29 14:24:33.329: INFO/DEBUG(1236):     100ffc78  40021800
> 08-29 14:24:33.329: INFO/DEBUG(1236):     100ffc7c  00c2
> 08-29 14:24:33.329: INFO/DEBUG(1236):     100ffc80  
> 08-29 14:24:33.339: INFO/DEBUG(1236):     100ffc84  
> 08-29 14:24:33.339: INFO/DEBUG(1236):     100ffc88  
> 08-29 14:24:33.339: INFO/DEBUG(1236):     100ffc8c  
> 08-29 14:24:33.339: INFO/DEBUG(1236):     100ffc90  df002777
> 08-29 14:24:33.349: INFO/DEBUG(1236):     100ffc94  e3a070ad
> 08-29 14:24:33.349: INFO/DEBUG(1236): #00 100ffc98  
> 08-29 14:24:33.349: INFO/DEBUG(1236):     100ffc9c  ad32aa4f  /system/
> lib/libandroid_runtime.so
> 08-29 14:24:33.359: INFO/DEBUG(1236):     100ffca0  100ffcd0
> 08-29 14:24:33.359: INFO/DEBUG(1236):     100ffca4  ad344135  /system/
> lib/libandroid_runtime.so
> 08-29 14:24:33.359: INFO/DEBUG(1236):     100ffca8  410a99d0
> 08-29 14:24:33.359: INFO/DEBUG(1236):     100ffcac  ad00e3b8  /system/
> lib/libdvm.so
> 08-29 14:24:33.359: INFO/DEBUG(1236):     100ffcb0  410a99d0
> 08-29 14:24:33.359: INFO/DEBUG(1236):     100ffcb4  000f7430  [heap]
> 08-29 14:24:33.369: INFO/DEBUG(1236):     100ffcb8  ad344125  /system/
> lib/libandroid_runtime.so
> 08-29 14:24:33.369: INFO/DEBUG(1236):     100ffcbc  40021800
> 08-29 14:24:33.369: INFO/DEBUG(1236):     100ffcc0  410a99d0
> 08-29 14:24:33.369: INFO/DEB

[android-developers] Re: Very nasty error for no reason

2009-08-29 Thread longhairedsi

Arggh! it seems to be a random error, it just happned again a few
times. If I debug and step through it works fine. If i run normally it
fails.

 the code fails when builder.create().show(); is called on the
dialogue

Here's the snippets( i'm using the template pattern to build different
loading objects)

in the activity packbuilder is the xml loader, buildJamPacks is the
method i am updating

private void showWelcomeMessage(){
if (mPackBuilder == null) {
mPackBuilder = new JamPackBuilderAssets(this);
mPackBuilder.buildJamPacks();
}
AlertDialog.Builder builder = new AlertDialog.Builder(this);
//builder.setTitle("Please choose a loop pack");
//builder.setIcon(R.drawable.alert_dialog_icon)
builder.setTitle("Welcome to MicroJam!");
builder.setMessage(R.string.instructions);
builder.setPositiveButton("Ok", new 
DialogInterface.OnClickListener
() {
public void onClick(DialogInterface dialog, int 
whichButton) {

openJamPack(mPackBuilder.getPack(0));//default 
pack House 1
}
});
builder.create().show();
}



//Working code:

// Loops through each folder in the root.
// Load the song definition file for each song(default_song.xml)
public void buildJamPacks() {
mJamPacks = new ArrayList();
File[] packs = new File(mRootFolder).listFiles();
int l = packs.length;
for (int i = 0; i < l; i++) {
File pack = packs[i];

File defaultSongFile = new 
File(pack.getAbsolutePath() + "/"
+ SONG_FILE_NAME);
if(defaultSongFile.exists()){
Document songXml = 
parseSongFile(defaultSongFile);
JamPack JamPack = 
buildPackFromXml(pack.getAbsolutePath(),
songXml);
mJamPacks.add(JamPack);
}else{

//TODO: handle this gracefully
}

}
}
 protected Document parseSongFile(File file) {
try {
DocumentBuilder docBuilder = 
DocumentBuilderFactory.newInstance()
.newDocumentBuilder();
InputStream fis = new FileInputStream(file);
Document songXml = docBuilder.parse(fis);
return songXml;
} catch (FileNotFoundException e) {


//Not working code
public void buildJamPacks() {
mJamPacks = new ArrayList();
AssetManager manager = mCtx.getAssets();
String[] packs;
try {
packs = manager.list(mLoopsDir);
int l = packs.length;
for (int i = 0; i < l; i++) {
String pack = packs[i];
String fullpath = mLoopsDir + "/" + pack ;

Document songXml = parseSongAsset();
JamPack JamPack = buildPackFromXml(fullpath, 
songXml);
mJamPacks.add(JamPack);
songXml = null;

}
}
catch(IOException e){
e.printStackTrace();
}
}


protected Document parseSongAsset() {
try {
InputStream filestream = null;
filestream = mCtx.getResources().openRawResource
(R.raw.default_song);
DocumentBuilder docBuilder =
DocumentBuilderFactory.newInstance()
.newDocumentBuilder();
Document songXml = docBuilder.parse(filestream);
return songXml;
} catch (FileNotFoundException e) {



Thanks, please help! this is driving me nuts ;)
Simon

On Aug 29, 3:15 pm, longhairedsi  wrote:
> Ok i found the problem. But don't ask my why this would cause a
> problem, I have no idea!
>
> It stems from me passing the inputstream into a method. This is what i
> was doing.
>
> //in the activity
> InputStream filestream = null;
> filestream = mCtx.getResources().openRawResource(R.raw.default_song);
> Document songXml = parseSongAsset(filestream);
> filestream.close();
>
> //the method i used
> public Document parseSongAsset(InputStream filestream ) {
>         try {
>
>                 DocumentBuilder docBuilder = 
> DocumentBuilderFactory.newInstance()
>                                 .newDocumentB

[android-developers] Re: Very nasty error for no reason

2009-08-29 Thread longhairedsi

Sorry, forgot to say that the method builds everything as expected,
when inspecting objects in the debugger the xml looks good the JamPack
looks good

Cheers
Simon

On Aug 29, 3:30 pm, longhairedsi  wrote:
> Arggh! it seems to be a random error, it just happned again a few
> times. If I debug and step through it works fine. If i run normally it
> fails.
>
>  the code fails when builder.create().show(); is called on the
> dialogue
>
> Here's the snippets( i'm using the template pattern to build different
> loading objects)
>
> in the activity packbuilder is the xml loader, buildJamPacks is the
> method i am updating
>
> private void showWelcomeMessage(){
>                 if (mPackBuilder == null) {
>                         mPackBuilder = new JamPackBuilderAssets(this);
>                         mPackBuilder.buildJamPacks();
>                 }
>                 AlertDialog.Builder builder = new AlertDialog.Builder(this);
>                 //builder.setTitle("Please choose a loop pack");
>                 //builder.setIcon(R.drawable.alert_dialog_icon)
>                 builder.setTitle("Welcome to MicroJam!");
>         builder.setMessage(R.string.instructions);
>                 builder.setPositiveButton("Ok", new 
> DialogInterface.OnClickListener
> () {
>                         public void onClick(DialogInterface dialog, int 
> whichButton) {
>
>                                 
> openJamPack(mPackBuilder.getPack(0));//default pack House 1
>                         }
>                 });
>                 builder.create().show();
>         }
>
> //Working code:
>
> // Loops through each folder in the root.
>         // Load the song definition file for each song(default_song.xml)
>         public void buildJamPacks() {
>                 mJamPacks = new ArrayList();
>                 File[] packs = new File(mRootFolder).listFiles();
>                 int l = packs.length;
>                 for (int i = 0; i < l; i++) {
>                         File pack = packs[i];
>
>                                 File defaultSongFile = new 
> File(pack.getAbsolutePath() + "/"
>                                         + SONG_FILE_NAME);
>                         if(defaultSongFile.exists()){
>                                 Document songXml = 
> parseSongFile(defaultSongFile);
>                                 JamPack JamPack = 
> buildPackFromXml(pack.getAbsolutePath(),
> songXml);
>                                 mJamPacks.add(JamPack);
>                         }else{
>
>                                 //TODO: handle this gracefully
>                         }
>
>                 }
>         }
>  protected Document parseSongFile(File file) {
>                 try {
>                         DocumentBuilder docBuilder = 
> DocumentBuilderFactory.newInstance()
>                                         .newDocumentBuilder();
>                         InputStream fis = new FileInputStream(file);
>                         Document songXml = docBuilder.parse(fis);
>                         return songXml;
>                 } catch (FileNotFoundException e) {
>
> //Not working code
> public void buildJamPacks() {
>                 mJamPacks = new ArrayList();
>                 AssetManager manager = mCtx.getAssets();
>                 String[] packs;
>                 try {
>                         packs = manager.list(mLoopsDir);
>                         int l = packs.length;
>                         for (int i = 0; i < l; i++) {
>                                 String pack = packs[i];
>                                 String fullpath = mLoopsDir + "/" + pack ;
>
>                                 Document songXml = parseSongAsset();
>                                 JamPack JamPack = buildPackFromXml(fullpath, 
> songXml);
>                                 mJamPacks.add(JamPack);
>                                 songXml = null;
>
>                         }
>                 }
>                 catch(IOException e){
>                         e.printStackTrace();
>                 }
>         }
>
> protected Document parseSongAsset() {
>         try {
>                 InputStream filestream = null;
>                 filestream = mCtx.getResources().openRawResource
> (R.raw.default_song);
>                 DocumentBuilder docBuilder =
> DocumentBuilderFactory.newInstance()
>                                 .newDocumentBuilder();
>                 Document songXml = docBuilder.parse(filestream);
>                 return songXml;
>         } catch (FileNotFoundException e) {
>
> Thanks, please help! thi

[android-developers] Re: Very nasty error for no reason

2009-08-29 Thread longhairedsi

Hi Diane,

I will post a bug report with example code after the developer
challenge monday deadline.

I've found the problem, it seems to be totaly unrelated, but this is
for sure where the problem comes from. I reverted project then added
code line by line.

This is where it went wrong: (this is in onCreate() )

Typeface face=Typeface.createFromAsset(getAssets(), "fonts/
ds_digi.ttf");
//mode.setTypeface(face);

When I comment out "mode.setTypeface(face);" the application fails.
When I put it back in the app works fine(or if I delete the whole
block)

The app does not fail at this point, but later on, in a seemingly
unrelated operation.

I can't believe i've spent 10 hours on this :(.  10 hours I could have
been improving my app.

Anyway, thats life I suppose! At least i can now finish it.

Thanks
Simon

On Aug 29, 5:30 pm, Dianne Hackborn  wrote:
> Could you please file a bug report with full code to reproduce?
>
> Also I know this is not going to be helpful at all, but I would really
> recommend staying away from DocumentBuilder -- it is a lot more overhead
> compared to directly parsing the XML.
>
> In fact, by far the most efficient way to parse an XML resource is to put it
> in res/xml, and retrieve it with Resources.getXml().  This can be literally
> a couple orders of magnitude faster than using a pull parser on a raw XML
> file.
>
> On Sat, Aug 29, 2009 at 7:30 AM, longhairedsi
> wrote:
>
>
>
>
>
> > Arggh! it seems to be a random error, it just happned again a few
> > times. If I debug and step through it works fine. If i run normally it
> > fails.
>
> >  the code fails when builder.create().show(); is called on the
> > dialogue
>
> > Here's the snippets( i'm using the template pattern to build different
> > loading objects)
>
> > in the activity packbuilder is the xml loader, buildJamPacks is the
> > method i am updating
>
> > private void showWelcomeMessage(){
> >                if (mPackBuilder == null) {
> >                        mPackBuilder = new JamPackBuilderAssets(this);
> >                        mPackBuilder.buildJamPacks();
> >                }
> >                AlertDialog.Builder builder = new AlertDialog.Builder(this);
> >                //builder.setTitle("Please choose a loop pack");
> >                //builder.setIcon(R.drawable.alert_dialog_icon)
> >                builder.setTitle("Welcome to MicroJam!");
> >        builder.setMessage(R.string.instructions);
> >                builder.setPositiveButton("Ok", new
> > DialogInterface.OnClickListener
> > () {
> >                        public void onClick(DialogInterface dialog, int
> > whichButton) {
>
> >  openJamPack(mPackBuilder.getPack(0));//default pack House 1
> >                        }
> >                });
> >                builder.create().show();
> >        }
>
> > //Working code:
>
> > // Loops through each folder in the root.
> >        // Load the song definition file for each song(default_song.xml)
> >        public void buildJamPacks() {
> >                mJamPacks = new ArrayList();
> >                File[] packs = new File(mRootFolder).listFiles();
> >                int l = packs.length;
> >                for (int i = 0; i < l; i++) {
> >                        File pack = packs[i];
>
> >                                File defaultSongFile = new
> > File(pack.getAbsolutePath() + "/"
> >                                        + SONG_FILE_NAME);
> >                        if(defaultSongFile.exists()){
> >                                Document songXml =
> > parseSongFile(defaultSongFile);
> >                                JamPack JamPack =
> > buildPackFromXml(pack.getAbsolutePath(),
> > songXml);
> >                                mJamPacks.add(JamPack);
> >                        }else{
>
> >                                //TODO: handle this gracefully
> >                        }
>
> >                }
> >        }
> >  protected Document parseSongFile(File file) {
> >                 try {
> >                        DocumentBuilder docBuilder =
> > DocumentBuilderFactory.newInstance()
> >                                        .newDocumentBuilder();
> >                         InputStream fis = new FileInputStream(file);
> >                        Document songXml = docBuilder.parse(fis);
> >                         return songXml;
> >                } catch (FileNotFoundException e) {
>
> > //Not working code
> > public void 

[android-developers] Problems with ADC upload

2009-08-31 Thread longhairedsi

Hi

I've been trying to upload my adc submission. I keep getting an error
saying "Upload a valid APK." can anyone elaborate on what this
means I've followed the checklist for publisihing and tested on my
g1 and it all seems fine. Why can't I upload? What constitutes as a
valid apk?

Thanks
Simon
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Problems with ADC upload

2009-08-31 Thread longhairedsi

Cheers for the input everyone.

In the end it turned out to be a weird upload permissions issue on my
vista machine. I've still not got to the bottom of it but I can't
upload any files to any website. I used a different(xp) machine and it
was fine.

Thanks
Simon


On Aug 31, 5:36 pm, RainBow  wrote:
> Sorry for "But if you tested it on your G1 it probably is..." pasting
> it before URL...it was by mistake.
>
> On Aug 31, 9:34 am, RainBow  wrote:
>
>
>
> > > But if you tested it on your G1 it probably is...
>
> > Beg to differ but being able to test/run on phone does not mean its
> > signed. I spent several hours to get this sorted and get a valid
> > signed apk.
>
> > I have posted the entire steps to do this correctly here: But if you
> > tested it on your G1 it probably is...
>
> >http://groups.google.com/group/android-developers/browse_thread/threa...
>
> > Also refer to three URLs that Mark has mentioned. They helped me
> > profoundly...
>
> > Btw, are you using windows? I found that on Windows the eclipse points
> > to jre rather than jdk version. Lastly, u need to export an unsigned
> > version of your app in eclipse before u feed it to jarsigner.
>
> > Good luck!!
>
> > On Aug 31, 6:10 am, fhucho  wrote:
>
> > > Is your app signed? But if you tested it on your G1 it probably is...
>
> > > On Aug 31, 2:26 pm, longhairedsi  wrote:
>
> > > > Hi
>
> > > > I've been trying to upload my adc submission. I keep getting an error
> > > > saying "Upload a valid APK." can anyone elaborate on what this
> > > > means I've followed the checklist for publisihing and tested on my
> > > > g1 and it all seems fine. Why can't I upload? What constitutes as a
> > > > valid apk?
>
> > > > Thanks
> > > > Simon- Hide quoted text -
>
> - Show quoted text -
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Hmm... at last ADC2 is out of our way ... tell about your app and experience

2009-09-02 Thread longhairedsi

Hi,

I got my app 'MicroJam' finished with 24 hours to spare but with a
hugley reduced feature set to my original plan. I've been working on
the app on and off in my spare time since january so I deceided to
make the ADC my deadline.

MicroJam is a simple loop based muic sequencer/remixer and my
experience of developing the app for the challange has been mixture of
happiness and pain. The main point of pain for me has been the time
taken to debug anything, even trivial changes to the code have to be
uploaded onto the device/emulator and then tested. This leads to a
very disjointed dev workflow(but I guess this must be the same for any
mobile develeopment). This problem was amplified by the fact I had
lots of audio files in my app. I got around this by adding my audio to
the sdcard and taking it out of the app but this then lead to big
problems down the line in the eleventh hour when i tried to bring them
back in again, see here 
http://dixonof.wordpress.com/2009/09/01/android-debuggerd-zombie/
.

But on the whole I've got a great sense of calm and happiness now I
got the thing submitted. I'm now gearing up for my next app which will
build on the foundations i've made with MicroJam.

I think i may be alone in this but I like the fact that I can't
make any more changes to the app now it's submitted. I can move on and
view any mods as the next version of my app which the maket users can
appreciate.

MicroJam will apear on the market sometime soon.

Simon

On Sep 2, 10:12 am, sleith  wrote:
> CraigsRace: what is Gonorrhea? i googled it and in wiki said its
> bacteria?
> hehe i choose that name because clapcard.com domain is available and
> the names resembles to the game i played when i was a kid. (dunno if
> in your country has it's game, it's by tossing card with friend, who
> got upside front win the game).
>
> On Sep 2, 3:09 pm, Lee  wrote:
>
>
>
> > Here's my submission blurb, any chance for self-promotion :-)
>
> > 
> > Tasker let's you link any Task (action set) to the Contexts
> > (application, time, day, location, event, widget press) where it
> > should run.
>
> > Send an SMS at 3:15 Monday, make per-app settings or locks, map camera
> > button to a menu, launch music app on headphone insert, timelapse
> > photos, encrypt on-the-fly, the list is endless!
> > -
>
> > Glad I didn't make a game now, seems to be a crowded category!
>
> > I'm grateful to Google for organising a fun competition but was a
> > little dissatisfied with not having enough time to develop and well-
> > test a non-trivial application from scratch. It's also not possible to
> > submit bugfixes after the deadline, and of course I'm discovering
> > hundreds every day now...
>
> > I had some test code for the location context which vibrates the phone
> > every time the coordinates change: forgot to take it out of course.
>
> > With 5 hours to go (2am in Europe) I found my widget icons were
> > disappearing after a few minutes for no apparent reason: it was comic
> > at first but became less so as time wore on and I couldn't fix it
> > (never did find it...)
>
> > Rud: bad luck, I was also worried about catching something in the last
> > few weeks, would have been a nightmare!
>
> > Lee- Hide quoted text -
>
> - Show quoted text -
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] sdcard in avd SDK 1.5

2009-04-28 Thread longhairedsi

Hello,

I've been trying to figure out how to use the sdcard that was
generated when I created the avd file for the emulator in SDK 1.5 r1.

In previous SDKs I set this in the Eclipse run configurations  -sdcard
c:\android\sd500m.img

I could then access the sdcard through DDMS etc.

How do i specify the sdcard that was created in the avd?

Cheers
Si


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] in TableRow

2009-05-06 Thread longhairedsi

Hi,

I have a problem trying use  within a table row. Any
android: atributes applied to the widget within the include are
ignored. Here's is a test I put together. The two buttons outside the
table layout render correctly(adjusted width and height), the one's
inside do not. Strangely, the custom TwoStateButton:x attributes
are rendered correctly in both cases.

-- main.xml 

http://schemas.android.com/apk/res/
android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>












--- custom_button.xml ---

http://schemas.android.com/apk/res/android";
xmlns:TwoStateButton="http://schemas.android.com/apk/res/
com.basementajax.tests"
android:layout_height="100dp"
android:layout_width="50dp"
TwoStateButton:onText="This is on"
TwoStateButton:offText="Off"
TwoStateButton:onBgId="@drawable/btn_red"
TwoStateButton:offBgId="@drawable/btn_red"
/>



 button_type2.xml -
http://schemas.android.com/apk/res/android";
android:layout_height="100dp"
android:layout_width="50dp"
/>

Can anyone shed any light on this? why will the buttons not render
correctly in the TableRow, have i missed something?

Many thanks
Simon
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: in TableRow

2009-05-11 Thread longhairedsi

Ok, I found a solution but I'm still not sure why this doesn't work.

I had to use within the included view

android:height="100dp"
android:width="50dp"

instead of

android:layout_height="100dp"
android:layout_width="50dp"

cheers
simon

On May 6, 10:56 pm, longhairedsi  wrote:
> Hi,
>
> I have a problem trying use  within a table row. Any
> android: atributes applied to the widget within the include are
> ignored. Here's is a test I put together. The two buttons outside the
> table layout render correctly(adjusted width and height), the one's
> inside do not. Strangely, the custom TwoStateButton:x attributes
> are rendered correctly in both cases.
>
> -- main.xml 
> 
> http://schemas.android.com/apk/res/
> android"
>     android:orientation="vertical"
>     android:layout_width="fill_parent"
>     android:layout_height="fill_parent"
>     >
>     
>     
>                          android:layout_width="wrap_content"
>                 android:layout_height="wrap_content"
>         >
>                 
>                          layout="@layout/custom_button" />
>                          layout="@layout/button_type2" />
>                 
>         
> 
>
> --- custom_button.xml ---
> 
>          xmlns:android="http://schemas.android.com/apk/res/android";
>         xmlns:TwoStateButton="http://schemas.android.com/apk/res/
> com.basementajax.tests"
>                 android:layout_height="100dp"
>                 android:layout_width="50dp"
>                 TwoStateButton:onText="This is on"
>         TwoStateButton:offText="Off"
>         TwoStateButton:onBgId="@drawable/btn_red"
>         TwoStateButton:offBgId="@drawable/btn_red"
>         />
>
> 
>
>  button_type2.xml -
>          xmlns:android="http://schemas.android.com/apk/res/android";
>         android:layout_height="100dp"
>         android:layout_width="50dp"
> />
>
> Can anyone shed any light on this? why will the buttons not render
> correctly in the TableRow, have i missed something?
>
> Many thanks
> Simon
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: how to use multitouch zoom

2010-03-04 Thread longhairedsi
Hi

Did you find an answer to this? I have the same requirement

Cheers
Si

On Mar 1, 4:32 pm, euromark  wrote:
> @Override
>                 public boolean onTouchEvent(MotionEvent event) {
>                         int numevents = event.getPointerCount();
>                         int action = event.getAction();
>
>                         // 1 = normal action (scroll); 2 = multitouch 
> (zoomin/out)
>                         Log.v("Zoom", "PointerCount=" + numevents);
>
>                         if (numevents == 2) {
>                                 switch (event.getAction()) {
>                                 case MotionEvent.ACTION_DOWN:
>                                         // Remember our initial down event 
> location.
>                                         startX = event.getRawX();
>                                         startY = event.getRawY();
>                                         break;
>
>                                 case MotionEvent.ACTION_MOVE:
>                                         float x = event.getRawX();
>                                         float y = event.getRawY();
>
>                                         //TODO: how to handlezoomin/out?
>
>                                         invalidate(); //force a redraw
>                                         break;
>                                 }
>
>                         } else {
>                                 switch (event.getAction()) {
>                                 case MotionEvent.ACTION_DOWN:
>                                         // Remember our initial down event 
> location.
>                                         startX = event.getRawX();
>                                         startY = event.getRawY();
>                                         break;
>
>                                 case MotionEvent.ACTION_MOVE:
>                                         float x = event.getRawX();
>                                         float y = event.getRawY();
>                                         scrollByX = x - startX; //move update 
> x increment
>                                         scrollByY = y - startY; //move update 
> y increment
>                                         startX = x; //reset initial values to 
> latest
>                                         startY = y;
>                                         invalidate(); //force a redraw
>                                         break;
>                                 }
>                         }
>
>                         return true; //done with this event so consume it
>                 }
>
> currently i can scroll around animage
> as soon as two fingers touch the display i want tozoomin/out 
> theimageaccording to the distance/speed
> my fingers moved towards each other or the opposite
> but i dont have a clue to to handle that
>
> currently i use a fullscreen bitmap:
>                         // Load a large bitmap into an offscreen area of 
> memory.
>                         bmLargeImage = 
> BitmapFactory.decodeResource(getResources(),
>                                         R.drawable.flour);
>
> is it even possible to smoothlyzoomin/out with it? or do i need sth
> like
>            image= context.getResources().getDrawable(R.drawable.{my pic});
>
> it should notzoomin too much (x < minZoomLevel etc) orzoomout too
> much (only one size - width or height - can get smaller than the
> display size)

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Re: Debugging on actual G1

2009-01-13 Thread longhairedsi

Hi chrispix,

Did you manage to solve this? i've followed all the steps and have
exactly the same problem

here's the relevent part of my log, I think "ERROR: thread attach
failed" must be the related problem, but not sure why?

01-13 22:38:14.829: ERROR/AndroidRuntime(1554): ERROR: thread attach
failed
01-13 22:38:14.879: INFO/ActivityManager(51): Start proc
com.basementajax.DroidMass for activity
com.basementajax.DroidMass/.DroidMass: pid=1571 uid=10055 gids={1006}
01-13 22:38:14.899: DEBUG/dalvikvm(1554): LinearAlloc 0x0 used 541332
of 4194304 (12%)
01-13 22:38:14.959: INFO/dalvikvm(1571): Ignoring DDM send req for
type=0x41504e4d len=38
01-13 22:38:14.999: INFO/dalvikvm(1571): Ignoring DDM send req for
type=0x41504e4d len=56
01-13 22:38:14.999: WARN/ActivityThread(1571): Application
com.basementajax.DroidMass is waiting for the debugger on port 8100...
01-13 22:38:15.019: INFO/System.out(1571): Sending WAIT chunk
01-13 22:38:15.029: INFO/dalvikvm(1571): Ignoring DDM send req for
type=0x57414954 len=1
01-13 22:38:15.379: INFO/ActivityManager(51): Stopping service:
com.android.vending/.PackageMonitorReceiver
$UpdateCheckinDatabaseService
01-13 22:38:24.771: WARN/ActivityManager(51): Launch timeout has
expired, giving up wake lock!
01-13 22:38:24.985: WARN/ActivityManager(51): Activity idle timeout
for HistoryRecord{4328ee50 {com.basementajax.DroidMass/
com.basementajax.DroidMass.DroidMass}}


On Dec 30 2008, 5:13 am, chrispix  wrote:
> Yes, It shows up in in DDMS, I can browse the file system, upload new
> applications, etc.
> When I go to debug mode the phone is just waiting on Debugger.
>
> Application myTest (process com.froogloid.android.myTest) is waiting
> for the debugger to attach.
>
> Here is output :
> 12-29 23:11:08.692: DEBUG/AndroidRuntime(20251): >>
> AndroidRuntime START <<
> 12-29 23:11:08.692: DEBUG/AndroidRuntime(20251): CheckJNI is OFF
> 12-29 23:11:09.552: DEBUG/AndroidRuntime(20251): --- registering
> native functions ---
> 12-29 23:11:09.562: INFO/jdwp(20251): received file descriptor 16 from
> ADB
> 12-29 23:11:11.782: DEBUG/PackageParser(51): Scanning package: /data/
> app/vmdl47559.tmp
> 12-29 23:11:12.132: WARN/PackageManager(51): Attempt to re-install
> com.froogloid.android.myTest without first uninstalling.
> 12-29 23:11:12.142: INFO/installd(35): unlink /data/dalvik-cache/
> d...@a...@vmdl47559@classes.dex
> 12-29 23:11:12.152: DEBUG/AndroidRuntime(20251): Shutting down VM
> 12-29 23:11:12.172: DEBUG/dalvikvm(20251): DestroyJavaVM waiting for
> non-daemon threads to exit
> 12-29 23:11:12.172: INFO/dalvikvm(20251): DestroyJavaVM shutting VM
> down
> 12-29 23:11:12.172: DEBUG/dalvikvm(20251): HeapWorker thread shutting
> down
> 12-29 23:11:12.182: DEBUG/dalvikvm(20251): HeapWorker thread has shut
> down
> 12-29 23:11:12.182: DEBUG/jdwp(20251): JDWP shutting down net...
> 12-29 23:11:12.182: DEBUG/jdwp(20251): +++ peer disconnected
> 12-29 23:11:12.182: INFO/dalvikvm(20251): Debugger has detached;
> object registry had 1 entries
> 12-29 23:11:12.182: DEBUG/dalvikvm(20251): VM cleaning up
> 12-29 23:11:12.242: DEBUG/dalvikvm(20251): LinearAlloc 0x0 used 529540
> of 4194304 (12%)
> 12-29 23:11:12.872: DEBUG/dalvikvm(51): GC freed 11890 objects /
> 617264 bytes in 714ms
> 12-29 23:11:12.882: VERBOSE/WifiMonitor(51): Event [CTRL-EVENT-SCAN-
> RESULTS  Ready]
> 12-29 23:11:13.142: DEBUG/AndroidRuntime(20261): >>
> AndroidRuntime START <<
> 12-29 23:11:13.142: DEBUG/AndroidRuntime(20261): CheckJNI is OFF
> 12-29 23:11:13.312: DEBUG/AndroidRuntime(20261): --- registering
> native functions ---
> 12-29 23:11:13.322: INFO/jdwp(20261): received file descriptor 16 from
> ADB
> 12-29 23:11:14.673: DEBUG/PackageParser(51): Scanning package: /data/
> app/vmdl47560.tmp
> 12-29 23:11:14.912: DEBUG/PackageManager(51): Removing package
> com.froogloid.android.myTest
> 12-29 23:11:14.912: DEBUG/PackageManager(51):   Activities:
> com.froogloid.android.myTest.myTest com.froogloid.android.myTest.Park
> com.froogloid.android.myTest.Find
> com.froogloid.android.myTest.FindList
> com.froogloid.android.myTest.CameraActivity
> com.froogloid.android.myTest.MapClass
> 12-29 23:11:14.912: DEBUG/PackageManager(51): Scanning package
> com.froogloid.android.myTest
> 12-29 23:11:14.922: INFO/PackageManager(51): /data/app/vmdl47560.tmp
> changed; unpacking
> 12-29 23:11:15.003: DEBUG/installd(35): DexInv: --- BEGIN '/data/app/
> vmdl47560.tmp' ---
> 12-29 23:11:15.842: DEBUG/dalvikvm(20269): DexOpt: load 59ms, verify
> 161ms, opt 2ms
> 12-29 23:11:15.922: DEBUG/installd(35): DexInv: --- END '/data/app/
> vmdl47560.tmp' (success) ---
> 12-29 23:11:15.992: DEBUG/PackageManager(51):   Activities:
> com.froogloid.android.myTest.myTest com.froogloid.android.myTest.Park
> com.froogloid.android.myTest.Find
> com.froogloid.android.myTest.FindList
> com.froogloid.android.myTest.CameraActivity
> com.froogloid.android.myTest.MapClass
> 12-29 23:11:17.582: VERBOSE/WifiMo

[android-developers] Re: Cupcake branch

2009-01-21 Thread longhairedsi

Hi,

I used the steps here:

http://ralf.alfray.com/.izumi/AndroidTips.blog

It is a bit fiddly though and you wont be able to complile it. I'm
think doing a dual boot of ubuntu is the way to go.

Cheers
Si

On Jan 21, 8:57 am, Tez  wrote:
> Hi,
>
> I am using a windows system. Can anyone send me steps on how to
> checkout the cupcake branch?
>
> Cheers,
> Earlence
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Why I cannot see my mail to the group?

2009-02-02 Thread longhairedsi

Hello,

I'm having the same problem, posted about 20 hours ago, still not
showing up. Lets see if this one arrives!

Cheers
Simon

On Feb 2, 8:48 am, "Jerry Yang"  wrote:
> Hi, all
>
> I have send some times, but still cannot see my mail in the group. Can
> anyone of you see it?
>
> Thanks
>
> With best wishes
>
> Jerry Yang
>
> Client System Engineer Intertrust.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Custom CompoundButton

2009-02-02 Thread longhairedsi

Hi,

I need to create a button that has on/off state using the background
graphic(drawable) to represent the current state. I think I need to
extend CompoundButton but I'm having trouble understanding how I set
the two background drawables for on and off. Can anyone shed some
light on this?

Cheers
Simon

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---