Android剪贴板用法详解(2)
下面是用来接收Intent传递的值,临时的一个Activity,代码更简单: 复制代码 代码如下: package com.xiaoma.clipboard.demo; import android.app.Activity; import android.content
下面是用来接收Intent传递的值,临时的一个Activity,代码更简单:
复制代码 代码如下:
package com.xiaoma.clipboard.demo;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.TextureView;
import android.widget.TextView;
/**
* @Title: ReceiverClip.java
* @Package com.xiaoma.clipboard.demo
* @Description:临时用来接收下从Clip传过来的Intent值
* @author MZH
*/
public class ReceiverClip extends Activity {
private TextView tv1 ;
private TextView tv2 ;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.main2);
init();
}
private void init(){
tv1 = (TextView)findViewById(R.id.xiaoma);
tv2 = (TextView)findViewById(R.id.yatou);
Intent intent = getIntent();
Bundle b =intent.getBundleExtra("XiaoMaGuo");
if(b != null){
int xiaoma = b.getInt("xiaoma");
int yatou = b.getInt("yatou");
if(!"".equals(String.valueOf(xiaoma)) && !"".equals(String.valueOf(yatou))){
tv1.setText(String.valueOf(xiaoma));
tv2.setText(String.valueOf(yatou));
}
}
}
}
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.TextureView;
import android.widget.TextView;
/**
* @Title: ReceiverClip.java
* @Package com.xiaoma.clipboard.demo
* @Description:临时用来接收下从Clip传过来的Intent值
* @author MZH
*/
public class ReceiverClip extends Activity {
private TextView tv1 ;
private TextView tv2 ;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.main2);
init();
}
private void init(){
tv1 = (TextView)findViewById(R.id.xiaoma);
tv2 = (TextView)findViewById(R.id.yatou);
Intent intent = getIntent();
Bundle b =intent.getBundleExtra("XiaoMaGuo");
if(b != null){
int xiaoma = b.getInt("xiaoma");
int yatou = b.getInt("yatou");
if(!"".equals(String.valueOf(xiaoma)) && !"".equals(String.valueOf(yatou))){
tv1.setText(String.valueOf(xiaoma));
tv2.setText(String.valueOf(yatou));
}
}
}
}
精彩图集
精彩文章