LoginSignup
5

More than 5 years have passed since last update.

ねこ一覧画面を開く方法 〜 Android7.0 Nougat/EasterEgg/AndroidNeko 〜

Last updated at Posted at 2017-02-22

Android7.0のねこあつめ的機能

neko1.png

ご飯を置いておくとねこがいらっしゃいます

4つのご飯から選んでお皿に置いておくと

neko2.png

ときどきねこがご飯に釣られてやってきます

neko3.png

現れたねこたちはこちらです

PUSH通知をタップすることで

仲良くなったねこの一覧を見ることができます

neko4.png

ねこ一覧画面はねこがご飯食べに来た時の通知をタップした時しか見れない・・・

集めたねこを眺めたい時、ねこたちの画面を見るには・・・

neko4.png

ランダムでやってくるプッシュ通知からしか開けない作りになっているのです・・・

そこで!

いつでもねこの一覧画面を開くことができるプログラムを書いてみました

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Intent i = new Intent();
        i.setComponent(new ComponentName("com.android.egg", "com.android.egg.neko.NekoLand"));
        i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        try {
            startActivity(i);
            finish();
        } catch (ActivityNotFoundException e) {
            TextView sorryTextView = (TextView)findViewById(R.id.sorryTextView);
            sorryTextView.setText(R.string.no_neko_list);
        }
    }
}

これでいつでもどこでも思う存分ねこを眺めることができます

今日はねこの日です

動物の命を大切に。
ねこ一覧画面開くのソースは
https://github.com/nagaoyuriko/androidneko
に置きました。

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5