Add Custom Widget to another widget xml <p>I am developing a weather app like S4 weather app. This app also has a digital clock with it. I want to make other widget for digital clock in the same project and then add that widget to main widget. Hope you get the point. <a href="http://postimg.org/image/e80prvp8n/" rel="nofollow">Here'the image link of what i am doing</a></p> <p>Since this is my first project i am getting confused on how to add the clock widget in the main widget. </p> <pre><code>My activity_main.xml &lt;LinearLayout&gt; //some stuff &lt;com.itcse.weather.DigitalClock xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/digitalClock" /&gt; // some stuff &lt;/LinearLayout&gt; </code></pre> <p>The <code>GraphicalLayout</code> of the <code>activity_main.xml</code> is showing </p> <pre><code>The following classes could not be instantiated: - com.itcse.weather.DigitalClock </code></pre> <p>which i know it should show since i haven't initialized the class anywhere. But i am getting confused in how to do it.</p> <p>At present i have not done any coding in <code>DigitalClock.java</code>, simply set default layout in <code>AppwidgetProvider</code>. When i run the project on emulator i am getting a new widget of digital clock as option thus that means it is working.</p> <p>I know i have to initialize <code>DigitalClock</code> Class in my <code>AppWidgetProvider Configure</code> but I am getting confused in how to do so.</p> <p>I am using a <code>DigitalClock</code> separately since that is my custon digital clock and would need to set update period as 0. It would be unnecessary to set the update time of main widget as 0 so i am using this widget. Is this way right?</p> <p>Also i want to ask something that when i finish this project can i upload it here and ask for some suggestions on what should i have actually done. Since this is my first project so i have done a lot of hit and trial and i don't know if i can do this, so i am asking you. Is this allowed??</p> <p>UPDATE:- I think i am not making myself clear. Consider that i am making two seperate widgets in my same project. One is <code>DigitalClock</code> which has time and date. Another is <code>main widget</code> which has weather plus time and date. Now i want that to use <code>DigitalClock</code> in place of time and date in <code>main widget</code>. I have declared both widgets seperatly in manifest and they both are working correctly seperatly. Is this possible?</p>