Posts

Showing posts from December, 2013

Bye Bye 2013 Welcome 2014

Image

AndroidManifest.xml

AndroidManifest.xml file contains information about your packages including components of your application like services, actvities, content providers, broadcast receievers etc.   AndroidManifest.xml file looks like this: < manifest   xmlns:android = "http://schemas.android.com/apk/res/android"      package = "com.example.hello"      android:versionCode = "1"      android:versionName = "1.0"   >         < uses-sdk          android:minSdkVersion = "8"          android:targetSdkVersion = "15"   />        < application          android:icon = "@drawable/ic_launcher"          android:label = "@string/app_name"          android:theme = "@style/AppTheme"   >          < activity              android:name = ".MainActivity"              android:label = "@string/title_activity_main"   >              < intent-filter >                  < action   androi

Create SdCard and Use of that SdCard in emulator

Image
Goto cmd, then goto android-sdk->tools directory Now use following command: mksdcard <-l label> <size> <file> For example, I want to create SdCard size of 256 MB and save it in E:\Apps\New folder with name sdcardImage.iso, so I write: mksdcard -l sdCard 256M E:\Apps\New folder\sdcardImage.iso Its done. Your sd card image is created. -l   : A volume label for the disk image which need to create size  : An integer value which specify size of image. It is possibility to specify          size in kilobytes or megabytes. Examples:   1024K  or  1M file  : The file-name/path of the disk image Now lets use of that sdcard image in emulator. Open your AVD manager from eclipse.. Select emulator in which you want to use sdcard image. then edit i n sdcard field, select file and browse the path of your sdcardImage.iso file, you can see the following snap. Now you can use sdcard that you have created in your emulator.

Create AVD or emulator from command prompt (cmd) in eclipse

Image
Press Windows+r, then write cmd Goto your sdk->tools directory Write " android list targets " to generate list of system targets of AVD. You see the following output: From the above list, select id that you want to create avd,  then write: android create avd -n <name> -t <targetID> [-<option> <value>]... e.g. android create avd -n MyAvd -t 20 --abi armeabi-v7a Then as below image, AVD named MyAvd created in eclipse In command you written, --abi is an option for choose CPU/ABI of device. Like this, if you want to customize the device resolution you have to write an option --skin with value, e.g. --skin WVGA800 For delete avd, write: android delete avd -n <name> For open avd, write: emulator -avd <avd-name>

Pull file and Push file in Sdcard

Image
If you want to push file into sdcard or pull file from sdcard in emulator, first you have checked whether your emulator have sdcard storage or not by checking AVD manager settings. If your emulator has sdcard storage, then goto: Windows-> show View-> Other-> find File Explorer open it. You found many fields like acct, cache, config, data, etc. From that find storage field, and inside storage you found sdcard. click on it then you can see some options to the right side of that page with these icons: From these icons, first is for push file onto device and second is for pull file from device... If you want to add folder in sdcard, then click on 4th icon (+) and for removing click on 3rd icon (-)

Internet not working in emulator

If you are using eclipse then,  Go to: Windows-> Preference-> Android-> Launch Write this in Default emulator options field: -dns -server 8.8.8.8 or -dns -server 8.8.4.4.

Activity Life cycle of Android

Image
Activities in the Android are managed as an Activity stack. When an activity is started, it is placed at the top of the stack and becomes the running activity. The previous activity always remains below in the stack, and will not come to the foreground again until the new activity exists. In the activity life cycle there are following methods: onCreate(): Called when the activity is first created. This is where you should do all of your normal static set up: create views, bind data to lists, etc. This method also provides you with a Bundle containing the activity's previously frozen state, if there was one. Always followed by onStart(). onStart(): Called when the activity is becoming visible to the user. Followed by onResume() if the activity comes to the foreground, or onStop() if it becomes hidden. onResume(): Called when the activity will start interacting with the user. At this point your activity is at the top of the activity stack, with user input going to