java - View not added to application -


i confused. action:

public class zoppenactivity extends activity {      @override     public void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         final hostnamechecker c = new hostnamechecker();         c.execute(this);     } } 

and zoppen_main.xml:

<?xml version="1.0" encoding="utf-8"?> <view xmlns:android="http://schemas.android.com/apk/res/android"     android:layout_width="match_parent"     android:layout_height="match_parent"     android:background="#000"> </view> 

the preview (graphicallayout-tab) has black background, if debug application, there no black background. looks view never added application.

what did wrong?

you need use setcontentview in activity load view.so add oncreate.

public class zoppenactivity extends activity {      @override     public void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.zoppen_main);         final hostnamechecker c = new hostnamechecker();         c.execute(this);     } } 

Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -