我想创建一个游戏,您必须通过蓝牙将多个设备(4+)连接到主设备(例如平板电脑).将有两个应用程序,一个主要的应用程序,所有数据将从手机发送到手机.这甚至可能吗?
我正在使用不推荐使用的SimpleCursorAdapter来显示从Cursor到ListView的数据.我添加了附加参数0,它删除了代表性的警告,但我想使用更好的方式来显示数据.我已经阅读了一些内容Loader,但不知道如何实现它.什么是下面代码的更好的替代品?如何将此代码转换为使用Loader?
Cursor c = mDbHelper.getAllRecords();
startManagingCursor(c); //this is also deprecated
String[] from = new String[] { "Name" };
int[] to = new int[] { R.id.text1 };
SimpleCursorAdapter names =
new SimpleCursorAdapter(this, R.layout.names_row, c, from, to, 0);
setListAdapter(names);
Run Code Online (Sandbox Code Playgroud) 我正在Windows上的Eclipse中使用Egit,以尝试从私有Git克隆存储库。它可以连接,但是在下载时出现“ Packfile被截断”错误。我的网络浏览器和文件浏览器都关闭了。有谁知道是什么问题?
org.eclipse.jgit.api.errors.TransportException: Packfile is truncated.
at org.eclipse.jgit.api.FetchCommand.call(FetchCommand.java:139)
at org.eclipse.jgit.api.CloneCommand.fetch(CloneCommand.java:187)
at org.eclipse.jgit.api.CloneCommand.call(CloneCommand.java:127)
at org.eclipse.egit.core.op.CloneOperation.run(CloneOperation.java:156)
at org.eclipse.egit.ui.internal.clone.AbstractGitCloneWizard.executeCloneOperation(AbstractGitCloneWizard.java:433)
at org.eclipse.egit.ui.internal.clone.AbstractGitCloneWizard.access$2(AbstractGitCloneWizard.java:426)
at org.eclipse.egit.ui.internal.clone.AbstractGitCloneWizard$5.run(AbstractGitCloneWizard.java:387)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)
Caused by: org.eclipse.jgit.errors.TransportException: Packfile is truncated.
at org.eclipse.jgit.transport.BasePackFetchConnection.doFetch(BasePackFetchConnection.java:370)
at org.eclipse.jgit.transport.TransportHttp$SmartHttpFetchConnection.doFetch(TransportHttp.java:783)
at org.eclipse.jgit.transport.BasePackFetchConnection.fetch(BasePackFetchConnection.java:301)
at org.eclipse.jgit.transport.BasePackFetchConnection.fetch(BasePackFetchConnection.java:291)
at org.eclipse.jgit.transport.FetchProcess.fetchObjects(FetchProcess.java:247)
at org.eclipse.jgit.transport.FetchProcess.executeImp(FetchProcess.java:160)
at org.eclipse.jgit.transport.FetchProcess.execute(FetchProcess.java:122)
at org.eclipse.jgit.transport.Transport.fetch(Transport.java:1138)
at org.eclipse.jgit.api.FetchCommand.call(FetchCommand.java:130)
... 7 more
Caused by: java.io.EOFException: Packfile is truncated.
at org.eclipse.jgit.transport.PackParser.fill(PackParser.java:1138)
at org.eclipse.jgit.transport.PackParser.access$000(PackParser.java:97)
at org.eclipse.jgit.transport.PackParser$InflaterStream.read(PackParser.java:1663)
at java.io.InputStream.read(Unknown Source)
at org.eclipse.jgit.transport.PackParser.whole(PackParser.java:983)
at org.eclipse.jgit.transport.PackParser.indexOneObject(PackParser.java:916)
at org.eclipse.jgit.transport.PackParser.parse(PackParser.java:487)
at org.eclipse.jgit.internal.storage.file.ObjectDirectoryPackParser.parse(ObjectDirectoryPackParser.java:194)
at org.eclipse.jgit.transport.PackParser.parse(PackParser.java:448)
at org.eclipse.jgit.transport.BasePackFetchConnection.receivePack(BasePackFetchConnection.java:762)
at org.eclipse.jgit.transport.BasePackFetchConnection.doFetch(BasePackFetchConnection.java:363)
... 15 …Run Code Online (Sandbox Code Playgroud) 如何在Windows操作系统中的仿真器上更改电池电量(从50%到70%并且不充电)?有一些指南,但所有指南都是针对Ubuntu的.
我正在尝试使用游标在ListView中显示预填充数据库(超过100000行)中的所有项目.它可以工作,但应用程序启动并显示ListView需要几分钟的时间.有更快的方法吗?我读过有关FTS3表的内容,会有帮助吗?
我正在使用ArrayList<HashMap<String, String>>SimpleAdapter和自定义2行布局.码:
Cursor cursor = sDictionary.query("FTSgesla", new String[] {PodatkovnaBaza.KEY_WORD, PodatkovnaBaza.KEY_DEFINITION}, null, null, null, null, PodatkovnaBaza.KEY_WORD);
if (cursor == null)
{
// There are no results
mTextView.setText("Empty");
}
else
{
HashMap<String, String> item;
if(cursor.moveToFirst())
{
do
{
item = new HashMap<String, String>();
item.put("line1", cursor.getString(0));
item.put("line2", cursor.getString(1));
list.add(item);
}
while(cursor.moveToNext());
}
sa = new SimpleAdapter(GlavniActivity.this, list,
R.layout.result,
new String[] { "line1","line2" },
new int[] {R.id.word, R.id.definition});
mListView.setAdapter(sa);
// Define the on-click listener for the list items
mListView.setOnItemClickListener(new OnItemClickListener() { …Run Code Online (Sandbox Code Playgroud) 我正在使用ActionBarSherlock,然后onOptionsItemSelected在单击特定菜单项时启动新活动.代码在添加ABS之前正常工作,现在我收到了case expressions must be constant expressions错误case.
@Override
public boolean onOptionsItemSelected(com.actionbarsherlock.view.MenuItem item)
{
switch (item.getItemId()) {
case R.id.about: //error
startActivity(new Intent(this, AboutActivity.class));
break;
case R.id.feedback: //error
//launch activity
break;
default:
break;
return super.onOptionsItemSelected(item);
}
Run Code Online (Sandbox Code Playgroud)
在添加ActionBarSherlock之前,相同的代码工作正常.