Sunday 3 January 2016

Some Delphi and C++Builder articles

My blog editor of choice is proving to be a little quisquous at the moment.

Historically I have used Windows LiveWriter, part of Windows Essentials (whose development stopped in 2012, but was still available here (web installer) and here (offline installer)). This worked well, but at some point over the summer it stopped working with the uprated authentication requirements of Google’s Blogger. Fortunately though, it has just been open-sourced and is now available as Open Live Writer here.

However while one issue I immediately hit with this new version has been fixed, I have still yet to successfully connect to my blog with Open Live Writer. Fingers crossed….

So until the initial set of issues are worked out I’ll post articles and link to them by short manually entered blog entries here.

This post is mostly to point at a short article I’ve put together that brings to the attention of those who are interested the easy means to lessen the size of your Windows application’s executable file.

You can find the article here: Trimming The Fat - Smaller Windows .exe Sizes With Delphi And C++Builder.

[Update 20150105: I've made some changes to the advice in the Trim the Fat article (clearly marked) after some input came through from a helpful reader.]

Before signing off I want to mention a couple of other posts that recently caught my eye:

Daniele Spinetti has very recently worked out the solution to a bug he encountered with Android background services in Delphi 10 Seattle, which meant that the TLocationSensor component doesn’t function when used in an Android service data module. The problem has been identified and described in his (very) recent post. This will be a useful addition to those trying to use Android services to accompany Jim McKeeth’s offerings:

Daniele also has a post showing how to use AdMob insterstitial adverts in Android apps as an alternative to regular banner ads.

Some posts from Chee Wee also stood out as interesting:

Happy New Year!

7 comments:

  1. Hi. This code not work delphi. Where am I doing wrong?

    RelativeLayoutParams := TJRelativeLayout_LayoutParams.JavaClass.init(Integer(100), Integer(100));
    RelativeLayout := TJRelativeLayout.JavaClass.init(SharedActivity);
    RelativeLayout.setLayoutParams(RelativeLayoutParams);

    TextView := TJTextView.JavaClass.init(SharedActivity);
    TextView.setText(StrToJCharSequence('Native TextView'));
    TextView.setTextColor(TJColor.JavaClass.BLACK);
    TextView.setTextSize(20);
    TextView.setLines(1);
    TextView.setLayoutParams(RelativeLayoutParams);

    RelativeLayout.addView(TextView);

    NativeLayout := TJNativeLayout.JavaClass.init(SharedActivity,
    MainActivity.getTextEditorProxy.getWindowToken);
    NativeLayout.SetPosition(50, 50);
    NativeLayout.SetSize(100, 100);
    NativeLayout.SetControl(RelativeLayout);
    NativeLayout.SetFocus(true);

    ReplyDelete
  2. Hello. What are you trying to achieve? Where is this code placed? In what way does it not work? Is there a relevance to you commenting on this post? Have you tried other things? What led you to try this code? I'm a little short on info here, even if I knew anything about the correct way to achieve whatever it is you are trying to achieve.

    ReplyDelete
    Replies
    1. Hi. I would like to add Jni components. I do not work codes.

      Delete
    2. Hello Ali. JNI is the protocol used for native code (such as Delphi code) and Java code (such as Android code) to interact. There are many examples of using JNI around on the web. To be honest I don't really understand what you are looking to do - you;re not really giving any detail or good indication of what you are trying to achieve. For all the questions I asked just above, I'm not sure you;ve addressed many of them.

      Delete
    3. This comment has been removed by the author.

      Delete
    4. Hi.

      unit VideoView;

      interface

      uses
      System.SysUtils,
      FMX.Types,
      FMX.Helpers.Android,
      Androidapi.Helpers,
      Androidapi.JNI.App,
      Androidapi.JNI.Net,
      Androidapi.JNI.VideoView,
      Androidapi.JNI.Widget;

      type
      TVideoView = class(TObject)
      private
      FDialog: JDialog;
      FVideoView: JVideoView;
      public
      procedure Play(Source: string);
      end;

      implementation

      { TVideoView }

      procedure TVideoView.Play(Source: string);
      begin
      CallInUIThread(
      procedure
      begin
      FDialog := TJDialog.JavaClass.init(TAndroidHelper.Activity, -1);
      FDialog.setCancelable(True);

      FVideoView := TJVideoView.JavaClass.init(TAndroidHelper.Activity);
      FVideoView.setVideoURI(StrToJURI(Source));
      FVideoView.start;

      FDialog.setContentView(FVideoView);
      FDialog.show;
      end);
      end;

      end.

      Delete
    5. Sweet! I take it this works, and you worked through the issues that were troubling you? If so, then bravo! Thanks for posting the fruits of your labour.

      Delete