Android Open Source - Pairs Photo Activity






From Project

Back to project page Pairs.

License

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.

Java Source Code

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); 
    }
  }
}




Java Source Code List

com.example.pairs.AlarmActivity.java
com.example.pairs.ChooseContactActivity.java
com.example.pairs.Function.java
com.example.pairs.HelpActivity.java
com.example.pairs.Help.java
com.example.pairs.MainActivity.java
com.example.pairs.OurPage.java
com.example.pairs.Ours.java
com.example.pairs.PhotoActivity.java
com.example.pairs.SMSReceiver.java
com.example.pairs.SetContactActivity.java