Tuesday, March 29, 2011

Localization, Boot Process and Sensor

1) What is localization and how to achieve it ?
Answer :-
Android will run on many devices in many regions. To reach the most users, your application should handle text, audio files, numbers, currency, and graphics in ways appropriate to the locales where your application will be used. For more details you can refer : http://developer.android.com/resources/tutorials/localization/index.html


2) You have 4 activity in your application Activity1, Activity2, Activity3, Activity4 and i want to make one of them as the main activity so that when the user select the application in the launcher that particular activity is shown how you do this ?
Answer :- Suppose if i want to make Activity3 as the main activity then we have to make a changes in AndroidManifest.xml .
<activity class=".Activity3" android:label="@string/Activity_3">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="android.intent.category.LAUNCHER" />
             </intent-filter>
</activity>

3) What are the launch mode in android? What are the types of launch mode for an activity and which one is default ?
Answer :-
An instruction on how the activity should be launched. There are four modes that work in conjunction with activity flags (FLAG_ACTIVITY_* constants) inIntent objects to determine what should happen when the activity is called upon to handle an intent. They are:
     "standard"
     "singleTop"
     "singleTask"
     "singleInstance"
The default mode is "standard".
<activity>
android:launchMode=["multiple" | "singleTop" | "singleTask" | "singleInstance"]
</activity>


4) Give a example of implicit intent and explicit intent ?
Answer :-

Implicit Intents - Opening an URL
          Intent implicitIntent = new Intent();
          Uri url=Uri.parse("http://www.ea.com");
          implicitIntent.setAction(Intent.ACTION_VIEW);
          implicitIntent.setData(url);
          context.startActivity(implicitIntent);
Explicit intents - Data transfer between activities
          Intent explicitIntent = new Intent( this, anotherActivity.class );
          explicitIntent.putExtra( "int", 5);
          explicitIntent.putExtra( "string", "hello" );
          startActivity(explicitIntenti);


5) What is the android boot process from power on ?
Answer :- I don't have too much experience in android to give the answer of this question, so please visit this url. This is helpfull to understand the boot process of android devices from power on.  http://www.androidenea.com/2009/06/android-boot-process-from-power-on.html

6) What is Sensor in Android ?
Answer :-
SensorManager lets you access the device's sensors. Get an instance of this class by calling Context.getSystemService() with the argumentSENSOR_SERVICE. Always make sure to disable sensors you don't need, especially when your activity is paused. Failing to do so can drain the battery in just a few hours. Note that the system will not disable sensors automatically when the screen turns off.
public class SensorActivity extends Activity, implements SensorEventListener {
     private final SensorManager mSensorManager;
     private final Sensor mAccelerometer;
     public SensorActivity() {
         mSensorManager = 
         (SensorManager)getSystemService(SENSOR_SERVICE);
         mAccelerometer = 
         mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
     }
     protected void onResume() {
         super.onResume();
         mSensorManager.registerListener(this, mAccelerometer,     
         SensorManager.SENSOR_DELAY_NORMAL);
     }
     protected void onPause() {
         super.onPause();
         mSensorManager.unregisterListener(this);
     }
     public void onAccuracyChanged(Sensor sensor, int accuracy) {
     }
     public void onSensorChanged(SensorEvent event) {
     }
}

7) What is data synchronization in android ?
Answer :-

8) Suppose i have one Activity in application 2 and i want to use that Activity in application 1. How we achieve this ?
Answer :- 

1 comment:

  1. Android localization workflows can be managed more intelligently with a collaborative localization tool like https://poeditor.com/

    ReplyDelete