我想检查数据库中是否存在条目.
我试过了:
private void saveIt() {
MenuItem item = menu.findItem(R.id.menu_2);
myDB = this.openOrCreateDatabase(MY_DATABASE_NAME, MODE_PRIVATE, null);
Cursor c = myDB.rawQuery("SELECT * FROM " + MY_DATABASE_TABLE + " WHERE idwp= '" + id + "'", null);
if(c == null)
{
item.setIcon(R.drawable.b);
try {
myDB.execSQL("INSERT INTO "+MY_DATABASE_TABLE+" (titel, extra, html) VALUES ('"+titel.replace("'", "\"")+"','"+extra.replace("'", "\"")+"','"+html.replace("'", "\"")+"');");
}
finally
{
if (myDB != null)
myDB.close();
}
Toast.makeText(getApplicationContext(), "saved", Toast.LENGTH_SHORT).show();
}
else
{
Toast.makeText(getApplicationContext(), "already exist", Toast.LENGTH_SHORT).show();
}
myDB.close();
}
Run Code Online (Sandbox Code Playgroud)
但它总是说"已经存在".我见过我的数据库.没有条目在哪里id = xxx!
谢谢你的帮助! …
我使用这个模板http://twitter.github.com/bootstrap/examples/carousel.html进行twitter boostrap.
如果我使用Internet Explorer(IE)10打开该站点:标题图像不在顶部!
我需要在IE中使用相同的布局.我可以在样式文件中更改什么?请给我一个提示!非常感谢.
IE 10(错误):
Chrome(右):

css internet-explorer cross-browser internet-explorer-10 twitter-bootstrap
我搜索了一个小时 - 我找不到错误:
public class favdetail extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.favdetail);
setTitle("gespeicherter Artikel");
Intent intent = getIntent();
id = intent.getStringExtra("id");
TextView t1 = (TextView)findViewById(R.id.favtextView1); // Überschrift
t1.setText("sss");
}
}
Run Code Online (Sandbox Code Playgroud)
我在清单中插入活动.此活动开始(主要活动中的按钮单击) - 但不显示元素(来自布局xml/textviews)!
更新: xml布局:
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#ffffff"
android:visibility="gone"
android:id="@+id/scrollmain"
>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<TextView
android:id="@+id/favtextView1"
android:textColor="#000000"
android:text="ddd"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="7dp"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="@+id/favtext3"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/favtextView1"
android:padding="7dp"
android:textAppearance="?android:attr/textAppearanceSmall"/>
<View
android:id="@+id/imgv"
android:layout_width="fill_parent"
android:layout_height="1dp"
android:layout_below="@+id/favtext3"
android:background="@android:color/darker_gray"/>
<WebView
android:id="@+id/webView1"
android:layout_width="match_parent"
android:layout_height="wrap_content" …Run Code Online (Sandbox Code Playgroud) 我必须在sql数据库中保存html源代码(对于Android应用程序).内容必须存储在本地.所以图像也必须保存.我认为继续以下是适当的:
但我怎么能意识到这一点呢?或者我应该用html5保存图像?我希望你能帮助我!
更新:
$search = '(<img.*?src=")([^"]*?(\/[^/]*\.[^"]+))';
$replace = "<img src=\"".data_uri('$2')."\">";
$content = preg_replace($search, $replace, $content);
Run Code Online (Sandbox Code Playgroud)
有人可以更正此代码吗?谢谢!
第二次更新:
例子:
<img class="alignnone" src="https://lh4.googleuserco (...)
<img src="https://lh4.googleuserco (...)
<img width="400" height="100" src='...' (...)
Run Code Online (Sandbox Code Playgroud)