成都网站建设设计

将想法与焦点和您一起共享

androidint,Androidintent乱码怎么解决

Android移动开发图片int型表示

您好,请参考本段落:

长安网站建设公司创新互联公司,长安网站设计制作,有大型网站制作公司丰富经验。已为长安上千提供企业网站建设服务。企业网站搭建\成都外贸网站建设公司要多少钱,请找那个售后服务好的长安做网站的公司定做!

/**

* 程序入口

*

* @author talentClass

*/

public class MainActivity extends AppCompatActivity implements GameLayout.Game2048Listener {

public static final String SCORE = "score";

/**

* 模式:false为数字,true为图片

*/

private boolean bType;

private TextView tvScore, tvMaxScore; // 当前分数、最高分

private Button btnType, btnRestart; // 设置类型、重新开始

private GameLayout mGameLayout; // 自定义View容器

// 放置图片的数组

private int[] mImages = {R.mipmap.image1, R.mipmap.image2, R.mipmap.image3, R.mipmap.image4, R.mipmap.image5, R.mipmap.image6,

R.mipmap.image7, R.mipmap.image8, R.mipmap.image9, R.mipmap.image10, R.mipmap.image11};

Android"640.00"怎么转为int类型?

mageView imageview = (ImageView) this.findViewById(R.id.imageview_welcome);

double d1 = 640.00/1136.00;

double d2 = (double)screenWidth/(double)screenHeight;

if(d1d2){

RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) imageview.getLayoutParams();

params.height = screenHeight;

params.width = (int) (640.00*((double)screenHeight/1136.00));

int m = (int)((double)((double)640.00*((double)screenHeight/1136.00))-screenWidth)/2;

params.leftMargin = -m;

params.rightMargin = -m;

imageview.setLayoutParams(params);

}else if(d2d1){

RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) imageview.getLayoutParams();

params.width = screenWidth;

params.height = (int) ((double)1136.00*((double)screenWidth/640.00));

int m = (int)((double)((double)1136.00*((double)screenWidth/640.00))-screenHeight)/2;

params.topMargin = -m;

params.bottomMargin = -m;

imageview.setLayoutParams(params);

}

————————————————

求助:1.android怎么把int型数组存入文件并保存在SD卡中 2.android怎么从文件中读取数据并存在数组中

用android自带的JSON库,

存档过程

int[] numberArray = {1,3,5,6,9,233,3255};

JSONArraynumbers=new JSONArray();

for(int number : numberArray){

numbers.put(number);

}

String jsonString= numbers.toString();

FileOutputStream fileOut=null;

OutputStreamWriter outStream =null;

try

{

fileOut =new FileOutputStream(saveFilePath,false);

outStream =new OutputStreamWriter(fileOut);

outStream.write(jsonString);

}

catch(Exception e)

{

}

finally

{

try

{

if(null!=outStream)

outStream.close();

if(null!=fileOut)

fileOut.close();

}

catch(Exception e)

{

}

}

读取过程差不多,new 一个FileInputStream 读取其中内容。

然后用这个字符串来初始化JSONArray,就可以得到结果。

记得给应用程序加上读写SD卡的权限。


当前标题:androidint,Androidintent乱码怎么解决
网址分享:http://chengdu.cdxwcx.cn/article/dssddhi.html