tag:blogger.com,1999:blog-89706611436726864502008-07-16T16:37:24.561-07:00Android ApplicationsSeverinhttp://www.blogger.com/profile/09507361280695279871noreply@blogger.comBlogger7125tag:blogger.com,1999:blog-8970661143672686450.post-47633960992615627752007-12-07T12:55:00.000-08:002007-12-10T02:50:46.153-08:00Stay In Touch With The Android Events<div style="text-align: justify;">Here are some links to a webpages about the Android:<br /></div><ul style="text-align: justify;"><li><a href="http://www.google-phone.com/">http://www.google-phone.com</a> - News about Android mobiles</li><li><a href="http://androidguys.blogspot.com/">http://androidguys.blogspot.com</a> - Android news<br /></li><li><a href="http://androidcommunity.com/">http://androidcommunity.com</a> - News and forums<br /></li><li><a href="http://ohaandroid.com/">http://ohaandroid.com</a> - The unofficial Open Handheld Alliance community </li><li><a href="http://www.androidev.com/">http://www.androidev.com</a> - Forum for developers</li><li><a href="http://www.androidcomponents.com/">http://www.androidcomponents.com</a> - Android components forum<br /></li><li><a href="http://www.anddev.org/">http://www.anddev.org</a> - Forum for developers<br /></li><li><a href="http://www.androiddevelopment.org/">http://www.androiddevelopment.org</a> - Applications made by Germans</li><li><a href="http://androidwiki.com/">http://androidwiki.com/</a> - Android wiki</li></ul><div style="text-align: justify;">Hope that those links will be usefull for you too.<br /></div>Severinhttp://www.blogger.com/profile/09507361280695279871noreply@blogger.comtag:blogger.com,1999:blog-8970661143672686450.post-25893437822843815092007-12-07T11:03:00.001-08:002007-12-07T12:19:20.524-08:00TableLayout Example<div style="text-align: justify;">Today's sample code will implement very similar UI to the one created in the <a href="http://androiddevel.blogspot.com/2007/12/linearlayout-example.html">LinearLayout Example</a>. But here we will be using a <a href="http://code.google.com/android/reference/android/widget/TableLayout.html">TableLayout widget</a> instead.<br /><br />Each TableLayout consists of a number of TableRow objects and each TableRow object contains zero or more cells. Each cell can hold one <a href="http://code.google.com/android/reference/android/view/View.html">View</a> object. The table has as many columns as the row with the most cells and cells can of course span columns. Here is a simple example of a "Sign In" form created with the TableLayout container:<br /></div><div class="code"><?xml version="1.0" encoding="utf-8"?><br /><TableLayout <br /> xmlns:android="http://schemas.android.com/apk/res/android"<br /> android:layout_height="fill_parent" <br /> android:layout_width="fill_parent"<br /> android:background="#000044"><br /> <TableRow><br /> <TextView id="@+id/textName" <br /> android:text="Name:"<br /> android:textColor="#ffffff" /><br /> <EditText id="@+id/editName" <br /> android:width="240px" /><br /> </TableRow><br /> <TableRow><br /> <TextView id="@+id/textPasswd" <br /> android:text="Password:"<br /> android:textColor="#ffffff" /><br /> <EditText id="@+id/editPasswd" <br /> android:password="true" /><br /> </TableRow><br /> <TableRow><br /> <Button id="@+id/buttonSignIn" <br /> android:text="Sign In" /><br /> </TableRow><br /></TableLayout><br /></div><div style="text-align: justify;">Notice, that there aren't specified <span style="font-family:courier new;">layout_width</span> and <span style="font-family:courier new;">layout_height</span> attributes in the XML file. It's because <a href="http://code.google.com/android/reference/android/widget/TableRow.html">TableRow</a> always enforces those values to be respectively <a href="http://code.google.com/android/reference/android/view/ViewGroup.LayoutParams.html#FILL_PARENT">fill_parent</a> and <a href="http://code.google.com/android/reference/android/view/ViewGroup.LayoutParams.html#WRAP_CONTENT">wrap_content</a>.<br /><br />Source: <a href="http://code.google.com/android/">Google Android</a><span style="text-decoration: underline;"></span><br /></div>Severinhttp://www.blogger.com/profile/09507361280695279871noreply@blogger.comtag:blogger.com,1999:blog-8970661143672686450.post-72041974492132102652007-12-06T14:49:00.000-08:002007-12-07T11:41:57.123-08:00LinearLayout Example<div style="text-align: justify;">So if you want to create a UI using a XML file, you will need to put the XML file into your project's res/layouts folder. Here is a simple UI using the <a href="http://code.google.com/android/reference/android/widget/LinearLayout.html">LinearLayout</a>:<br /></div><div class="code"><?xml version="1.0" encoding="utf-8"?><br /><LinearLayout<br />xmlns:android="http://schemas.android.com/apk/res/android"<br />android:layout_height="fill_parent"<br />android:layout_width="fill_parent"<br />android:background="#000044"<br />android:orientation="vertical"><br /><TextView<br />id="@+id/textName"<br />android:text="Name:"<br />android:layout_width="wrap_content"<br />android:layout_height="wrap_content"<br />android:textColor="#ffffff"/><br /><EditText<br />id="@+id/editName"<br />android:text=""<br />android:layout_width="fill_parent"<br />android:layout_height="wrap_content"/><br /><TextView<br />id="@+id/textPasswd"<br />android:text="Password:"<br />android:layout_width="wrap_content"<br />android:layout_height="wrap_content"<br />android:textColor="#ffffff"/><br /><EditText<br />id="@+id/editPasswd"<br />android:layout_width="fill_parent"<br />android:layout_height="wrap_content"<br />android:password="true"/><br /><Button<br />id="@+id/buttonSignIn"<br />android:text="Sign In"<br />android:layout_width="wrap_content"<br />android:layout_height="wrap_content"/><br /></LinearLayout></div><div style="text-align: justify;">If you start your <a href="http://androiddevel.blogspot.com/2007/12/say-hello-to-world.html">"Hello world!!" app</a> having this file in a proper place (i.e. res/layouts/main.xml) you shall still see the same "Hello world!!" text on the emulator's screen. To tell the Android to use the XML file you have to change one line in the Java code. Concretely this line:<br /></div><div class="code">setContentView(tv);</div><div style="text-align: justify;">To this:<br /></div><div class="code">setContentView(R.layout.main);</div><div style="text-align: justify;"><div style="text-align: justify;">Now, after the compilation and running the app you should see our new screen presence of the app. It should be a simple "Sign In" form.<br /></div><br /><div style="text-align: justify;">Try to make some changes to the XML file to get yourself more familiar with a XML defined UI. If you need some help, check the <a href="http://code.google.com/android/reference/index.html">Android's API reference</a> page or leave me a comment.<br /></div></div>Severinhttp://www.blogger.com/profile/09507361280695279871noreply@blogger.comtag:blogger.com,1999:blog-8970661143672686450.post-74836948405567049262007-12-05T10:54:00.000-08:002007-12-05T11:44:35.178-08:00Implementing a User Interface<div style="text-align: justify;">To give your application some "face" you will have to somehow define the UI. The Android API gives you two ways how to do it. You can write your app's UI directly in the Java code using objects and their methods or you can define it through a XML file. I guess that the most of programmers (including me) will choose the second option.<br /><br />The Basic units of a user interface are <a href="http://code.google.com/android/reference/android/view/View.html">Views</a> and <a href="http://code.google.com/android/reference/android/view/ViewGroup.html">ViewGroups</a>. Those basic screen elements are held in a tree structure as shown on a picture below. Every View represents some screen widget (TextView, EditView, Button etc.) and every ViewGroup serves as a base class for layouts.<br /></div><br /><div style="text-align: justify;"><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://code.google.com/android/images/viewgroup.png"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px;" src="http://code.google.com/android/images/viewgroup.png" alt="" border="0" /></a>Next time we will provide you with some examples of a simple UIs using several layouts.<br />Source: <a href="http://code.google.com/android/">Google Android</a><br /></div>Severinhttp://www.blogger.com/profile/09507361280695279871noreply@blogger.comtag:blogger.com,1999:blog-8970661143672686450.post-65176933268642944372007-12-02T14:49:00.000-08:002007-12-06T14:53:15.420-08:00Say Hello To The WorldToday I will show you the easiest app. It can be nothing else than a "Hello world!!" program :). <a href="http://code.google.com/android/intro/hello-android.html">The code</a> is taken from Google's <a href="http://code.google.com/Android">official Android website</a>.<br /><div class="code">public class HelloAndroid extends Activity {<br />/** Called when the activity is first created. */<br /> @Override<br /> public void onCreate(Bundle icicle) {<br /> super.onCreate(icicle);<br /> TextView tv = new TextView(this);<br /> tv.setText("Hello, Android");<br /> setContentView(tv);<br /> }<br />}</div>Severinhttp://www.blogger.com/profile/09507361280695279871noreply@blogger.comtag:blogger.com,1999:blog-8970661143672686450.post-38225896279254980262007-12-01T14:22:00.001-08:002007-12-01T14:40:35.972-08:00The First Steps In The Android WorldIn order to write your first app for the Android mobile, you have to download the <a href="http://code.google.com/android/download.html">Android SDK</a>. As was said before the only programming language you can write the code in is Java. There are many great Java IDEs (I personaly prefer <a href="http://www.netbeans.org/">NetBeans</a>), but the Android plugin is released just for Eclipse. So if you mean it with the Android seriously, you should also download the <a href="http://www.eclipse.org/downloads/">Eclipse IDE</a>.<br /><div style="text-align: left;"><br />If you're not familiar with the Eclipse IDE (my case :)) than I recommend Google's <a href="http://code.google.com/android/intro/installing.html">step by step installing guide</a>.</div>Severinhttp://www.blogger.com/profile/09507361280695279871noreply@blogger.comtag:blogger.com,1999:blog-8970661143672686450.post-76745374749988021262007-12-01T11:51:00.001-08:002007-12-08T08:04:44.672-08:00The Android Introduction<div style="text-align: left;"><a href="http://code.google.com/android">Android</a> is a platform for developing aplications for a mobile phones. The group of more than 30 companies behind is called the <a href="http://www.openhandsetalliance.com/">Open Handheld Alliance</a> which includes companies like Google, Intel, Texas Instruments, Samsung, Telefonica etc. According to the <a href="http://www.openhandsetalliance.com/oha_members.html">list of members</a> of OHA it's supposed that the Android will be used on the next generation mobile phones.<br /><br />The whole concept is to provide free and open platform for developing applications for those devices. Every Android mobile will be based on <a href="http://www.linux.org/">linux OS</a> with some middleware and core applications. The important thing is that you, as a developer, will have the same possibilities as a developers of the core applications. The only programming language for developing the Android apps is Java (which makes sense beacause of it's portability). The whole API you can see bellow.<br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://code.google.com/android/what-is-android.html"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp3.blogger.com/_UJyRmT1RUCY/R1HENXb3MPI/AAAAAAAAACQ/MXF_iM27tnM/s320/system-architecture.jpg" alt="" id="BLOGGER_PHOTO_ID_5139104383714668786" border="0" /></a><br />Sources: <a href="http://code.google.com/Android">Google Android</a><br /></div>Severinhttp://www.blogger.com/profile/09507361280695279871noreply@blogger.com