来自服务的活动之间的传递捆绑字符串中的空例外 [英] Null exception in pass bundles string between activities from service

查看:59
本文介绍了来自服务的活动之间的传递捆绑字符串中的空例外的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我在服务活动之间传递vales时会出现空指针异常。



以下是服务代码:

Hi,

I am getting null pointer exception on passing vales between activities from service.

following is the code for service :

public Integer thumbs = R.drawable.computer;
private Context con=null;
private LstClients clients = null;
private Server ser=null;

public DeviceAdaptor(Context c, Server ser){
	con = c;
	this.ser = ser;
	this.clients= this.ser.Clients();
}

public View getView(int arg0, View view, ViewGroup arg2) {
	// TODO Auto-generated method stub

	if(view==null){
		LayoutInflater inflator = ((Activity)con).getLayoutInflater();
		view = inflator.inflate(R.layout.activity_device_info, arg2,false);

	}
	
	TextView deviceName = (TextView)view.findViewById(R.id.lblDeviceName);
	tmp=arg0;
            deviceName.setText(clients.Name(arg0));
            ImageView img = (ImageView)view.findViewById(R.id.imgDevice);
            img.setImageResource(R.drawable.computer);
            img.setOnClickListener(new OnClickListener() {
		
		@Override
		public void onClick(View arg0) {
		
			ser.FindClients().interact.get(tmp).start();
			Intent in = new Intent((Activity)con  , FileManagerActivity.class);
			in.putExtra("Nmbr",tmp);
			con.startActivity(in);
			Log.e("DEVICEADAPTOR", "Moved");
			
		}
	});
    return view;
}



我在下一个活动中获取信息为空例外:


while im getting information as null exception in next activity as :

public boolean onCreateOptionsMenu(Menu menu) {

    getMenuInflater().inflate(R.menu.file_manager, menu);
    Log.e("FILEMANAGERACTIVITY", "starting");
    Bundle bn = null;
    a= getIntent().getIntExtra("Nmbr", 0);
    Log.e("FILEMANAGERACTIVITY", String.valueOf(a));
    Start();

    return true;
}

推荐答案

解决了Myselft



... .............. \

..............















...................
Solved Myselft

.................\
..............







...................


这篇关于来自服务的活动之间的传递捆绑字符串中的空例外的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆