Skip to content

Instantly share code, notes, and snippets.

@operando
operando / NavigationViewActions.java
Created March 22, 2016 08:36
Espresso 2.2.2 Include NavigationViewActions
package android.support.test.espresso.contrib;
/*
* Copyright 2016, The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
@operando
operando / gist:76e9d148d0b3648354b8
Created March 21, 2016 11:50
Droidkaigi app exception
>android.view.InflateException: Binary XML file line #151: Error inflating class io.github.droidkaigi.confsched.widget.CustomLikeButton
at android.view.LayoutInflater.createView(LayoutInflater.java:620)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:758)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:758)
at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
at io.github.droidkaigi.confsched.widget.BindingHolder.<init>(BindingHolder.java:17)
at io.github.droidkaigi.confsched.fragment.SessionsTabFragment$SessionsAdapter.onCreateViewHolder(SessionsTabFragment.java:137)
@operando
operando / CustomPagerTabStrip.java
Last active September 29, 2015 08:10
Since v23 of the support library contain a layout bug. https://code.google.com/p/android/issues/detail?id=183127 The suggested workaround is to use this Class.
package android.support.v4.view;
import android.content.Context;
import android.util.AttributeSet;
/**
* Since v23 of the support library contain a layout bug.
* https://code.google.com/p/android/issues/detail?id=183127
*/
public class CustomPagerTabStrip extends PagerTabStrip {
@operando
operando / memo.md
Last active August 29, 2015 14:24
mponさんのListViewを読んでみたメモ

ListViewを読んでみたメモ

Viewをリサイクルしてるところを読んでみたい

わからなかった・・・ ので、5.1.1とのdiffを眺めてみた

Android 5.1.1 と M Preview diff

  • findViewTraversal@IdResアノテーションがついた
@operando
operando / file0.java
Last active August 29, 2015 14:11
GarumとSharedPreferencesへの異常なまでの愛 ref: http://qiita.com/operandoOS/items/8af20ac09a9d6acb075e
package com.os.operando.sharedpreferences.sample;
// this -> Context
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this);
@operando
operando / file0.txt
Created October 18, 2014 15:14
【Android】コマンドラインから使うLint ref: http://qiita.com/operandoOS/items/1318ca9fca5c238e2e02
lint <アプリケーションのDirectory>
@operando
operando / file0.c
Last active August 29, 2015 14:07
【Android】adb shell date は System User or radio Groupじゃないと反映されない ref: http://qiita.com/operandoOS/items/61bbbed2568e27a6ee4e
fd = open("/dev/alarm", O_RDWR);
ts.tv_sec = tv.tv_sec;
ts.tv_nsec = tv.tv_usec * 1000;
res = ioctl(fd, ANDROID_ALARM_SET_RTC, &ts);
//res = settimeofday(&tv, NULL);
if(res < 0) {
fprintf(stderr,"settimeofday failed %s\n", strerror(errno));
return 1;
}
@operando
operando / file0.java
Created October 4, 2014 08:13
【Android】悪用厳禁!アンインストールのIntentについて ref: http://qiita.com/operandoOS/items/dda8bb3b7677250af9ee
// String packageName = アンインストールするアプリのPackage名
Uri uri = Uri.fromParts("package", packageName, null);
Intent intent = new Intent(Intent.ACTION_DELETE, uri);
context.startActivity(intent);
@operando
operando / file0.java
Last active August 29, 2015 14:07
【Android】特定のDatabaseファイルを簡単に削除する ref: http://qiita.com/operandoOS/items/8a2ddb21ba868fb816f2
// context=Context helper=SQLiteOpenHelper
context.deleteDatabase(helper.getDatabaseName());
@operando
operando / file0.java
Last active August 29, 2015 14:06
【Android】Cursorをいじるメソッドで気をつけたいPositionの話 ref: http://qiita.com/operandoOS/items/6527b30f7e9bd8b60200
public static void dumpLastRecord(Cursor cursor) {
Log.d("dumpLastRecord", "=============");
if (cursor != null) {
cursor.moveToPosition(-1);
if (cursor.moveToLast()) {
String[] columnNames = cursor.getColumnNames();
int length = columnNames.length;
for (int i = 0; i < length; i++) {
String value;
try {