Archive

Archive for March, 2009

Tutorial – How to start a new Activity

March 31st, 2009

For starting a new Activity we need to use intent, which is an abstract description of an operation to be performed.

http://developer.android.com/reference/android/content/Intent.html

Suppose we are on Activity named ‘CurrentActivity‘ and on certain event (like button click..) we want to start a new Activity named ‘NextActivity’

We can create a new activity as follows.

public class NextActivity extends Activity {

//Your member variable declaration here

// Called when the activity is first created.
@Override
public void onCreate(Bundle savedInstanceState) {
//Your code here
}
}

After we have created the new Activity, we have to register it in file ‘AndroidManifest.xml’.
For registering we have to create an entry in ‘AndroidManifest.xml’ as

<activity android:name=".NextActivity"
android:label="@string/app_name">

</activity>

Note that here we have not used intent filter , since we are going to use an explicit intent, the syntax of intent filter is

<intent-filter>

<action android:name="<action here>"/>

<category android:name="<category here>"/>

</intent-filter>

Here,
action — The general action to be performed

category — Gives additional information about the action to execute. For example, CATEGORY_LAUNCHER means it should appear in the Launcher as a top-level application, while CATEGORY_ALTERNATIVE means it should be included in a list of alternative actions the user can perform on a piece of data.

Note: you can also use application tab below the ‘AndroidManifest.xml’ file, and in ‘Application Nodes’ section click
‘Add’ button as shown in figure below and select the activity .

Application Node-Add Activity

Application Node-Add Activity

Next you can start this activity on any event as follows

Intent myIntent = new Intent(CurrentActivity.this, NextActivity.class);
CurrentActivity.this.startActivity(myIntent);

Here, you have to create and intent with CurrentActivity.this as first parameter
and the the next activity as second parameter.

After you have created the intent, you can start the new activity by calling
startActivity, on current Activity, with the created intent as parameter.

Android , ,

T-Mobile G1 Accounting for 20% of UK Contract Sales? | Android Central

March 10th, 2009

AndroidCentral reports that T-Mobile G1 is accounting for 20% sales in UK for T-Mobile. Read the complete report here. So good news for Androiders is that the market is picking up for Android based smart phones in Europe. With rise in sales for Android, we should see more and more cool applications developed on the platform.

By the way, we have been completely busy with few client projects and hence blog took a backseat for almost a month. But good news is we are back!

Mobile Market, News ,