[Q] ts possible to use the same layout with different activities? - Android Software Development

Hi
First of all, sorry for my english, and for this basic question...
I've started to develop in android for the first time and i've a lot of doubts, but my main qüestion right now is, Its possible to use the same layout with different activities?.
I'm making a test app with a main screen with multiple buttons (for example player 1, player 2, etc.) and textView (showing the data recolected by the second screen), each button open a new screen with some form fields (name, bitrhday, age, etc...).
I've created a main layout and I want to create a layout for the second screen. This second layout is the same for every player, but the data for every player is different.
What is the best practice for this case?
1 main activity/layout - 1 second activity/layout and pass the data from one to other (it's possible?)
1 main activity/layout - x second activity - 1 layout
1 main activity/layout - x second activity - x layout
Thanks
Regards

to answer the question in your title.. yes! and it is actually recommended. it is one of the perks of using a markup language like xml for layouts.
http://developer.android.com/guide/practices/design/seamlessness.html#multiple-activities

Related

Coming Soon: HotDesk/HotDesk Designer

** Update 3 **
There's another beta coming out soon, with lots of exciting new features.:
* The promised 'folder widget' - display the contents of a folder on your device in a virtual screen. I use this as my 'podcast folder' (inside a dock) so I can select one to listen to.
* Directly select a folder/executable on your device whilst in the designer. Obviously you have to have your device plugged in via USB for this to work.
* A QVGA example desk (previous versions only had VGA)
* Lots of bugfixes.
** Update 2 **
Still working hard to get a preview release to you guys. A lot of the current work is in making the PC-based designer as intuitive as possible - an important factor I believe - don't want any complaints about crashing, etc (I hate that the most - you put hours into something, and it explodes).
Anyway - Some of you have expressed concern that you won't be able to get to your today bar icons (the icons down the bottom of the today screen) - while HotDesk is running. The current solution to this is a context menu bound the the desktop click action - that allows you to clip the window to a certain (configurable) height, whilst simultaneously minimizing all other windows - allowing you to see the today bar behind.
This screenshot demonstrates:
Shot
I hope to have a preview release (that won't have all the features that the final release will have, but will still have lots of cool stuff) - to you by the end of next week. Features expected in the preview release:
* Desktop designer, allowing drag'n'drop drawing of all desktop widgets (of course)
* Background widget - set your background, per virtual screen, to an image of any format that PocketPC can read (png,gif,jpg,bmp)
* Picture widget - place a picture at any location on your virtual screens. Handy for non-active element theme customisation.
* Button widget - Define up/down state images, and an action for your buttons (Actions such as 'go to next/previous/specific vscreen', 'start program', 'show/hide dock window' etc)
* Today item Widget - place any today item installed on your system onto any vscreen
* Gauge widget - Text/Graphical gauges linked to system properties (battery,disk/mem free etc). Graphical gauges have customisable background images, and gauge-bar size/image/location.
* Directory widget - place an icon box of any directory on your PocketPC inside a Virtual Screen or Dock - I use this inside a dock, so I can click an icon saying 'My Podcasts' - and up pops a dock sub-window inside my HotDesk with an iconbox with an icon for each of my podcasts. Think of it as a mini-filemanager in a Dock.
More features to come in the final version - but I just want to get this out there for now so you guys can get the creative juices flowing.
More news soon.
** UPDATE **
Got some screenshots of HotDesk running on my JasJar.
A bit of explanation:
Shot 1: The main screen of the demo desktop I'm working on. Here you see 4 application launchers, 2 text gauges (time/date), and a graphical gauge (battery). The Gauge designer can be seen in the designer screenshot at the bottom of this post.
Shot 2: A 'dock' demo. Clicking the 'folder' icon triggers a 'visibility toggle' action on the dock window. The dock window is a Virtual Screen like any other - it just happens to be nested inside another Vscreen.
Shot 3: A demonstration of nesting Today Plugins inside HotDesk. This is more difficult to code than it sounds: essentially you have to reimplement all the message calls/events that the Today screen does. Surprisingly, this was one of the hardest things to code in HotDesk so far. As you can see, I haven't done background transparency for Today plugins yet, but that is coming soon.
Shot 1
Hi All,
I'm creating a new desktop design tool for WM devices. Its aim is to be both friendly to designers, and also to be powerful enough that it's a useful replacement for the today screen et al.
I won't beat around the bush: I *hate* the today screen. I won't launch into a religious argument about that here - I'm just here to show you the work I've been doing.
Announcing: HotDesk.
Hotdesk contains two components: A program that runs on your WM device, that loads '.desk' files - files which contain all the art, logic etc - of your custom designed desktop. The other component is hotdesk designer - an early screenshot of which I've attached to this post.
The designer will be familiar to anyone that has used any kind of vector graphics tool. You simply drag/drop/move - your components on the 'virtual screens' of your desktop.
HotDesk is based around the concept of 'vscreens' - a desktop contains one or more VScreens - that are tied to an orientation (landscape or portrait). Based on the current orientation of your device, the desktops you design for that orientation are displayed - and the user moves between them using buttons that are tied to the 'change vscreen' action.
I'm sure most of you have seen offerings such as 'Wisbar Advance Desktop', and others. Don't get me wrong - Chris does a great job with Wisbar/Desktop - but HotDesk aims to go far beyond products such as these - by creating a rich set of embeddable components that can be customised to your needs. On my PPC, I often find myself jumping between a thousand separate tiny little applications that perform a certain task, or display a certain device statistic - HotDesk aims to allow you to tie almost any action to a button - or connect any device statistic to a custom graphical gauge (as can be seen in the screenshot)
Current features:
Custom button launchers. Definable graphics for up/down states
Completely customisable gauges (gauge image, cursor image, data source)
Multiple virtual screens, and programmable screen change logic
Different screens for portait/landscape views
File list control - e.g. display files in a folder for easy selection (I use this as a popup from my 'podcast folder')
Embed today plugins - In my opinion, today plugins are generally memory hogs - but if you must, you must
Tab widget - have a tabbed dialog within a vscreen
This application is not yet complete, but I must admit I'm excited by what it does so far. I'll be releasing a beta soon - so watch this space. If you have any feature suggestions (e.g. something you've been aching for, not found in other desktop-type apps) - now is the time to speak up.
Oh yeah, here's the screenshot (sorry for the size):
Designer Screenshot
Alex.
You app sounds like it will take customizing the today screen to a new level!
Looks very promising. Will I have the ability to turn my today screen into a dial pad?
kewl!
shud support QVGA / VGA & Square Screens..that's a plus..!
and abillity to change phone dial skin if possible..
Looks COOL!
If I read that right, it'll allow you to have more than one Today screen? Like a virtual desktop?
If so, is there a way to make the inactive one truely inactive so it doesn't use much RAM? That's probably asking waaaay too much, but would be awfully cool!
Either way, I'll be (not so) patiently watching....
blazoner said:
Looks COOL!
If I read that right, it'll allow you to have more than one Today screen? Like a virtual desktop?
If so, is there a way to make the inactive one truely inactive so it doesn't use much RAM? That's probably asking waaaay too much, but would be awfully cool!
Either way, I'll be (not so) patiently watching....
Click to expand...
Click to collapse
Already done this - there are two 'memory modes' - light and heavy. Light mode dynamically loads each screen (including today plugins). If you don't go to the screen with the plugin, it doesn't load it.
Of course, the trade off is screen load time.
Heavy mode loads all screens at once - heavier on RAM, but faster.
b_sphinx said:
shud support QVGA / VGA & Square Screens..that's a plus..!
and abillity to change phone dial skin if possible..
Click to expand...
Click to collapse
As for the QVGA/VGA - each vscreen has a preconfigured size - the device-side application chooses the correct default vscreen based on the res/orientation. You specify the default starting vscreens in the designer.
so... when is the beta release??
Thanks
Greetings,
Hope to see your product soon,
and yes do make it compatible with omap 850 processor coz its little slower than
others.
And also if you could add minimizing windows like we have in desktop it would be great.
Hope you'll giv it for free cuz i dont have any credit card or any other card to pay. I'll love to have your application.
samy.3660 said:
Greetings,
Hope to see your product soon,
and yes do make it compatible with omap 850 processor coz its little slower than
others.
And also if you could add minimizing windows like we have in desktop it would be great.
Hope you'll giv it for free cuz i dont have any credit card or any other card to pay. I'll love to have your application.
Click to expand...
Click to collapse
I'll come up with some arrangement for people participating in the beta - more information soon.
Hi!
This app seams like "the thing", but will it be WM2003SE compatible?
Regards,
PK
Testing
I would like to be part of the beta testing when avalible. GreggSymington(@)Sbcglobal.net . Looks great so far.
I would also love the opportunity to be in your beta group.
Would it be possible to lock one or more of your Today screens separately?
Also, will there be a toggle for accessing the main (or user defined) Today screen, similar to VJTodayButton?
Both of these functions would be really convenient.
Cool
Greetings,
Yes i will be participating in beta ver.
Is there a testing version yet?
Hi LordChaos
Been playing around with theme development and would love the opportunity to beta test your product
rgds, GA
datruth said:
Looks very promising. Will I have the ability to turn my today screen into a dial pad?
Click to expand...
Click to collapse
I'm going to assume your answer is no.
datruth said:
I'm going to assume your answer is no.
Click to expand...
Click to collapse
If there's enough interest I''ll code a TAPI wrapper - thus allowing this.
Any news?
WoW, nice way of creating virtual desktops. It reminds me to the Wisbar Advanced Desktop plugin for Wisbar Advance 2 but even better since you are also developing a proper tool for PC!!!!!
Congratulations!!!
Oki
Great Work
This looks fantastic. Would love to be in the beta test of this. Keep us posted.

converter program (finger friendly) need suggestions

Hi wanted to create my first program..
right now Im trying to make a unit converter that is finger friendly..
so far I've tested it and here is what I have so far..
any suggestions? regarding the buttons positions, the interface, etc?
thanks
Hi Providense,
Looks good so far.
Do you have a development schedule as to what it will convert?
Keep it up.
John
Provedence,
It seems that some people like to have a configuration facility.
So perhaps some suggestions:-
Favorites so that the list can be tailored to favorites for that person to save a more compact list of 'things to convert'
I would be happy to have any theme for now but cooks may prefer to add there own theme.
I have used this type of function with calculator type programs but they can become unweildy so one that is specific would be usefull.
Thanks
John
thanks Johny1fin
as of now these are the things i've done
Temperature:
degree Celsius
degree Fahreheit
degree Rankine
degree Reaumur
kelvin
Acceleration: (still doing it right now)
centigal
centimeter/square second
decigal
decimeter/square second
dekameter/square second
foot/square second
g-unit(G)
gal
galileo
gn
grav
hectometer/square second
inch/square second
kilometer/hour second
kilomter/square second
meter/square second
mile/hour minute
mile/hour second
mile/square second
milligal
millimeter/square second
still a long way to go. But the Acceleration should be done by today.
Then I'll add Area, Date/Time and etc
I like the idea of favorites. I'll see if i can implement that. Im still a beginner at programming. Using VB.net 2003 right now
oh by the way. Here's the main menu, where I will put all the buttons
providence said:
Hi wanted to create my first program..
right now Im trying to make a unit converter that is finger friendly..
so far I've tested it and here is what I have so far..
any suggestions? regarding the buttons positions, the interface, etc?
thanks
Click to expand...
Click to collapse
Providence,
It may be a limitation of the APIs but could the vertical scroll buttons be next to each other horizontally rather than vertically as this may produce larger buttons?
John
Look nice.. however, on the finger friendly issue, you may want to avoid the scroll list (on your first screenshot) and have another screen for the choice of (say) different temperature units. Something like, making a screen (of your second shot) for temperature units. If you get what i'm trying to say
thanks for the feedbacks i've changed how the scrolling works. Now im using a custom button for that.
Looking good providence
I am not sure if you like this idea, but I think it will be more useful if you can add:
- Currency converter
- Currency quick view (to view several currencies at once)
There is an example of a very nice and complete project with source code here:
http://www.codeproject.com/netcf/PocketCurrency.asp
Add option to have automatic currency update as well
[ x ] Update when connected to ActiveSync
[ x ] Automatic update every X hours
hi, well the main idea was to create a finger based Unit conversion program. To add Currency Converter would be a challenge for myself.
Since first of all, Currency changes daily, so there must be a way to update it. Secondly, im still learning how to program by self teaching myself on my free time.
By the way, Here's the latest screenshot of the program.
I fixed the buttons so its easier to use.
unfortunately, this will only work on PDAphones and not on smartphones. Since you'll need to use the touch screen as input method.
Here is an idea, as mentioned by one of the post above, instead of stacking your scroll button up and down, it may save you that more space if you were to stack them left and right.
From what it seems, the < and > , are buttons, which you use it to 'affect' your lists. If you were to (example) sandwish your list in between these two buttons, you would save like another 2 button height. Example.
Currently, you have the layout
Code:
. item1 <
. item2
. item3 >
. item4
if you can just do this (which is possible in VC, not sure about VB), instead
Code:
< .item1 >
.item2
So, instead of 4 item height, you are now only left with 2 items height.
ahh i see..
I tried doing it
< item 1 >
item 2
but i find it harder to navigate, since when you go back you have to drag your finger across the other side of the screen. And while doing that, you are blocking the item list with your finger.
I dont need to save space, i think i got everything in there..
by the way, here's the test i took
then again, if i put them on the sides, it makes easier for those who are left handed as well
The spaces you save, may able you to bloat up the keypad below.. from what it seems, now they are on the 'flat' side of it.
If you think the "left-list-right" is not very finger friendly, you can try the "list-left-right"? That is
.item1 < >
.item2
Hi thanks for the suggestions..
right now here is what i have, and will probably be the final change in the button positioning..
i got big fingers and I can use them without stylus.
Should have a pre-alpha version ready soon. As of now I've done temperatures and acceleration.
Will add more soon

[Q] ListView without scrolling

Is it possible to create a ListView that only displays all of it's content and does not try to be scrollable ?
I need ListViews, because it's the most convenient solution for my app. I have 3 types of content and each has it's own layout style, own context menus and some of them have on click listeners in one case and context menus in other cases. I have a pretty elegant and sexy solution for this, but it only works with ListViews.
The problem is that I want to have all 3 types of content on one screen that will scroll as ONE, but with multiple list views it scrolls as a whole and all lists scroll independently, which makes my app an unusable piece of ****e.
Please only suggest solutions that use list views.
One that I could think of is to create 3 different screens with flip view or maybe some kind of tab view. Or maybe both and let the user choose. What do you think ?
2 things (as I know you're a good programmer, but still kind of "new") LOL
1. Maybe you can @Override the onTouch methods and disable the scroll
2. Don't EVER get so stuck on an interface (or a method, or a piece of code) that you get into a mindset of "It HAS to be this way". Many hours/days I have wasted with this kind of thinking and sometimes, you just have to give-up and start over.
I know you're in a time constraint, but I also find if I leave a problem for a day or two and come back to it, a solution presents itself.
I already put it aside a few days ago, but I'll have to deal with it soon. Actually I just came up with the tab view idea while writing this post and it seems like a good solution (even better than the original with all 3 lists on one screen).
SOLVED
I implemented a tab layout. Like a BAWSSS.

[Q] Mulitple surfaceviews

Hey,
I know that using multiple surfaceviews is not a good idea. With that aside...
I am trying to make an onscreen joystick to add as an option to a game I am working on. I have a tablet so there is a big enough screen for multiple people to play on the one device, but I want to be able to control from joysticks rather than touching the whole of the screen (as you can imagine 4 people would get in each others way).
I am currently using a surfaceView to display the game on and for single player the normal touchscreen is fine, but I dont quite know how to add the joystick version without putting the joystick on the game map (something I want to avoid).
I have created another layout.xml file to handle my second option, and using a relativeLayout I can put the surfaceview between two other controls (like buttons etc). I dont just want to but 4 buttons for left etc, as I want to have vairable speed which a current_touch_position - centre_joystick_position would achieve.
Sorry for the long entry, but I felt like I needed to justify myself.
Any ideas?
Many thanks,
Steaky
So if anyone is in the same situation as me heres how I solved it.
Using RelativeLayout as a base I split the screen into 3 sections - relativeLayout, surfaceView and relativeLayout. I created a Joystick class that extends the class Button (might change to Bitmap in the future, but I'll go into that). Then put this line into the XML wherever I wanted a joystick
Code:
<view class="com.steaky.game_1.Joystick" android:id="@+id/button_JS2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:minHeight="100dip" android:minWidth="100dip" android:layout_alignParentRight="true"></view>
I used the setOnTouchListener to take the user input and control the cursor.
One problem I encounter was that Buttons only draw when they are no longer being pressed, so the crosshair showing where the user was ressing (and dragging) only updated when the user lifted their finger.

[Q] How to display data in table!?

Hello Guys, I'm a newbie in app development so help me with this (simple) query.
I have an activity with 4 text box asking for user input (name, place, date, time) . Now how to combine these data into a table in another activity.
PS: I have included exit button in main activity. Is it ok or should I include exit option in action bar menu only? Also what is the java function to exit the app?
Sent from my Xperia Mini using Tapatalk 2
ariftwister said:
Hello Guys, I'm a newbie in app development so help me with this (simple) query.
I have an activity with 4 text box asking for user input (name, place, date, time) . Now how to combine these data into a table in another activity.
PS: I have included exit button in main activity. Is it ok or should I include exit option in action bar menu only? Also what is the java function to exit the app?
Click to expand...
Click to collapse
Hi,
You can easily get a Table with the TableLayout, where in each TableRow you would put two EditTexts. In Android you usually don't need to put an edit button in the layout unless you have a service running or so since there is the back button to easily exit. The Java code to exit would be calling this.finish() from the activity.
SimplicityApks said:
Hi,
You can easily get a Table with the TableLayout, where in each TableRow you would put two EditTexts. In Android you usually don't need to put an edit button in the layout unless you have a service running or so since there is the back button to easily exit. The Java code to exit would be calling this.finish() from the activity.
Click to expand...
Click to collapse
Thanks for your suggestion, but I want all the four editText in a single row. How to do it,? Or is there any detailed tutorial?
Sent from my Xperia Mini using Tapatalk 2
ariftwister said:
Thanks for your suggestion, but I want all the four editText in a single row. How to do it,? Or is there any detailed tutorial?
Click to expand...
Click to collapse
You can find a tutorial on the TableLayout here. But if you just want one row, it's easier to just use a LinearLayout with equal weights for each View. If you want to reuse this layout for another activity, put it in a Fragment!
SimplicityApks said:
You can find a tutorial on the TableLayout here. But if you just want one row, it's easier to just use a LinearLayout with equal weights for each View. If you want to reuse this layout for another activity, put it in a Fragment!
Click to expand...
Click to collapse
Thanks but Actually I'm building an app to keep track all the user's debt. So I want to display the debts in a tabular view. It can be single or multiple varying with every user. So what should I use here?
Also how to place the data got from 4 different edittext as single object into another activity?
Sent from my Xperia Mini using Tapatalk 2
ariftwister said:
Thanks but actually I'm building an app to keep track all the user's debt. So I want to display the debts in a tabular view. It can be single or multiple varying with every user. So what should I use here?
Also how to place the data got from 4 different edittext as single object into another activity?
Click to expand...
Click to collapse
You may want to have a look at the samples of the TableFixHeaders library here to do your Layout. Remember putting it in a separate Fragment in case you want to reuse in another activity.
For data passing you need to put it as extra into the Intent you're starting the second activity with. The data structure you use depends on what you want to do. I recommend dropping everything into a new Bundle and pass that on, that way you can also save/restore when rotating. But if you have only the same data like 4 Strings or 4 doubles you could also directly put it as an array extra with intent.putDoubleArrayExtra or putStringArrayExtra

Categories

Resources