有沒有辦法解決我的問題?通過活動從數據庫中獲取變量?
下面是我的情況的一個簡單的例子(那不是真正的,它是類似的)。 我有一個活動:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/lib/com.google.ads"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#000000"
tools:context=".MainActivity" >
<com.loopj.android.image.SmartImageView
android:id="@+id/image_switcher"
android:layout_width="500dp"
android:layout_height="match_parent"
android:layout_alignParentTop="true" />
在這種活動我有一個Android:layout_width = 「500dp」。 這裏的值500需要從數據庫中獲取並在此處使用。
如何從活動中調用數據庫? 任何解決方案是可接受的,因爲它的工作:)
我有一些想法: 在onCreate活動調用數據庫,他們以某種方式設置我需要的屬性值。
我很新的android和它很有趣,但我沒有人問。
感謝