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. Here'the image link of what i am doing
Since this is my first project i am getting confused on how to add the clock widget in the main widget.
My activity_main.xml
<LinearLayout>
//some stuff
<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" />
// some stuff
</LinearLayout>
The GraphicalLayout of the activity_main.xml is showing
The following classes could not be instantiated:
- com.itcse.weather.DigitalClock
which i know it should show since i haven't initialized the class anywhere. But i am getting confused in how to do it.
At present i have not done any coding in DigitalClock.java, simply set default layout in AppwidgetProvider. When i run the project on emulator i am getting a new widget of digital clock as option thus that means it is working.
I know i have to initialize DigitalClock Class in my AppWidgetProvider Configure but I am getting confused in how to do so.
I am using a DigitalClock 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?
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??
UPDATE:- I think i am not making myself clear.
Consider that i am making two seperate widgets in my same project. One is DigitalClock which has time and date. Another is main widget which has weather plus time and date. Now i want that to use DigitalClock in place of time and date in main widget. I have declared both widgets seperatly in manifest and they both are working correctly seperatly. Is this possible?