Deprecated type and basic demo launch tweaks


#1

Hi Jules,

I've just started to play around with Juce and find it an amazing tool. Congrats on this fantastic piece of work !

Just FYI I have compiled the Hello World demo (first things first...), and found that it is using deprecated type ClipboardManager.

At least this is what Eclipse tells me...

I am using Eclipse Platform 4.2.1, with ADT 22.0.5 and NDK r9d (64-bit) under Mac OSX 10.9.2.

I also had to modify AndroidManifest.xml to reflect more recent Android platforms and manually add icon files ("ic_launcher.png" see below; couldn't find a way to add them in IntroJucer, only choice is "<none>") in the res folder:

  <uses-sdk android:minSdkVersion="11" android:targetSdkVersion="19"/>

  <application android:label="@string/app_name" android:icon="@drawable/ic_launcher" android:allowBackup="false">

For some reason I had to quit Eclipse and restart it in order to be able to link and upload the app onto a connected Samsung phone and then finally managed to launch the app on the phone. Launching the app on the mac was more straightforward...

Just wanted to share the info in case it helps you or someone else.

Thanks again for your outstanding work.
Alan.

P.S. I should probably have created separate topics for the various points above. Sorry about that...


#2

Thanks!

Sigh.. must have just become deprecated in the latest SDK release, which I've not tried yet. Thanks for the heads-up, I'll sort that out when I next upgrade, it's quite a plate-spinning act to keep up to date with all the speed that the OSX/iOS and Android APIs change.


#3

Alan, I think that if you add an icon (e.g. a png) to the Resources in Introjucer then it should come up as an option in the icon drop down.


#4

Yeah I know. Thanks. This was my first time working with JUCE and I was a bit impatient as there are so many details to work on with this wonderful tool. Since then I have discovered a LOT of things using JUCE...

Thanks again for taking the time to answer, though.

P.S. Having said that, I have not managed to get JUCE to modify the manifest file with the correct icon name for some reason. Probably me not being savvy (yet ?)...


#5

The following works for android versions starting with Honeycomb (no more warnings):

    public final String getClipboardContent()

    {

        android.content.ClipboardManager clipboard = (android.content.ClipboardManager) getSystemService (CLIPBOARD_SERVICE);

        return clipboard.getPrimaryClip().toString();

    }


    public final void setClipboardContent (String newText)

    {

        android.content.ClipboardManager clipboard = (android.content.ClipboardManager) getSystemService (CLIPBOARD_SERVICE);

        android.content.ClipData clip = android.content.ClipData.newPlainText("Text Label",newText);

        clipboard.setPrimaryClip(clip);

    }

You can then remove the import file as well.


#6

Thanks - but are there people still building for pre-honeycomb versions..?


#7

What I was saying is that this code will work (without warnings) for all versions *after* Honeycomb. So if you believe this is sufficient, all you have to do is to paste this into your next JuceAppActivity.java release (I think). This will avoid getting annoying warnings as Alan said.

If you wanted to support pre-Honeycomb (which apparently is not the case) you would have to use an IF directive or something equivalent to test the Android version.