Recent

Author Topic: Android Module Wizard  (Read 707523 times)

Fatih KILIÇ

  • New Member
  • *
  • Posts: 23
Turkish Character View Problem
« Reply #135 on: July 09, 2014, 10:54:30 am »
Hi,

When I set jTextView.Text property by turkish characters set, the characters's view is incorrect. Is this a bug?

How do I solve this problem?

Note: The .pas file is saved in UTF8 format.

Code: [Select]
jTextView.Text := 'İETT Otobüs Sefer Bilgisi (iettosb), İETT''nin yurt içi taşımacılığı...';

Screen View:
İETT Otobüs Sefer Bilgisi (iettosb), İETT''nin yurt içi taşımacılığı' +

tk

  • Sr. Member
  • ****
  • Posts: 361
Re: Android Module Wizard
« Reply #136 on: July 09, 2014, 02:02:54 pm »
Source file encoding must be UTF8. Try with our without BOM. Debug in assembly. Check if there is no conversion routine called like fpc_ansi_str* or similar.
« Last Edit: July 09, 2014, 02:06:51 pm by tk »

Fatih KILIÇ

  • New Member
  • *
  • Posts: 23
Re: Android Module Wizard
« Reply #137 on: July 09, 2014, 02:37:27 pm »
Thanks tk. As you said, I removed related section and problem solved.

File: Laz_And_Controls.pas

Code: [Select]
Procedure jTextView.SetText(Value: string);
begin
  FText:= Value; //utf8encode(Value);  // Removed.
  if FInitialized then
    jTextView_setText2(jForm(Owner).App.Jni.jEnv, jForm(Owner).App.Jni.jThis, FjObject, FText);
end;

Fatih KILIÇ

  • New Member
  • *
  • Posts: 23
Get/Set Data
« Reply #138 on: July 23, 2014, 09:33:48 pm »
Hi, jmpessoa.

1. Can you adapt below java code or improved related function to the Android Module Wizard in the fashion GetIntData, SetIntData, GetStringData, SetStringData, GetBoolData, SetBoolData?

2. Can you add GPS component to the Android Module Wizard?

Thanks.

Code: [Select]
private static int getIntData(Context context, String Key, int defValue) {

SharedPreferences sPref = PreferenceManager
.getDefaultSharedPreferences(context);

return sPref.getInt(Key, defValue);
}

private static void setIntData(Context context, String Key, int Value) {

SharedPreferences sPref = PreferenceManager
.getDefaultSharedPreferences(context);

SharedPreferences.Editor edt = sPref.edit();
edt.putInt(Key, Value);
edt.commit();
}

private static String getStringData(Context context, String Key, String defValue) {

SharedPreferences sPref = PreferenceManager
.getDefaultSharedPreferences(context);

return sPref.getString(Key, defValue);
}

private static void setStringData(Context context, String Key, String Value) {

SharedPreferences sPref = PreferenceManager
.getDefaultSharedPreferences(context);

SharedPreferences.Editor edt = sPref.edit();
edt.putString(Key, Value);
edt.commit();
}

private static boolean getBoolData(Context context, String Key, boolean defValue) {

SharedPreferences sPref = PreferenceManager
.getDefaultSharedPreferences(context);

return sPref.getBoolean(Key, defValue);
}

private static void setBoolData(Context context, String Key, boolean Value) {

SharedPreferences sPref = PreferenceManager
.getDefaultSharedPreferences(context);

SharedPreferences.Editor edt = sPref.edit();
edt.putBoolean(Key, Value);
edt.commit();
}

jmpessoa

  • Hero Member
  • *****
  • Posts: 2301
Re: Android Module Wizard
« Reply #139 on: July 23, 2014, 11:42:55 pm »
Ok Fatih , I will try!

Thank you!
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

jmpessoa

  • Hero Member
  • *****
  • Posts: 2301
Re: Android Module Wizard
« Reply #140 on: August 18, 2014, 06:10:31 am »
Hi All!

There is an updated version of "Android Module Wizard"

      :: New jLocation Component: Add Partial Support for Location Object //<<---- A suggestion and request by Fatih KILIÇ

      :: New jPreference Component: Add Partial Support for Preferences Object //<<---- A suggestion and request by Fatih KILIÇ

      :: NEW AppLocationDemo [Eclipse Project]  --- see picture attached


ref. https://github.com/jmpessoa/lazandroidmodulewizard

Thanks to All!
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

Leledumbo

  • Hero Member
  • *****
  • Posts: 8757
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Android Module Wizard
« Reply #141 on: August 18, 2014, 06:29:35 am »
Hi All!

There is an updated version of "Android Module Wizard"

      :: New jLocation Component: Add Partial Support for Location Object //<<---- A suggestion and request by Fatih KILIÇ

      :: New jPreference Component: Add Partial Support for Preferences Object //<<---- A suggestion and request by Fatih KILIÇ

      :: NEW AppLocationDemo [Eclipse Project]  --- see picture attached


ref. https://github.com/jmpessoa/lazandroidmodulewizard

Thanks to All!
Congratulations! How's the GUI designer progress?

Fatih KILIÇ

  • New Member
  • *
  • Posts: 23
Re: Android Module Wizard
« Reply #142 on: August 20, 2014, 10:02:31 am »
Thanks jmpessoa for taking valuable time.

Become a beautiful work.

I wish you continued efforts.

jmpessoa

  • Hero Member
  • *****
  • Posts: 2301
Re: Android Module Wizard
« Reply #143 on: September 02, 2014, 09:16:21 pm »
Hi!

Code: [Select]
...How's the GUI designer progress?
I'm still working .... you can already see some results [attached figures]

Thanks!
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

Fatih KILIÇ

  • New Member
  • *
  • Posts: 23
Re: Android Module Wizard
« Reply #144 on: September 04, 2014, 11:51:00 am »
Hi.

Q1.
My there are two form. First form (TAndroidModule1) opens second form (TAndroidModule3). Second form must result value to the first form. Below codes is insufficient. How two form are synchronize the value? (global.SelectedHat)

Form1
Code: [Select]
procedure TAndroidModule1.DataModuleClickContextMenuItem(Sender: TObject;
  jObjMenuItem: jObject; itemID: integer; itemCaption: string; checked: boolean
  );
begin

  if(itemID = 10) then
  begin

    if(AndroidModule3 = nil) then
    begin

      gApp.CreateForm(TAndroidModule3, AndroidModule3);
      AndroidModule3.Init(gApp);
    end else AndroidModule3.Show;
  end;

  // global variable
  edtHat.Text := global.SelectedHat;
end;

Form2
Code: [Select]
procedure TAndroidModule3.jListView1ClickCaptionItem(Sender: TObject;
  Item: integer; caption: string);
begin

  // global variable
  global.SelectedHat := caption;

  Close;
end;

Q2:
Second problem is when add item jListView above 512 the program is crach. Error is: "E/dalvikvm(3819): Failed adding to JNI local ref table (has 512 entries)"

How resolve these problem. Thanks.

jmpessoa

  • Hero Member
  • *****
  • Posts: 2301
Re: Android Module Wizard
« Reply #145 on: September 06, 2014, 05:34:05 am »
Hi Fatih,

Q1. :: I Added Unit "global" for TAndroidModule1 unit AND for TAndroidModule3 unit: my test was OK!!!

Q2: In line "6355" of  "And_jni_Bridge.pas", See my code and the FIX:

Code: [Select]
Procedure jListView_add2(env:PJNIEnv;this:jobject; ListView: jObject; Str: string; delimiter: string);
var
  _jMethod: jMethodID = nil;
  _jParams: array[0..1] of jValue;
  cls: jClass;
begin
  _jParams[0].l := env^.NewStringUTF(env, pchar(Str) );
  _jParams[1].l := env^.NewStringUTF(env, pchar(delimiter) );
  cls := env^.GetObjectClass(env, ListView);
  _jMethod:= env^.GetMethodID(env, cls, 'add2', '(Ljava/lang/String;Ljava/lang/String;)V');
  env^.CallVoidMethodA(env,ListView,_jMethod,@_jParams);
  env^.DeleteLocalRef(env,_jParams[0].l);
  env^.DeleteLocalRef(env,_jParams[1].l);
  env^.DeleteLocalRef(env, cls);  // <---- Added this for bug fix! 09-Sept-2014 [Thanks to  @Fatih!]
end;   

Please, do this for others jListView_add* too!

Thank you!
« Last Edit: September 06, 2014, 05:40:15 am by jmpessoa »
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

Fatih KILIÇ

  • New Member
  • *
  • Posts: 23
Re: Android Module Wizard
« Reply #146 on: September 06, 2014, 10:16:07 am »
Thanks jmpessoa

jListView1.Add problem is solved. Also i'm waiting updated lazandroidmodule for global unit.

A suggestion: improving of ListView widget will helpful.

jmpessoa

  • Hero Member
  • *****
  • Posts: 2301
Re: Android Module Wizard
« Reply #147 on: September 06, 2014, 02:09:32 pm »
Hi Fatih, about Q1:

No, there will be NO update for global unit .... I just tried to redo the path that you were trying to do .... and managed to get the expected result! For test  I just used this code:

Code: [Select]
unit Global;

{$mode delphi}

interface

uses
  Classes, SysUtils;

var

  SelectedHat: string;

implementation

end.

Thank you!
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

Fatih KILIÇ

  • New Member
  • *
  • Posts: 23
Re: Android Module Wizard
« Reply #148 on: September 07, 2014, 10:13:18 am »
Hi, jmpessoa

When I click TAndroidModule3.jListView (TAndroidModule3.jListView1ClickCaptionItem) the Form2 (TAndroidModule3) is closed, global.SelectedHat variable is empty and edtHat.Text (jEditText) control value is showing blank value.

I think there are synchronize problem? I could not find a solution.

Thank you.

jmpessoa

  • Hero Member
  • *****
  • Posts: 2301
Re: Android Module Wizard
« Reply #149 on: September 07, 2014, 08:52:28 pm »
Hi Fatih, please, try this:
 
Code: [Select]
Unit3

interface
 
............................
............................

implementation

uses Unit1;   //< ------ put it!

procedure TAndroidModule3.jListView1ClickCaptionItem(Sender: TObject;
  Item: integer; caption: string);
begin

  // global variable
  global.SelectedHat := caption;

  Unit1.edtHat.Text := global.SelectedHat;  ////< ------ put it!

  Close;
end;

Thank you!

PS. As soon as possible, I will try a more architectural synchronization solution!

EDITED: Ok, here's a more elegant solution:

Code: [Select]
TAndroidModule1 = class(jForm)

    private
      {private declarations}
    public
      {public declarations}
      Procedure MyCallBack(Sender: TObject);  //<--- your call back function!
end; 

implementation

Procedure TAndroidModule1.MyCallBack(Sender: TObject);
begin
   jEditText1.Text:= global.SelectedHat;
end; 

procedure TAndroidModule1.DataModuleClickContextMenuItem(Sender: TObject;
  jObjMenuItem: jObject; itemID: integer; itemCaption: string; checked: boolean);
begin

  if(itemID = 10) then
  begin

    if(AndroidModule3 = nil) then
    begin
        gApp.CreateForm(TAndroidModule3, AndroidModule3);
        AndroidModule3.SetCloseCallBack(MyCallBack, nil);  //<<-- [delphi sintaxe mode]!
        AndroidModule3.Init(gApp);
    end else AndroidModule3.Show;
  end;

  // global variable
  //edtHat.Text := global.SelectedHat; //<<---- this line never was called!
end;


Thank you!
« Last Edit: September 08, 2014, 03:36:05 am by jmpessoa »
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

 

TinyPortal © 2005-2018