Back to project page Pairs.
The source code is released under:
MIT License
If you think the Android project Pairs listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.example.pairs; // w ww . ja v a 2 s .c o m import android.app.Activity; import android.content.Intent; import android.content.SharedPreferences; import android.os.Bundle; import android.view.KeyEvent; import android.widget.TextView; public class PhotoActivity extends Activity { String ms; SharedPreferences readkeyword; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //???????????? readkeyword = getSharedPreferences("pairsKeyWord", Activity.MODE_PRIVATE); //??????????????"body"??????????????????????????? ms = readkeyword.getString("body", ""); //????????????????????????????? if(ms.indexOf("???????") != -1) setContentView(R.layout.birthday); else if(ms.indexOf("??") != -1) setContentView(R.layout.goodnight); else if(ms.indexOf("???") != -1) setContentView(R.layout.backphone); else setContentView(R.layout.miss); //??????????????????? TextView body = (TextView) findViewById(R.id.body); body.setText(ms); } public boolean onKeyDown(int keyCode, KeyEvent event) { if(keyCode == KeyEvent.KEYCODE_BACK) { finish(); Intent intent = new Intent(Intent.ACTION_MAIN); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.addCategory(Intent.CATEGORY_HOME); startActivity(intent); return true; } else { return super.onKeyDown(keyCode, event); } } }