Android Intent 序列化和反序列化

  1.        //序列化  
  2. intent.toURI();  
  3. //反序列 化使用:  
  4. Intent.parseUri(uriString, 0);  


序列化

  1. Intent intent = new Intent(ACTION);  
  2.       
  3.        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);  
  4.    
  5. String intnetUri = intent.toURI(0);  

反序列化

  1. Intent i;  
  2. try {  
  3.      i = Intent.parseUri(uriString, 0);  
  4.      context.startActivity(i);  
  5.  } catch (URISyntaxException e) {  
  6.      e.printStackTrace();  
  7.  }  

其中uriString就是序列化後的Intent
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章