HashMap으로는 readObject()에서 예외가 발생.

GetFieldID: unable to find field Ljava/util/HashMap;.loadFactor:F



ArrayList -> file -> ArrayList

<ref>




TextView tv = (TextView)findViewById(R.id.textView2);

try {

ArrayList al = new ArrayList();

al.add("one");

al.add("two");

al.add("three");

ObjectOutputStream os = new ObjectOutputStream(

new BufferedOutputStream(new FileOutputStream(

getFilesDir().getAbsolutePath()+"/a.ser")));


os.writeObject(al);

os.close();



File file = new File(getFilesDir().getAbsolutePath()+"/a.ser");

Log.e(null, "file exist? : "+ file.exists());

ObjectInputStream ois = new ObjectInputStream(

new BufferedInputStream(new FileInputStream(

getFilesDir().getAbsolutePath()+"/a.ser")));


ArrayList al2 = (ArrayList)ois.readObject();


ois.close();

tv.setText(al2.get(1) + " - " + al2.get(2) + " - " + al2.get(0));


} catch (Exception e) {

Log.e(null, e.toString());

}


Posted by tenn
,

[Android] Layout Rounding

Android 2012. 9. 10. 11:17

레이아웃의 모서리를 둥글게


<Ref>



<?xml version="1.0" encoding="utf-8"?>

<shape xmlns:android="http://schemas.android.com/apk/res/android" >


    <corners android:radius="15dp" />


    <solid android:color="#FF000000" />


</shape>



Posted by tenn
,

[Android] TextView

Android 2012. 9. 10. 10:37




TextView tv = new TextView(this);


tv.setTextColor(Color.WHITE);

tv.setText("text text text");

tv.setTextSize(25);


tv.setShadowLayer(1.5f, -1, 1, Color.LTGRAY);  //그림자 효과    


LinearLayout.LayoutParams lp 

= new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);


lp.topMargin = 20;   //마진은 LayoutParams


mainLayout.addView(tv, lp);



그림자 효과 


public void setShadowLayer (float radius, float dx, float dy, int color)


dx, dy : 그림자의 위치


This draws a shadow layer below the main layer, with the specified offset and color, and blur radius. If radius is 0, then the shadow layer is removed.



Posted by tenn
,