I ask you a suggestion for my application. I have to develop one app with this characteristics :
1- only portrait
2- when open the app it shows the bluetooth devices presents
3- when you click on one device the app ask to the user an unlock code and show the connect button
4- after press connect button the app show a loading spinner bar whith two o three buttons
The point is : is It better that I used three different fragment for each behavior or not ?
For now I have did :
one activity for the scan device
one activity for the unlock code
but i don't know where I can put the loading screen (loading spinner bar and the three buttons)
Now I'm thinking of develop in different way. One central activity that handles the loading of 3 different fragments :
one for scan device
one for unlock code and one for loading screen
But I'm new in the Android programming, and I always wonder if I think in correct way or in the wrong way .
And in last : for communicate the chosen device from fragment to the activity I think I will implement a listener in mainactivity. Is it right ?
****EDIT :** *I have another doubt regarding the main question.***
Now after your advice I want develop this app in this way :
Main Activity
- Scan DEvice fragment
Unlock Device fragment
Loading fragment
- Started Under Service
In the precedent version I thought to develop three different activity and to use binder and messange to communicate in two direction way to/from the service
Now,instead, there are three different fragments inside the main activity. My question is : for you is better implement the comunication to the service inside mainactivity or inside every single fragment ?
For instance : User selects a device in the scan fragment, this fragment communicates the choise directly to the service or communicates the choise to the mainactivity which forwards the information to the service ?
Thanks for your time :)