我無法回答在鉻的上下文中。但是,您基本上可以序列化您需要的內容,並通過意向系統將其發送到其他應用程序。
舉個例子,在你的第一個應用程序時,您會收到觸摸事件
boolean onTouch(MotionEvent event){
if(event.getActionMasked() == MotionEvent.ACTION_UP){
Intent startOtherApplication = new Intent();
startOtherApplication.putExtra("ACTION_UP_X",event.getX());
startOtherApplication.putExtra("ACTION_UP_Y",event.getY());
startOtherApplication.setComponent(new ComponentName("com.your.other.application", "com.your.other.application.ActivityYouWantToHandleTouch"));
startActivity(intent);
}
}
然後將提取您的其他應用程序的活動(ActivityYouWantToHandleTouch)的意圖。
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
Intent fetchedIntent = getIntent();
boolean hasUpAction = false;
int x = 0;
int y = 0;
if(fetchedIntent != null){
hasUpAction = (fetchedIntent.getExtra("ACTION_UP_X")!=null);
x = fetchedIntent.getExtra("ACTION_UP_X");
y = fetchedIntent.getExtra("ACTION_UP_Y");
}
}
在google上尋找「注入事件」和「可訪問性管理器」。 也看起來如何gamepad->觸摸屏事件幫助應用程序,如來自8bitdo的應用程序工作(轉儲它在一個反編譯器)。 –
@LassiKinnunen男人,我在找什麼,再次感謝 – Achayan