用于从类中获取全局日期值的android代码 [英] android code to get a global date value from class

查看:59
本文介绍了用于从类中获取全局日期值的android代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的全球课程



This is my global class

public class GlobalDataForURL extends Application
{
    String url="";

    public String getName() {
        return url;
    }
    public void setName(String aName) {
        url = aName;
    }
}





我想访问片段中的url。我怎么能实现这个?



i want to access the url in a fragment. how can i acheive this ?

推荐答案

在你的片段中,

In your fragment,
GlobalDataForURL gData  = new GlobalDataForURL(); 
gDate.setName("www.google.com");
// and later use it like this,
gDate.getName();



希望你想要这个。 ;)





-KR


Hope you wanted this. ;)


-KR


这篇关于用于从类中获取全局日期值的android代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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