The ModMyTM Family of Sites.
  
Go Back   Android Forums | G-Phone Forums | ModMyGphone > ModMyGPhone Wiki
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
Personal tools

Opening New Screen

From ModMyGPhone Wiki

SDK Version : M5

This code allows calling other classes from a class (or opening a new screen). Useful for starting a new Activity like a new screen or dialog.


try {


         Intent i = new Intent(<this classname>.this, <class to be called>.class);


         startActivity(i); // startSubActivity(i,0) will also work if you just want to open a dialog box.


       }catch (ActivityNotFoundException e)

       {

           showAlert(”Error”, “Activity not found”, “OK”, false);

       }


Intent takes two parameters,


1. The current context of the package.


2. Class to be called.


You also need to declare the new class in the “AndroidManifest.xml” file. Following is a template code :


<activity android:name=”.Classname” android:label=”@string/title”>


         <intent-filter>


         <!– any permissions you want to assign to the new Class–>


         </intent-filter>


</activity>


All times are GMT -6. The time now is 08:14 AM.


Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Powered by vbWiki Pro 1.3 RC5. Copyright ©2006-2007, NuHit, LLC
Copyright 2007-08, ModMy LLC