我一直在尝试从SQLite数据库中获取所有行.但是我从下面的代码中得到了最后一行.
FileChooser类:
public ArrayList<String> readFileFromSQLite() {
fileName = new ArrayList<String>();
fileSQLiteAdapter = new FileSQLiteAdapter(FileChooser.this);
fileSQLiteAdapter.openToRead();
cursor = fileSQLiteAdapter.queueAll();
if (cursor != null) {
if (cursor.moveToFirst()) {
do {
fileName.add(cursor.getString(cursor.getColumnIndex(FileSQLiteAdapter.KEY_CONTENT1)));
} while (cursor.moveToNext());
}
cursor.close();
}
fileSQLiteAdapter.close();
return fileName;
}
Run Code Online (Sandbox Code Playgroud)
FileSQLiteAdapter类:
public Cursor queueAll() {
String[] columns = new String[] { KEY_ID, KEY_CONTENT1 };
Cursor cursor = sqLiteDatabase.query(MYDATABASE_TABLE, columns, null,
null, null, null, null);
return cursor;
}
Run Code Online (Sandbox Code Playgroud)
请告诉我,我的错误在哪里.欣赏.
login.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
if( username_text.getText().toString() == "admin" &&
pass_text.getText().toString() == "password"){
startActivityForResult(i, ACTIVITY_CREATE);
}else{
Toast.makeText(gps_gui.this, "Your username or password is not correct! Please, insert again",
Toast.LENGTH_SHORT).show();
clearEditText();
}
}
});
Run Code Online (Sandbox Code Playgroud)
我试着检查它,我发现如果情况不行.
我试图找到如何使海拔高于平均海平面.此时,它从椭圆体返回高度.因此,任何人都知道公式或计算将高度值从椭球改变为平均海平面的高度值.
谢谢你的帮助
从android教程:
pass_text.setOnKeyListener(new OnKeyListener() {
public boolean onKey(View v, int keyCode, KeyEvent event) {
// If the event is a key-down event on the "enter" button
if ((event.getAction() == KeyEvent.ACTION_DOWN)
&& (keyCode == KeyEvent.KEYCODE_ENTER)) {
// Perform action on key press
return true;
}
return false;
}
});
}
Run Code Online (Sandbox Code Playgroud)
单击EditText时,框架上会出现一个键盘.在Enter之后我想知道.除了单击Back,如何从框架中输出键盘.
谢谢
我有一个多个复选框,但我希望用户只选择一个复选框.我尝试if-else语句,但它不可用.所以,我想知道,怎么样那样.
谢谢
我尝试创建多个通知.如果单击通知,它将链接到另一个活动.在下面的代码之后,它会创建两行通知.但是,当我点击第一行通知时,它无法正常工作.只有第二个工作.
for (int i = 0; i < missionName.size(); i++) {
mNotificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
final Notification notifyDetails = new Notification(R.drawable.icon,
"Mission Completed, Click Me!", System.currentTimeMillis());
notifyDetails.defaults |= Notification.DEFAULT_SOUND;
notifyDetails.defaults |= Notification.DEFAULT_VIBRATE;
Context context = getApplicationContext();
CharSequence contentTitle = missionName.get(i) + " is completed";
CharSequence contentText = "Please click to view the mission";
Intent notifyIntent = new Intent(getApplicationContext(),MissionMap.class);
notifyIntent.putExtra("missionName", missionName.get(i));
PendingIntent intent = PendingIntent.getActivity(ApplicationMenus.this,
0, notifyIntent, android.content.Intent.FLAG_ACTIVITY_NEW_TASK);
notifyDetails.setLatestEventInfo(context, contentTitle, contentText,
intent);
mNotificationManager.notify(i, notifyDetails);
}
Run Code Online (Sandbox Code Playgroud)
所以,请帮我找出我的错误.非常感谢.
我知道计时器的格式可以是MM:SS或HH:MM:SS,但我想知道如何使用setFormat()和getFormat()来设置HH:MM:SS模式(现在是MM:SS).
这时,我使用:
android:format="@string/chronometer_initial_format"
通过声明设置Format:
<xliff:g id="initial-format">%1$s</xliff:g>
Run Code Online (Sandbox Code Playgroud)
在res/values/strings.xml
我试图通过谷歌搜索,但无法得到很好的答案.有人可以建议吗?谢谢
所以,我想知道如何做到这一点,我非常混淆这个示例语句:
HttpPost httppost = new HttpPost("http://10.0.2.2/city.php");
Run Code Online (Sandbox Code Playgroud)
这意味着我需要编写与PHP服务器连接的应用程序,然后再编写php以连接到数据库吗?
我想为Android和Web服务开发Arcgis,但我不知道它有API吗?如果有的话,可以在地图上标记(比如谷歌地图API)我在我的服务器上收集了lat和long吗?
谢谢你:))
我想创建指令,所以当用户按下下一个按钮时我想设置为下一个布局页面.我试过,setContentView(R.layout.aboutus);
但它似乎将新布局设置为特定页面.
布局:
<?xml version="1.0" encoding="UTF-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:background="#dddddd">
<LinearLayout android:gravity="center" android:background = "@drawable/aboutus"
android:orientation="vertical" android:layout_height="wrap_content"
android:layout_width="wrap_content"/>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
代码:
public void onItemClick(AdapterView<?> parent, View view, int position,
long lg) {
switch (position) {
case 4:
setContentView(R.layout.aboutus);
}
}
Run Code Online (Sandbox Code Playgroud)
所以,我想知道如何在没有新活动的情况下进入下一个布局,并且可以返回上一页.谢谢.
android ×10
altitude ×1
arcgis ×1
checkbox ×1
chronometer ×1
geolocation ×1
if-statement ×1
json ×1
keyboard ×1
layout ×1
mysql ×1
php ×1
sqlite ×1
web-services ×1