小编Sim*_*was的帖子

如何在我的应用程序上为所有手机调用android计算器

  public static final String CALCULATOR_PACKAGE ="com.android.calculator2";
  public static final String CALCULATOR_CLASS ="com.android.calculator2.Calculator";
  Intent intent = new Intent();

    intent.setAction(Intent.ACTION_MAIN);
         intent.addCategory(Intent.CATEGORY_LAUNCHER);
        intent.setComponent(new ComponentName(
         CALCULATOR_PACKAGE,
         CALCULATOR_CLASS));
Run Code Online (Sandbox Code Playgroud)

以上仅适用于HTC

  public static final String CALCULATOR_PACKAGE ="com.sec.android.app.popupcalculator";
  public static final String CALCULATOR_CLASS ="com.sec.android.app.popupcalculator.Calculator";
Run Code Online (Sandbox Code Playgroud)

以上适用于S3

我需要一个适用于所有这些代码的代码.谁有任何线索?请举一个示例代码

android android-intent

13
推荐指数
1
解决办法
2万
查看次数

如何让下载管理器覆盖现有文件,而不是重命名android中的文件

我有一个数据库文件,它位于SD卡上,现在当下载一个新的数据库文件时,我需要它覆盖旧的数据库而不是重命名它是我的下载代码.下载代码完美运行..

  public void startDownload() {
        pDialog = new ProgressDialog(this);
        pDialog.setMessage("Downloading Database. Please wait...");
        pDialog.setIndeterminate(false);
        pDialog.setMax(100);
        pDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
        pDialog.setCancelable(false);

    Uri uri=Uri.parse(file_url);

    String baseDir = Environment.getExternalStorageDirectory().getAbsolutePath();
    File ADirectory = new File(baseDir +"/test");
    ADirectory.mkdirs();

    lastDownload=
      mgr.enqueue(new DownloadManager.Request(uri)
                  .setAllowedNetworkTypes(DownloadManager.Request.NETWORK_WIFI |
                                          DownloadManager.Request.NETWORK_MOBILE)
                  .setAllowedOverRoaming(false)
                  .setTitle(" Database File")
                  .setDescription("Please wait....test Database downloading.")
                  .setDestinationInExternalPublicDir("/test", "/testing"));

    pDialog.show();
    //v.setEnabled(false);
   // findViewById(R.id.query).setEnabled(true);
  } 
Run Code Online (Sandbox Code Playgroud)

android

10
推荐指数
1
解决办法
8747
查看次数

标签 统计

android ×2

android-intent ×1