package yu.bin;import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;public class poweroff extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Button t = (Button) findViewById(R.id.abc);
t.setOnClickListener(new OnClickListener() { @Override
public void onClick(View v) {
// TODO Auto-generated method stub
Intent shutdown = new Intent(Intent.ACTION_SHUTDOWN);
startActivity(shutdown);
}
});
}
}<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="yu.bin"
android:versionCode="1"
android:versionName="1.0">
<application
android:icon="@drawable/icon"
android:label="@string/app_name">
<activity
android:name=".poweroff"
android:label="@string/app_name">
<intent-filter>
<action
android:name="android.intent.action.MAIN" />
<category
android:sharedUserId="android.uid.system"
android:name="android.intent.category.LAUNCHER" /> </intent-filter>
</activity>
</application>
<uses-sdk
android:minSdkVersion="8" />
<uses-permission
android:name="android.intent.action.ACTION_SHUTDOWN" />
</manifest> 02-29 06:57:01.315: ERROR/AndroidRuntime(459): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.ACTION_SHUTDOWN }
解决方案 »
- 如何能让浏览器播放网页上的swf?
- 有没有人知道为啥2.3的开关怎么在4.0上变成了checkbox?非常感谢~~~
- android 文件名含特殊字符不能播放
- SimpleCursorAdapter中setViewImage的参数问题
- 相机拍照
- 关于Android的EditText
- ListView And Dialog
- 仿ios的桌面浮窗控制!请大神们告诉源码最好有注释,又或者是帮忙反编译一下然后加上详细的注释!!!!大恩没齿难忘!!!!!
- android-async-http框架的例子怎么导入工具运行
- abd 批处理重启一批安卓设备,跪求高手赐予一个批处理文件,自动执行终端设备的重启
- 跪求Android百度地图的一个完整的项目,学习,高分求资源。。。。
- [ffmpeg]如何同时解码多路视频
1.在manifest.xml的manifest字段中加入属性:android:sharedUserId="android.uid.system"
2.用platform key来对APK进行签名
3.把签好名的APK放到rom对应的zip文件的system/app目录下。
4.把手机刷成上面rom。
经过以上操作可能可以使用android.intent.action.ACTION_SHUTDOWN这个intent来关机我没试验过,猜的。。