Skip to content

Instantly share code, notes, and snippets.

@daichan4649
daichan4649 / AndroidManifest.xml
Created August 3, 2012 10:37
NFC sample(read IDm)
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="test.nfc"
android:versionCode="1"
android:versionName="1.0" >
<uses-permission android:name="android.permission.NFC" />
<uses-sdk
android:minSdkVersion="10"
android:targetSdkVersion="15" />
@daichan4649
daichan4649 / button_selector.xml
Created August 30, 2012 09:33
Button(+selector) sample
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:state_pressed="false"
android:drawable="@drawable/button_normal" />
<item
android:state_pressed="true"
android:drawable="@drawable/button_pressed" />
@daichan4649
daichan4649 / ReentrantLockTest.java
Created September 3, 2012 06:11
ReentrantLock test
private void test() {
final LockTest test = new LockTest();
new Thread(new Runnable() {
@Override
public void run() {
test.lockTest();
// test.readLockTest();
// test.writeLockTest();
}
@daichan4649
daichan4649 / PdfUtil.java
Created November 12, 2012 09:22
show PDF (for Android)
public class PdfUtil {
public enum PdfType {
SAMPLE("sample.pdf");
private static final String TMP_DIR_ROOT = "/mnt/sdcard/";
private String fileName;
private PdfType(String fileName) {
@daichan4649
daichan4649 / border.xml
Created November 12, 2012 08:20
shape sample
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid
android:color="@android:color/holo_orange_light"/>
<stroke
android:width="8dip"
android:color="#64ff0000" />
</shape>
@daichan4649
daichan4649 / MainActivity.java
Created December 12, 2012 02:08
タブ表示(for Android)
private void initTabLayout() {
// タブバー表示設定
View container = findViewById([resourceId]);
tabHost = (TabHost) container.findViewById(R.id.tabhost);
tabHost.setup();
for (TabType tabType : TabType.values()) {
tabHost.addTab(createTabSpec(tabHost, tabType));
}
// 初期表示タブ
@daichan4649
daichan4649 / AndroidManifest.xml
Created September 11, 2014 06:41
wifi setting notification (for Android)
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="daichan4649.notification"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="15"
android:targetSdkVersion="20" />
@daichan4649
daichan4649 / activity_main(layout).xml
Created December 17, 2012 15:20
Multi-pane Layouts (for AndroidAdventCalendar2012)
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</LinearLayout>
@daichan4649
daichan4649 / ContactListFragment.java
Created December 17, 2012 16:20
fragment replace (for AndroidAdventCalendar2012)
public class ContactListFragment extends ListFragment {
public static ContactListFragment newInstance() {
return new ContactListFragment();
}
private ArrayAdapter<ContactData> adapter;
private DataAccessor accessor;
@Override
@daichan4649
daichan4649 / ExpandableListViewTest.java
Last active December 12, 2015 05:19
ExpandableListView 長押し処理実装方法 (for Android)
// ExpandableListView 長押し時処理実装方法
// イベント発生順番
// (1) OnItemLongClickListener#onItemLongClick
// (2) OnCreateContextMenuListener#onCreateContextMenu
expandableListView.setOnItemLongClickListener(new OnItemLongClickListener() {
@Override
public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
// 選択要素位置
int groupPosition = ExpandableListView.getPackedPositionGroup(id);