随笔-348  评论-598  文章-0  trackbacks-0
class MyApp extends Application {

  
private String myState;

  
public String getState(){
    
return myState;
  }
  
public void setState(String s){
    myState 
= s;
  }
}

class Blah extends Activity {

  @Override
  
public void onCreate(Bundle b){
    
    MyApp appState 
= ((MyApp)getApplicationContext());
    String state 
= appState.getState();
    
  }
}

<application android:name=".MyApp" 
       android:icon
="@drawable/icon" 
       android:label
="@string/app_name">


---------------------------------------------------------
专注移动开发

Android, Windows Mobile, iPhone, J2ME, BlackBerry, Symbian
posted on 2011-01-21 14:12 TiGERTiAN 阅读(813) 评论(0)  编辑  收藏 所属分类: Android

只有注册用户登录后才能发表评论。


网站导航: