当前位置:  编程技术>移动开发
本页文章导读:
    ▪给系统apk签字        给系统apk签名 1.使用platform密钥对apk进行签名   1.1.进入<Android_Source_Path>/build/target/product/security,找到【platform.pk8】和【platform.x509.pem】系统密钥。1.2.进入<Android_Source_Path>/build/tools/sig.........
    ▪ Intent.ACTION.CALL拨通电话        Intent.ACTION.CALL拨打电话 添加权限   <uses-permission android:name="android.permission.CALL_PHONE"></uses-permission><!-- 放在application标签之外-->   private Button mButton1; private EditText mEditText1; public v.........
    ▪ UIModalPresentationFormSheet方式下resignFirstResponder无法隐藏键盘       UIModalPresentationFormSheet模式下resignFirstResponder无法隐藏键盘 弹出UIModalPresentationFormSheet模式 - (IBAction)buttonPressed:(id)sender { NSLog(@"Show feedback view now!"); UIViewController *fbsheet = [[FeedbackSheet allo.........

[1]给系统apk签字
    来源: 互联网  发布时间: 2014-02-18
给系统apk签名

1.使用platform密钥对apk进行签名

 

1.1.进入<Android_Source_Path>/build/target/product/security,找到【platform.pk8】和【platform.x509.pem】系统密钥。
1.2.进入<Android_Source_Path>/build/tools/signapk找到SignApk.java,运行javac编译成SignApk.class
1.3.执行命令java com.android.signapk.SignApk platform.x509.pem platform.pk8 input.apk output.apk

至此,完成。

 

2. 对1的补充:

<Android_Source_Path>/build/target/product/security下有多对密钥,详细如下:

The following commands were used to generate the test key pairs:

  development/tools/make_key testkey  '/C=US/ST=California/L=Mountain View/O=Android/OU=Android/CN=Android/emailAddress=android@android.com'
  development/tools/make_key platform '/C=US/ST=California/L=Mountain View/O=Android/OU=Android/CN=Android/emailAddress=android@android.com'
  development/tools/make_key shared   '/C=US/ST=California/L=Mountain View/O=Android/OU=Android/CN=Android/emailAddress=android@android.com'
  development/tools/make_key media    '/C=US/ST=California/L=Mountain View/O=Android/OU=Android/CN=Android/emailAddress=android@android.com'

The following standard test keys are currently included:

testkey -- a generic key for packages that do not otherwise specify a key.
platform -- a test key for packages that are part of the core platform.
shared -- a test key for things that are shared in the home/contacts process.
media -- a test key for packages that are part of the media/download system.

These test keys are used strictly in development, and should never be assumed
to convey any sort of validity.  When $BUILD_SECURE=true, the code should not
honor these keys in any context.


signing using the openssl commandline (for boot/system images)
--------------------------

1. convert pk8 format key to pem format
   % openssl pkcs8 -inform DER -nocrypt -in testkey.pk8 -out testkey.pem

2. create a signature using the pem format key
   % openssl dgst -binary -sha1 -sign testkey.pem FILE > FILE.sig

extracting public keys for embedding
------------------------------------
it's a Java tool
but it generates C code
take a look at commands/recovery/Android.mk
you'll see it running $(HOST_OUT_JAVA_LIBRARIES)/dumpkey.jar

 

 

3.对3的补充:

在运行第三步的命令前,请在你当前的工作目录下新建如下结构的文件夹:com.android.signapk,然后将第二步编译生成的SignApk放入该目录下。或者也可以将SignApk.java的package声明删除后再运行javac编译。

 

命令java com.android.signapk.SignApk platform.x509.pem platform.pk8 input.apk output.apk

不单可以对apk文件进行重签名,也可以对所有的zip文件进行重签名,包括ROM文件。

 

milestone的CM7相应文件地址为:https://github.com/nadlabak/android_build/tree/gingerbread/tools/signapk


    
[2] Intent.ACTION.CALL拨通电话
    来源: 互联网  发布时间: 2014-02-18
Intent.ACTION.CALL拨打电话

添加权限

 

<uses-permission android:name="android.permission.CALL_PHONE"></uses-permission><!-- 放在application标签之外-->

 

private Button mButton1;
	private EditText mEditText1;

	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.telephone);

		mEditText1 = (EditText) findViewById(R.id.editText1);
		mButton1 = (Button) findViewById(R.id.button1);
		/* 设定Button对象的OnClickListener来聆听OnClick事件 */
		mButton1.setOnClickListener(new Button.OnClickListener() {
			public void onClick(View v) {
				try {
					/* 取得EditText中用户输入的字符串 */
					String strInput = mEditText1.getText().toString();
					/* 建构一个新的Intent并执行action.CALL的常数与透过Uri将字符串带入 */
					Intent myIntentDial = new Intent(
							"android.intent.action.CALL", Uri.parse("tel:"
									+ strInput));
					/* 在startActivity()方法中带入自定义的Intent对象以执行拨打电话的工作 */
					startActivity(myIntentDial);
					mEditText1.setText("");
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}
 


 

 

转跳至通讯录

1.添加权限

<uses-permission android:name="android.permission.CALL_PHONE"></uses-permission>

或者需要允许的权限

<uses-permission android:name="android.permission.CALL_PRIVILEGED"></uses-permission>

 

2.代码

 

Intent myIntentDial = new Intent("android.intent.action.CALL_BUTTON"); 
        startActivity(myIntentDial);
 

 


    
[3] UIModalPresentationFormSheet方式下resignFirstResponder无法隐藏键盘
    来源: 互联网  发布时间: 2014-02-18
UIModalPresentationFormSheet模式下resignFirstResponder无法隐藏键盘
弹出UIModalPresentationFormSheet模式
- (IBAction)buttonPressed:(id)sender
{
    NSLog(@"Show feedback view now!");
    UIViewController *fbsheet = [[FeedbackSheet alloc] initWithNibName:@"FeedbackSheet" bundle:nil];
    fbsheet.modalPresentationStyle = UIModalPresentationFormSheet;
    [self presentModalViewController:fbsheet animated:YES];
    
    [fbsheet release];
}


效果如下:



但是当在UItextview软盘弹出之后,点击其他区域使用下面代码软盘无法隐藏
 [feedbackContent resignFirstResponder];


进查询资料之后发现重写disablesAutomaticKeyboardDismissal即可,该api在iOS (4.3 and later)
-(BOOL)disablesAutomaticKeyboardDismissal
{
    return NO;
}


还有一种方式就是通过在键盘上添加toolbar,也是一种比较简易的操作
   - (void)viewDidLoad
{
    [super viewDidLoad];
    
    UIToolbar * topView = [[UIToolbar alloc]initWithFrame:CGRectMake(0, 0, 320, 50)];
    [topView setBarStyle:UIBarStyleBlack];

    UIBarButtonItem * btnSpace = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:self action:nil];
    UIBarButtonItem * doneButton = [[UIBarButtonItem alloc] initWithTitle:@"收起键盘" style:UIBarButtonItemStyleDone target:self action:@selector(dismissKeyBoard)];
    [doneButton setWidth:80];
    
    NSArray * buttonsArray = [NSArray arrayWithObjects:btnSpace,doneButton,nil];
    [doneButton release];
    [btnSpace release];
    
    [topView setItems:buttonsArray];
    [feedbackContent setInputAccessoryView:topView];
}

-(IBAction)dismissKeyBoard
{
    [feedbackContent resignFirstResponder];
}



效果如下:




参考资料:http://stackoverflow.com/questions/3019709/modal-dialog-does-not-dismiss-keyboard

    
最新技术文章:
▪Android开发之登录验证实例教程
▪Android开发之注册登录方法示例
▪Android获取手机SIM卡运营商信息的方法
▪Android实现将已发送的短信写入短信数据库的...
▪Android发送短信功能代码
▪Android根据电话号码获得联系人头像实例代码
▪Android中GPS定位的用法实例
▪Android实现退出时关闭所有Activity的方法
▪Android实现文件的分割和组装
▪Android录音应用实例教程
▪Android双击返回键退出程序的实现方法
▪Android实现侦听电池状态显示、电量及充电动...
▪Android获取当前已连接的wifi信号强度的方法
▪Android实现动态显示或隐藏密码输入框的内容
▪根据USER-AGENT判断手机类型并跳转到相应的app...
▪Android Touch事件分发过程详解
▪Android中实现为TextView添加多个可点击的文本
▪Android程序设计之AIDL实例详解
▪Android显式启动与隐式启动Activity的区别介绍
▪Android按钮单击事件的四种常用写法总结
▪Android消息处理机制Looper和Handler详解
▪Android实现Back功能代码片段总结
▪Android实用的代码片段 常用代码总结
▪Android实现弹出键盘的方法
▪Android中通过view方式获取当前Activity的屏幕截...
▪Android提高之自定义Menu(TabMenu)实现方法
▪Android提高之多方向抽屉实现方法
▪Android提高之MediaPlayer播放网络音频的实现方法...
▪Android提高之MediaPlayer播放网络视频的实现方法...
▪Android提高之手游转电视游戏的模拟操控
 


站内导航:


特别声明:169IT网站部分信息来自互联网,如果侵犯您的权利,请及时告知,本站将立即删除!

©2012-2021,,E-mail:www_#163.com(请将#改为@)

浙ICP备11055608号-3