Programming/Android2014. 5. 14. 11:50


 pDialog.setIndeterminate(true);


 pDialog.setIndeterminate(false); // false를 해야 Progress 진행상태가 보인다.

Posted by WI_K
Programming/Android2014. 5. 8. 12:12

Step1. 데이터 클래스의 직렬화

우선 인자로 전달하기 위해서는 ArrayList에 담기는 데이터 클래스가 직렬화가 되어있어야 합니다.

public class User implements Serializable{

...

}

이런식으로 직렬화를 해줍니다.


Step2. 인텐트에 데이터 담기

사용하는 방법은 동일합니다.

ArrayList<User> listUsers 라는 객체에 데이터를 꽉꽉눌러담아놓으시고요.

다음과 같이 startActivity를 실행하셔서 전달하면 됩니다.

혹시나 해서... listUsers.add(new User("가나다",23,"대학생"));

등의 형태로 담을수도 있겟죠? ^^;;;


Intent it = new Intent(this, ListActivity.class);

it.putExtra("users", listUsers);

startActivity(it);


Step3. 데이터 꺼내서 사용하기

ArrayList<User> list = (ArrayList<User>) getIntent().getSerializableExtra("users");

위와 같이 인텐트를 받는 액티비티에서 사용하시면 됩니다.


단일 객체도 마찬가지


출저: http://ralf79.tistory.com/385

Posted by WI_K
Programming/Android2014. 5. 8. 11:12


메니페스트, 해당 엑티비티에 아래의 코드 추가


android:windowSoftInputMode="adjustResize"

Posted by WI_K
Programming/Android2014. 5. 8. 09:46

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

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

 <item android:state_pressed="true" android:state_enabled="true">

  <shape>

   <gradient  

    android:startColor="#dce3d1" android:endColor="#ffffff"

    android:angle="270" />

   

   <stroke

    android:width="2dip" android:color="#8f975d"/>

    

   <corners android:radius="5dip"/>

   

   <padding

    android:left="7dip"

    android:right="7dip"

    android:top="7dip"

    android:bottom="7dip" />

  </shape>

 </item>

 <item android:state_focused="true" android:state_enabled="true">

  <shape>

   <gradient  

    android:startColor="#dce3d1" android:endColor="#ffffff"

    android:angle="270" />

   

   <stroke

    android:width="2dip" android:color="#8f975d"/>

    

   <corners android:radius="5dip"/>

   

   <padding

    android:left="7dip"

    android:right="7dip"

    android:top="7dip"

    android:bottom="7dip" />

  </shape>

 </item>

 <item android:state_enabled="false">

  <shape>

   <gradient  

    android:startColor="#bbc2b2" android:endColor="#898b75"

    android:angle="270" />

    

   <corners android:radius="5dip"/>

   

   <padding

    android:left="7dip"

    android:right="7dip"

    android:top="7dip"

    android:bottom="7dip" />

  </shape>

 </item>

 <item android:state_enabled="true">

  <shape>

   <gradient  

    android:startColor="#dce3d1" android:endColor="#ffffff"

    android:angle="270" />

   

   <stroke

    android:width="0.5dip" android:color="#898b75"/>

    

   <corners android:radius="5dip"/>

   

   <padding

    android:left="7dip"

    android:right="7dip"

    android:top="7dip"

    android:bottom="7dip" />

  </shape>

 </item>

</selector>

Posted by WI_K
Programming/Android2014. 4. 29. 21:51


Call notifyDataSetChanged() on your Adapter.

Posted by WI_K
Programming/Android2014. 4. 29. 17:56


public void onItemClick(AdapterView<?> parent, View view, int position, long rowID) {


((자료형) parent.getAdapter().getItem(position));

}

'Programming > Android' 카테고리의 다른 글

(EditBox) 커스톰 배경화면  (0) 2014.05.08
(ListView) Data Update 시 view 갱신  (0) 2014.04.29
전화번호 형식 지정  (0) 2014.04.17
연락처 빠르게 불러오기  (0) 2014.04.17
(ListView) 터치시 색 변경  (0) 2014.04.10
Posted by WI_K
Programming/Android2014. 4. 17. 15:33

phoneNum = PhoneNumberUtils.formatNumber(phoneNum);

Posted by WI_K
Programming/Android2014. 4. 17. 15:25

public void getAllPhoneContacts(Context context) {


Log.d("START", "Getting all Contacts");


contactList = new ArrayList<Contact>();


Contact contact = null;


Uri uri = ContactsContract.CommonDataKinds.Phone.CONTENT_URI;


Cursor cursor = context.getContentResolver().query(

uri,

new String[] { ContactsContract.CommonDataKinds.Phone.NUMBER,

ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME,

ContactsContract.CommonDataKinds.Phone._ID }, null,

null,

ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME + " ASC");


cursor.moveToFirst();


while (cursor.isAfterLast() == false) {

String contactNumber = cursor

.getString(cursor

.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER));

String contactName = cursor

.getString(cursor

.getColumnIndex(ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME));

String phoneContactID = cursor

.getString(cursor

.getColumnIndex(ContactsContract.CommonDataKinds.Phone._ID));


contact = new Contact();

contact.setId(phoneContactID);

contact.setName(contactName);

contact.addPhone_num(contactNumber);


if (contact != null) {

contactList.add(contact);

}

contact = null;


cursor.moveToNext();

}

cursor.close();

cursor = null;

Log.d("END", "Got all Contacts");


}

'Programming > Android' 카테고리의 다른 글

(ListView) click했을 때 해당 custom Item 가져 오는 법  (0) 2014.04.29
전화번호 형식 지정  (0) 2014.04.17
(ListView) 터치시 색 변경  (0) 2014.04.10
Resource 가져오기  (0) 2014.04.10
Hash 사용  (0) 2014.04.09
Posted by WI_K
Programming/Android2014. 4. 10. 20:20


1. 안드로이드 res 폴더에 drawable 폴더가 없을 시 생성

2. Drawable 폴더에 ListView_Selector.xml 파일 생성 (이름 자유)

3. Selector 속성지정


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

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

<item

        android:state_focused="true"

        android:drawable="@color/yellow"

    />

<item

        android:state_pressed="true"

        android:drawable="@color/yellow"

    />

    <item

        android:state_activated="true"

        android:drawable="@color/yellow"

    />

    <item

        android:state_selected="true"

        android:drawable="@color/yellow"

    />

<item android:drawable="@color/white"/>

 

</selector>


3. ListView에 속성 지정

android:listSelector="@drawable/listview_selector"

listview_selector는 추가했던 파일 이름

'Programming > Android' 카테고리의 다른 글

(ListView) click했을 때 해당 custom Item 가져 오는 법  (0) 2014.04.29
전화번호 형식 지정  (0) 2014.04.17
연락처 빠르게 불러오기  (0) 2014.04.17
Resource 가져오기  (0) 2014.04.10
Hash 사용  (0) 2014.04.09
Posted by WI_K
Programming/Android2014. 4. 10. 10:37

-Color

setTextColor()일 경우와 setBackgroundResource()일 경우가 다르다. 

colors.xml에서 색 정보를 가져올 때의 경우를 알아보자.


1. setColor()일 경우

적용 대상: setTextColor()

사용 방법: setTextColor(getResources().getColor(R.color.gray));


2. setBackgroundResource()일 경우

적용 대상: setBackgroundResource()

사용 방법: setBackgroundResource(R.color.gray);


따라서 Resource가 붙으면 굳이 getResources().getColor()를 붙일 필요가 없다.


※응용

-String

getResources().getString(R.string.volunteer_full);

'Programming > Android' 카테고리의 다른 글

(ListView) click했을 때 해당 custom Item 가져 오는 법  (0) 2014.04.29
전화번호 형식 지정  (0) 2014.04.17
연락처 빠르게 불러오기  (0) 2014.04.17
(ListView) 터치시 색 변경  (0) 2014.04.10
Hash 사용  (0) 2014.04.09
Posted by WI_K