English 中文(简体)
cur子数据
原标题:Associating cursor data
  • 时间:2010-01-10 22:31:24
  •  标签:
  • android

也许我会这样错了,但如果是,请更正我。 情况如下: 我有一个疑问,即把URI用于储存在数据库中的游乐团。 我扩大了简单的CursorAdapter,以推翻了RingtoneManager(RingtoneManager)对相关联的TITLE的质疑,然而,获得的“意见”职能却被一劳永逸地称为一劳永逸,使我的申请速度放慢。 是否有办法可以一劳永逸地绘制海道图,并储存能够迅速获得数据的某处数据?

相关的法典版:

public String getRingerTitle(String uriString) {  
    Uri ringtoneUri = Uri.parse(uriString);   
    Ringtone r = RingtoneManager.getRingtone(this.context, ringtoneUri);  
    return r.getTitle(context);  
}  
public View getView(int position, View convertView, ViewGroup parent)  
    {  
           View v = convertView;  
           if (v == null) {  
                LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);  
                v = inflater.inflate(this.layout, null);  
          }  
           this.cursor.moveToPosition(position);
           String ringer = this.cursor.getString(this.cursor.getColumnIndex(PoolDbAdapter.KEY_RINGER));
            TextView rTitle = (TextView) v.findViewById(R.id.ringer_line_item);
            rTitle.setText(getRingerTitle(ringer));

           return(v);

    }  

How can the getRingerTitle() function be optimized to cache the data or to only query for each item once? OR - is there a better way I should be approaching this?

增 编

最佳回答

处理这一问题的一种方式是,将<代码>Map与Adapter相衔接。 仅仅是getRingerTitle()/code>电话的切身。 在您取代或<代码>requery(<>/code>)时,确保流出<代码>Map

或,在<条码>上填入“Cursor的原始<代码>,并在一栏中推翻有效“扩展”原<代码>Cursor的适当方法。 页: 1 这是与第1段相同的基本做法,但提供了某种更清洁的抽象做法。

页: 1 如果是另一个数据库查询,而您的原始<代码>Cursor则来自一个数据库查询,考虑使用一个链接来避免额外的数据库I/Os。

另外,在<条码>上不优先于<条码>。 Override newView( and bindView(.

问题回答

暂无回答




相关问题
Android - ListView fling gesture triggers context menu

I m relatively new to Android development. I m developing an app with a ListView. I ve followed the info in #1338475 and have my app recognizing the fling gesture, but after the gesture is complete, ...

AsyncTask and error handling on Android

I m converting my code from using Handler to AsyncTask. The latter is great at what it does - asynchronous updates and handling of results in the main UI thread. What s unclear to me is how to handle ...

Android intent filter for a particular file extension?

I want to be able to download a file with a particular extension from the net, and have it passed to my application to deal with it, but I haven t been able to figure out the intent filter. The ...

Android & Web: What is the equivalent style for the web?

I am quite impressed by the workflow I follow when developing Android applications: Define a layout in an xml file and then write all the code in a code-behind style. Is there an equivalent style for ...

TiledLayer equivalent in Android [duplicate]

To draw landscapes, backgrounds with patterns etc, we used TiledLayer in J2ME. Is there an android counterpart for that. Does android provide an option to set such tiled patterns in the layout XML?

Using Repo with Msysgit

When following the Android Open Source Project instructions on installing repo for use with Git, after running the repo init command, I run into this error: /c/Users/Andrew Rabon/bin/repo: line ...

Android "single top" launch mode and onNewIntent method

I read in the Android documentation that by setting my Activity s launchMode property to singleTop OR by adding the FLAG_ACTIVITY_SINGLE_TOP flag to my Intent, that calling startActivity(intent) would ...

From Web Development to Android Development

I have pretty good skills in PHP , Mysql and Javascript for a junior developer. If I wanted to try my hand as Android Development do you think I might find it tough ? Also what new languages would I ...

热门标签