我尝试创建一个应用程序来管理和更改移动设备上安装的其他应用程序。我知道如何打开我的其他应用程序。我想找到一种方法来阅读别人的应用程序api并在后台管理它们,比如Android的api由Android提供的闹钟。
更具体一点:
我有我的应用程序和其他制作披萨的应用程序。
package com.ppapadop.pizzatime;
import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
public class MainActivity extends Activity {
Button addButton, removeButton, showButton;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
addButton = (Button)findViewById(R.id.addButton);
removeButton = (Button)findViewById(R.id.removeButton);
showButton = (Button)findViewById(R.id.showButton);
}
public void addPizza(View v)
{
// Load new activity to add pizza
}
public void removePizza(View v)
{
// Load new activity to remove pizza
}
public void showPizza(View v)
{
// Load new activity to show pizza
}
}
所以我想得到并使用这些方法(addPizza,removePizza,showPizza),就像我用于闹钟一样:
public void runAlarmAction(String actionString) {
StringTokenizer st = new StringTokenizer(actionString, "-");
Intent addAlarm = new Intent(AlarmClock.ACTION_SET_ALARM);
addAlarm.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
addAlarm.putExtra(AlarmClock.EXTRA_MESSAGE, st.nextToken());
addAlarm.putExtra(AlarmClock.EXTRA_HOUR, Integer.parseInt(st.nextToken()));
addAlarm.putExtra(AlarmClock.EXTRA_MINUTES, Integer.parseInt(st.nextToken()));
addAlarm.putExtra(AlarmClock.EXTRA_SKIP_UI, true);
gContext.startActivity(addAlarm);
}