我无法从Linux Mint 17.1 Cinnamon上创建的.desktop启动器启动python脚本.
问题是脚本将在错误的路径中启动 - 即主文件夹而不是它所在的目录.因此,它无法在其文件夹中找到伴随它的其他重要文件,因此无法正常工作.
为了检查这种不当行为,我创建了一个简短的脚本来检查python脚本正在执行的文件夹:
#!/usr/bin/env python
import subprocess
import time
subprocess.call(["pwd"], shell=True)
time.sleep(7) # to get a chance to read the output
Run Code Online (Sandbox Code Playgroud)
从它自己的文件夹执行它给出输出:
/home/myusername/PythonProjects
Run Code Online (Sandbox Code Playgroud)
我正在通过Nemo的菜单设置桌面启动器.现在执行相同的脚本会产生:
/home/myusername
Run Code Online (Sandbox Code Playgroud)
我不明白这种行为.我怎么能为我的python脚本创建一个工作桌面启动器?
我正在尝试将JRE与我的jar文件捆绑在一起,以便我可以在任何Windows计算机上运行我的应用程序,无论它是否具有Java.jsmooth手册说:
For the option to work correctly, you have to put a JRE in a directory near the EXE (generally in a subdirectory called "jre" or whatever). Once the exe is generated, it will FIRST try to locate the JRE at the location mentioned. If it can't be found there, then it will fallback in the normal jre look-up mode (search for a jre or a jdk in the Windows registry or in commonly-used environment variables). There is no JVM-version …
我正在尝试为Android中的一个Activity创建一个桌面快捷方式.我使用的代码在我读过的每个tuto示例中都有效:
final Intent shortcutIntent = new Intent(Intent.ACTION_MAIN);
ComponentName name = new ComponentName(getPackageName(), ".MyActivity");
shortcutIntent.setComponent(name);
shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
final Intent intent = new Intent();
intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, "blabla");
intent.putExtra(Intent.EXTRA_SHORTCUT_ICON, icon);
intent.setAction("com.android.launcher.action.INSTALL_SHORTCUT");
sendBroadcast(intent);
finish();
Run Code Online (Sandbox Code Playgroud)
我将MAIN操作添加到我的活动中:
<activity android:label="@string/app_name" android:name=".MyActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
Run Code Online (Sandbox Code Playgroud)
结果是应用程序不想启动!
在Logcat中,一切似乎都很好:
10-01 01:17:51.591: INFO/ActivityManager(2424): Starting activity: Intent { act=android.intent.action.MAIN flg=0x14000000 cmp=my.package.name/.MyActivity bnds=[125,384][235,522] (has extras) }
Run Code Online (Sandbox Code Playgroud)
Home告诉我应用程序未安装.
请帮助我,我完全迷失了,花了几个小时试图解决问题并阅读我能得到的所有信息.
非常感谢!
我目前正在开发一个Android应用程序,然后我以编程方式编写主屏幕的快捷方式.像这样的东西:
Intent shortcutIntent = new Intent();
shortcutIntent.setClassName(ai.packageName, ai.name);
shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
shortcutIntent.addCategory(Intent.ACTION_PICK_ACTIVITY);
Intent intent = new Intent();
intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, appName);
BitmapDrawable bd=(BitmapDrawable)(res.get(app_id).activityInfo.loadIcon(p).getCurrent());
Bitmap newbit;
newbit=bd.getBitmap();
intent.putExtra(Intent.EXTRA_SHORTCUT_ICON, newbit);
intent.setAction("com.android.launcher.action.INSTALL_SHORTCUT");
context.sendBroadcast(intent);
Run Code Online (Sandbox Code Playgroud)
(它实际上是一个StackOverflow帖子,指向我这个解决方案).
无论如何,当我在模拟器中运行应用程序时,快捷方式将从左侧(在2.3主屏幕上)写入第五页.后续运行将快捷方式写入主屏幕左侧的第4页.
我的问题是:有没有办法将快捷方式写入中心页面或第一页(比如传递似乎拥有应用程序快捷方式的二维数组的索引)?我错过了API中的内容吗?
谢谢!
我有一个没有启动器活动的应用程序,从Android 1.5到Android 2.3.4正常工作.它由我的广播接收器启动.但是,在Honeycomb(摩托罗拉Xoom)上,我的广播接收器根本不起作用(它没有捕获任何意图).如果我在我的清单中添加启动器活动:
<activity android:label="@string/app_name" android:name="com.myapp.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" /> </intent-filter>
</activity>
Run Code Online (Sandbox Code Playgroud)
然后我的应用程序正常工作(广播接收器捕获所有必要的意图并启动我的服务).
我非常感谢你的帮助!
android launcher broadcastreceiver android-3.0-honeycomb xoom
我想创建一个类似于Android中的本机Messaging应用程序的启动器图标.此应用程序的图标具有图像,但也具有动态变化的数字(某种计数器对应于未读消息的数量).此图标也不是小部件,因为它是应用程序抽屉中的实际图标.
有人可以向我解释我如何才能实现这一目标吗?我找到了一些解决方案,其中包含尺寸设置为1x1的小部件,但我不希望人们将我的应用程序的快捷方式添加为小部件.如果可能的话,我想以一些程序化的方式操纵启动器图标.
提前致谢!
注意:很久以前有一个类似我的问题.但是,从那时起看到Android API经历了很多变化,旧答案可能适用也可能不适用 - 因此需要一个新问题.(链接)
我正在寻找关于浮动叠加层的一些信息不是mapView的叠加层,而是叠加在其他应用程序上的叠加层.
例如,那些应用程序正在做我正在寻找的东西:
https://play.google.com/store/apps/details?id=com.pvy.batterybar
https://play.google.com/store/apps/details?id=ds.cpuoverlay
即使我们不在应用程序中,它们也会在屏幕前显示元素
我尝试了一些搜索,但我没有找到任何东西.
有人知道在哪里可以找到一些API文档,一个教程链接,一段代码......
谢谢
我有一个异步启动程序的函数:
(defun app (app-name)
(interactive "sRun application: ")
(async-shell-command app-name))
Run Code Online (Sandbox Code Playgroud)
我有一个可供选择的所有可执行文件的列表.我希望app函数表现为switch-to-buffer,为用户提供TAB完成.我如何在Emacs中使用迷你缓冲区?
是否有任何应用程序可以创建Java应用程序的本机应用程序启动器?作为"本机"术语,我的意思是"看起来像普通的,依赖于平台的应用程序,只启动java -jar foobar.jar,如果没有安装JVM则显示错误".我听说过Launch4j,但它只适用于Windows.我想要多平台(Win + Lin + Mac)解决方案.我不是在讨论shell脚本; 我想要正常的可执行文件.
顺便说一句,Eclipse看起来它有类似我想要的东西.
问候.
我有一个单一活动的简单应用程序.实际上,启动器图标与活动的图标(左上角的图标)相同.我想在我的活动中添加另一个图标而不改变发射器的一个.
这是我的清单:
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.natinusala.pebkac.MainActivity"
android:label="@string/app_name">
<intent-filter android:logo="@drawable/pebkac">
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
Run Code Online (Sandbox Code Playgroud)
实际上,我可以通过编辑android:icon="@drawable/ic_launcher"线来编辑启动器和活动图标.我也可以添加一个android:icon,<activity>但它也修改了启动器的图标.
如何在不触及启动器的情况下编辑活动图标?
谢谢 !