我有一个sql查询,它检索两个数据行并将其设置为数组列表。另一方面,我获取该数据并显示在Toast.it上显示第一行数据,之后显示第二行数据。工作正常。但我想做的是当吐司显示第一行数据时,它应该暂停“x”秒并显示第二个数据。
这是我的SQL查询
public ArrayList<Content> getContent(String todayid){
ArrayList<Content> dataArr=new ArrayList<Content>();
SQLiteDatabase db = handler.getWritableDatabase();
String query="select mname from content where schid='"+todayid+"'";
Cursor c = db.rawQuery(query, null);
try {
while (c.moveToNext()) {
String name = c.getString(c.getColumnIndex(DBHandler.MEDIA_NAME));
Content content=new Content();
content.setmName(name);
dataArr.add(content);
}
}catch (Exception e){
}
return dataArr;
}
这是获得sql结果和显示
public void getContent(String todayid){
try {
ScreenDetailsFunc db=new ScreenDetailsFunc(Screen.this);
final ArrayList<Content> content=db.getContent(todayid);
for (final Content data:content){
Toast.makeText(getApplicationContext(),data.getmName()+"",Toast.LENGTH_LONG).show();
}
}catch (Exception e){
}
}
我的“todayid”是16.i将“2.jpg,3.png”添加到数组
答案 0 :(得分:0)
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd">
<context:component-scan base-package="java4s" />
<mvc:annotation-driven />
<bean id="EmployeeService" class="java4s.EmployeeServiceImpl" />
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/jsp/" />
<property name="suffix" value=".jsp" />
</bean>
<bean id="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource"
p:driverClassName="oracle.jdbc.pool.OracleDataSource"
p:url="jdbc:oracle:thin:@localhost:1521:IM"
p:username="user"
p:password="pass" />
</beans>
使用Handler
方法
postDelayed