使用Java的getData()方法

时间:2017-09-20 04:28:21

标签: java android

我试图完全理解这个Android wheel widget是如何工作的,所以我可以适当地修改它。为了做到这一点,我逐行检查代码。在第一个文档的开头,清单中指定android.intent.category.LAUNCHER的活动,我找到了以下代码:

Intent intent = getIntent();
String path = intent.getStringExtra("com.example.android.apis.Path");

if (path == null) {
    path = "";
}

setListAdapter(new SimpleAdapter(
    this,
    getData(path), 
    android.R.layout.simple_list_item_1,
    new String[] { "title" },
    new int[] { android.R.id.text1 }));

getListView().setTextFilterEnabled(true);

我已经验证path将始终为null,因为调用intent(清单)不包含名为com.example.android.apis.Path的字符串。这意味着路径将始终设置为""。然而,getData(path)确实返回了适当的数据,即:

  

[{intent = Intent {cmp = kankan.wheel.demo / .CitiesActivity},title = Cities},{intent = Intent {cmp = tw.g35gtw.wheel.demo / tw.g35g.demo.CitiesActivity}, title = Cities},{intent = Intent {cmp = kankan.wheel.demo / .DateActivity},title = Date},{intent = Intent {cmp = tw.g35gtw.wheel.demo / tw.g35g.demo.DateActivity} ,title = Date},{intent = Intent {cmp = kankan.wheel.demo / .PasswActivity},title = Password},{intent = Intent {cmp = tw.g35gtw.wheel.demo / tw.g35g.demo.PasswActivity },title = Password},{intent = Intent {cmp = kankan.wheel.demo / .SlotMachineActivity},title = Slot Machine},{intent = Intent {cmp = tw.g35gtw.wheel.demo / tw.g35g.demo .SlotMachineActivity},title = Slot Machine},{intent = Intent {cmp = tw.g35gtw.wheel.demo / tw.g35g.demo.SwipeActivity},title = Swipe},{intent = Intent {cmp = kankan.wheel。 demo / .TimeActivity},title = Time},{intent = Intent {cmp = tw.g35gtw.wheel.demo / tw.g35g.demo.TimeActivity},title = Time},{intent = Intent {cmp = kankan.wheel .demo / .Time2Activity},title = Time 2},{intent = Intent {cmp = tw.g 35gtw.wheel.demo / tw.g35g.demo.Time2Activity},title = Time 2}]

如果将空字符串以外的任何内容输入getData(),则不返回任何内容。我的问题是,空字符串如何获得正确的数据?原始编码器可能会给getData()一个默认值吗?如果是这样,我可以在哪里找到那些代码,以便我可以修改它?

另外,我无法在项目中找到名为kankan的包。 kankan.wheel.demo/.CitiesActivity可以成为在线资源吗?

0 个答案:

没有答案