我正在创建任务管理器.我有任务列表,我希望当我点击特定的任务列表名称时,如果它为空,那么它继续添加任务活动,但如果它有2或3个任务,那么它会以列表形式向我显示这些任务.
我想在列表中计算.我的数据库查询如下:
public Cursor getTaskCount(long tasklist_Id) {
SQLiteDatabase db = this.getWritableDatabase();
Cursor cursor= db.rawQuery("SELECT COUNT (*) FROM " + TABLE_TODOTASK + " WHERE " + KEY_TASK_TASKLISTID + "=?",
new String[] { String.valueOf(tasklist_Id) });
if(cursor!=null && cursor.getCount()!=0)
cursor.moveToNext();
return cursor;
}
Run Code Online (Sandbox Code Playgroud)
在我的活动中:
list_tasklistname.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0,
android.view.View v, int position, long id) {
db = new TodoTask_Database(getApplicationContext());
Cursor c = db.getTaskCount(id);
System.out.println(c.getCount());
if(c.getCount()>0) {
System.out.println(c);
Intent taskListID = new Intent(getApplicationContext(), AddTask_List.class);
task = adapter.getItem(position);
int taskList_id = …
Run Code Online (Sandbox Code Playgroud) 我想在Android应用程序中设置一个计时器,该计时器将在每次15/30/45之后调用一个函数,并在用户登录时调用n分钟.但是当用户注销时它也会停止计时器.如果用户再次登录,计时器将从启动开始.我希望将该选项(15/30/45/n分钟)保存在数据库中,以便我可以在同步后更新列表.
定时器是一个好方法还是我需要使用报警服务?或者是否需要任何系统服务?
是否可以将本地电话数据库存储中的先前doc /文件更改为通过Web服务器接收的新文档?这样做需要系统服务吗?
我正在使用.net网络服务,我可以在SD卡中下载文件,但我想在特定文件开始下载和完成时显示进度条,然后我想显示视图和取消等选项.
点击事件类:
public void onItemClick(AdapterView<?> parent, View v, int position, long id)
{
LazyAdapter ca = (LazyAdapter)parent.getAdapter();
FolderList item_name = (FolderList)ca.getItem(position);
FolderList DocumentID = (FolderList)ca.getItem(position);
FolderList type = (FolderList)ca.getItem(position);
Intent mIntent = new Intent();
mIntent.putExtra("item_name", item_name.folder_name);
mIntent.putExtra("item_id", DocumentID.ID);
mIntent.putExtra("item_type", type.type);
mIntent.getStringExtra("item_name");
String Type = mIntent.getStringExtra("item_type");
Log.i("Type", Type);
if {
// Some code here...
} else {
Intent i = new Intent(getApplicationContext(), Display_image.class);
i.putExtra("item_name", item_name.folder_name);
i.putExtra("ID", DocumentID.ID);
i.putExtra("item_type", type.type);
i.putExtra("User_ID",User_ID);
i.getStringExtra("item_name");
Id = i.getStringExtra("ID");
i.getStringExtra("item_type");
startActivity(i);
}
}
Run Code Online (Sandbox Code Playgroud)
我的代码:我想使用下载管理器
SoapPrimitive DocumentResponse …
Run Code Online (Sandbox Code Playgroud) 我试图从String获取最后一个subString,因为我有一个文件名tulips.jpg如何才能使用substring方法获得.jpg?
我用过:
String Main_String = dsfdsf.jpg or dfdfgfhfghgh.jpg or dsfsdfgdgsdg.jpg;
(can have any length, not fixed length)
String str_jpg = Main_String.substring(1, Main_String.length());
Run Code Online (Sandbox Code Playgroud)
/////////////////////
for(int i=0; i < folderResponse.getPropertyCount(); i++)
{
SoapObject SingleFolder = (SoapObject)folderResponse.getProperty(i);
ID = Integer.parseInt(SingleFolder.getProperty(0).toString());
KEY_SUBFOLDERNAME = SingleFolder.getProperty(1).toString();
KEY_SUBJECTTYPE = SingleFolder.getProperty(3).toString();
String[] str = KEY_SUBFOLDERNAME.split(".");
for(int j = 0; j < str.length; j++){
System.out.println(""+str[j]);
// you got all name here use what ever you want.
if(str[1] == "jpg"){
FolderList item = new FolderList(JPGimages[0], SingleFolder.getProperty(1).toString();, SingleFolder.getProperty(3).toString();;
Subfolderdata.add(item);
}
Run Code Online (Sandbox Code Playgroud)
请立即建议 …
我想获得一个列表标题,当我在主页上键入Edittext然后在单击"确定"按钮后添加到列表中时,我想要的是什么.现在我不知道从主页Activity上的customAdapter类调用我的刷新方法的位置.
请查看我的HomePage活动:
public class Main_Activity extends Activity implements OnClickListener {
Button ok;
EditText addTasklist;
ListView list_tasklistname;
TodoTask_Database db;
CustomAdapter cAdapter;
List<Tasks> list = new ArrayList<Tasks>();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main_layout);
ok = (Button)findViewById(R.id.add);
ok.setOnClickListener(this);
list_tasklistname = (ListView)findViewById(R.id.listview);
db = new TodoTask_Database(getApplicationContext());
list = db.getAllTaskList();
CustomAdapter adapter = new CustomAdapter(Main_Activity.this, R.layout.tasklist_row, list);
list_tasklistname.setAdapter(adapter);
/*list_tasklistname.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View v, int position,
long id) {
}
});*/
db.close();
}
}
@Override
public void onClick(View v) …
Run Code Online (Sandbox Code Playgroud) android android-arrayadapter android-listview custom-adapter
我有二进制流,我希望它以字节转换.之后我想将它下载到SD卡中.
我的网络服务:
POST /**********Mobile/**********.asmx HTTP/1.1
Host: ***.***.*.*
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://tempuri.org/GetDocument"
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<GetDocument xmlns="http://tempuri.org/">
<DocumentID>string</DocumentID>
</GetDocument>
</soap:Body>
</soap:Envelope>
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<GetDocumentResponse xmlns="http://tempuri.org/">
<GetDocumentResult>string</GetDocumentResult>
</GetDocumentResponse>
</soap:Body>
</soap:Envelope>
Run Code Online (Sandbox Code Playgroud)
我在想的是
SoapObject DocumentRequest = new SoapObject(NAMESPACE, GET_DOCUMENT_METHOD);
DocumentRequest.addProperty("DocumentID", ID);
Log.i("DocumentID", ID);
SoapSerializationEnvelope Envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
Envelope.dotNet = true;
Envelope.setOutputSoapObject(DocumentRequest);
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
androidHttpTransport.debug = true;
androidHttpTransport.call(SOAP_ACTION_GETDOCUMENT, Envelope); …
Run Code Online (Sandbox Code Playgroud)