Итак, вот результат моих потуг
antareyToast.java
package com.antarey;
import android.content.Context;
import android.os.Handler;
import android.os.Looper;
import android.widget.Toast;
public class antareyToast {
private Context context;
private Handler mHandler = new Handler(Looper.getMainLooper());
private String mMsg;
public antareyToast(Context context) {
this.context = context;
}
public void ShowToast(String msg)
{
mMsg = msg;
mHandler.post(new Runnable() {
public void run() {
Toast.makeText(context, mMsg, Toast.LENGTH_SHORT).show();
}
});
}
}
обертка
unit com.antarey.antareyToast;
interface
uses
FMX.Helpers.Android,
Androidapi.Helpers,
AndroidAPI.JNIBridge,
Androidapi.JNI.JavaTypes,
Androidapi.JNI.GraphicsContentViewText,
Androidapi.JNI.os;
type
JantareyToast = interface;
JantareyToastClass = interface(JObjectClass)
['{C4BED43A-7A25-43F2-A9BE-B2E1602FB2D8}']
function init(JContextparam0 : JContext) : JantareyToast; cdecl;
end;
[JavaSignature('com/antarey/antareyToast')]
JantareyToast = interface(JObject)
['{5AFABA34-5223-424D-A381-5F61E4B67B53}']
procedure ShowToast(JStringparam0 : JString) ; cdecl;
end;
TJantareyToast = class(TJavaGenericImport<JantareyToastClass, JantareyToast>)
end;
procedure ShowToast(ToastMsg: String);
implementation
procedure ShowToast(ToastMsg: String);
var
Activity:JantareyToast;
begin
Activity:= TJantareyToast.JavaClass.init(SharedActivityContext);
Activity.ShowToast(StringToJString(ToastMsg));
end;
procedure RegisterTypes;
begin
TRegTypes.RegisterType('com.antarey.antareyToast',TypeInfo(com.antarey.antareyToast.JantareyToast));
end;
initialization
RegisterTypes;
end.
вызов
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
ShowToast( UnicodeString(_D("Ура!!!! - Получилось")) );
}
//---------------------------------------------------------------------------
Все работает.
Более подробно читаем тут
Но ето только один из методов, использовать стандартные библиотеки немного проще, проще в том что не надо писать ява код самому, а обертки есть уже готовые