手机调用系统的拍照和裁剪功能,如果界面有输入框EditText,在一些手机会出现点击EditText会弹出输入法,却不能输入的情况。

时间:2014-05-25 01:11:29   收藏:0   阅读:484

code如下:

//Longest common sequence, dynamic programming method

void FindLCS(char *str1, char *str2)
{
	if(str1 == NULL || str2 == NULL)
		return;
	int length1 = strlen(str1)+1;
	int length2 = strlen(str2)+1;
	int **csLength,**direction;//two arrays to record the length and direction
	int i,j,maxLength=0,maxI=0,maxJ=0;
	csLength = (int **)new int[length2];
	for(i=0; i<length1; i++)
		csLength[i] = (int *)new int[length1];
	for(i=0;i<length2;i++)
		for(j=0;j<length1;j++)
			csLength[i][j] = 0;
	direction = (int **)new int[length2];
	for(i=0; i<length1; i++)
		direction[i] = (int *)new int[length1];
	for(i=0;i<length2;i++)
		for(j=0;j<length1;j++)
			direction[i][j] = 0;
	for(i=1;i<length2;i++)
		for(j=1;j<length1;j++)
		{
			if(str2[i-1] == str1[j-1])
			{
				csLength[i][j] = csLength[i-1][j-1] + 1;
				direction[i][j] = 3;//3 means leftup
			}
			else if(csLength[i-1][j] > csLength[i][j-1])
			{
				csLength[i][j] = csLength[i-1][j];
				direction[i][j] = 1;//1 means left
			}				
			else
			{
				csLength[i][j] = csLength[i][j-1];
				direction[i][j] = 2;//2 means up
			}
			if(maxLength < csLength[i][j])
			{
				maxLength = csLength[i][j];//record th max length and the corresponding index
				maxI = i;
				maxJ = j;
			}
		}
	i = maxI;
	j = maxJ;
	//the output is in reverse order
	while(i!=0 && j!= 0)
	{
		if( str2[i-1] == str1[j-1])
			cout<<str2[i-1]<<" ";
		if(direction[i][j] == 3)
		{
			i--;
			j--;
		}
		else if(direction[i][j] == 1)
		{
			i--;
		}
		else if(direction[i][j] == 2)
		{
			j--;
		}
	}
}


手机调用系统的拍照和裁剪功能,如果界面有输入框EditText,在一些手机会出现点击EditText会弹出输入法,却不能输入的情况。,布布扣,bubuko.com

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!