2 Dec 2013

How to Increase your Android Phone Memory

In this article we will tell you how to increase your Android phone memory. Here’s the complete discussion:
Internal memory of the old Android phones is just 200 to 400 megabytes. If you want to install some trendy apps and new games, then you will find this limited internal storage irksome. However, by rooting your android phone, you can virtually increase the internal memory of the device by making use of the SD card’s storage as the internal memory to a certain extent.

PREREQUISITES

All you need for this are:
  • A rooted android phone
  • A memory card of 2 GB or above. Less than 2 GB memory cards do not work
  • A memory card reader, but not a phone for this.
  • A computer.
  • Install MiniTool after downloading in your computer.
  • Link2SD app (download from Google Play Store).
  • Take the backup of your memory card and copy the data into a computer’s folder.

PROCESS FOR INCREASING INTERNAL MEMORY OF YOUR ANDROID

Step 1:

MEMORY CARD BACK UP

When you start the process make sure that you have got all the files and folders of memory card backed up. You can do it easily by copying all the files and folder and pasting everything on your computer’s folder.
Step 2:

MEMORY CARD PARTITIONING

Make use of a memory card reader to connect the memory card to your computer. Remember, you cannot make use of a phone, and USB cable to get this done.
  • On the My Computer page of your computer, you can find that a letter is assigned to the memory card (F:), (D:) so note down it.
  • The MiniTool that has been installed previously has to be opened at this point of time.How to Increase your Android Phone Memory
  • Now, right click on the letter assigned for the memory card (e.g:- F:, D:)and delete it.
  • The memory card now will show unallocated space instead of the letter.
  • Right click on the memory card and now choose create as.
  • Now choose primary.
  • Select File system of memory card of 2 GB as FAT and for cards above 2 GB as FAT32.
  • Now decide how much memory you want and reduce the size of the memory card accordingly on partitioning size.
  • Select unallocated space and choose primary under the option create as.
  • File system EXT2 has to be chosen.
  • Click ‘OK‘ and then ‘apply‘ present on the top menu.
  • The process is over, and you need to copy all the data back to the memory card from the computer and insert the card in your phone and reboot it.
Step 3:

CONFIGURATION OF LINK2SD

  • The pre-installed Link2SD is to be opened now.
  • Select the file system ext2, when you are prompted by the Link2SD.
  • Click ‘OK‘ to restart the phone.
  • After the restart, a dialog box appears then click ‘OK‘ again.
  • You can find an icon in the shape of a funnel on the top. Click on it and choose on internal applications.
  • Then you need to select all the apps. To do this, the option key has to be tapped. Select multi-select and press the option select all.
  • From the option key click action—>create link.
  • Options-Link application file, link dalvic-cache, link library files could be seen, choose them and click ‘OK‘.
  • From the second partition of the card, all the apps and games are moved, and a link is created by Link2SD. After this click ‘OK
  • When you install new apps, you need to do the same. That is from Menu–>go to settings–->auto link and the 3 link options are found, select them and click ‘OK‘.
Now, enjoy your android phone with increased internal memory!

How to move All Android Apps to SD Card (Without Rooting Device)

Android apps install to the internal storage by default. If you’ve ever seen your device complain that it is out of memory, especially when trying to install a new app, don’t feel too bad. You can also set the SD card as your default install location. This trick allows you to move almost any app to the SD card – no root access required. Enabling the moving app feature on your phone is much easier than how it may sound like. We shall take you through it step by step.
This tweak requires Android 2.2 or later. To change the default install location, you’ll need to use the ADB, or Android Debug Bridge, utility included with Google’s Android SDK. Following are the Step-by-step Instructions for moving All Android Apps to SD Card (Without Rooting Device).
Move All Android Apps to SD Card (Without Rooting Device)
First of All Hit Like Buttons Shown Below.

1) Enable USB Debugging & Developer Options
The 1st step is to enable USB Debugging.In gingerbread it is placed in Settings> Applications > Development > USB Debugging. And ICS it is placed in Settings > Developer Options > USB Debugging. But, after upgrading it to 4.2 it is missing. If your are on Android 4.2 or higher The USB Debugging and Developer Options are hidden in latest Android 4.2 Jelly Bean. If we want to use those options, manually activate it.  Here is the guide to enable USB debugging on Android 4.2 Jelly Bean running mobiles and tablets.
Developer Options have many features for app developer to test an app on their device from PC via ADB.
  • Go to – Settings > About phone.
  •  Then move on to Build number option
  • Tap on Build number repeatedly about 7 times.
  •  This is enough.
  • After touching 7th time you will see a message that, “you are now a developer”.
Enable usb debugging Developer Options on Android 4.2 Jelly Bean
Now the option will be placed in Settings menu. Normally it placed under System in Settings menu. Then you can enable it in Developer Options and Android Debugging.
Enable usb debugging Developer Options on Android 4.2 Jelly Bean
2) Install the Android SDK
After Enabling USB Debugging You’ll need to download and install Google’s Android SDK on your computer. If you don’t already have Oracle’s Java JDK installed on your computer, you’ll have to download and install it before installing the Android SDK.
Note: You need only Android SDK for this so No need of Downloading Android SKD bundle just download SDK Tools Only.
Install the Android SDK
After you’ve installed both the JDK and Android SDK, launch the SDK Manager from your Start menu.
Install the Android SDK
The ADB utility isn’t installed by default. It’s included in the Android SDK Platform-tools package – select this package and click the Install button to download and install it.
Install the Android SDK
After the process completes, connect your Android device to your computer with its included USB cable. Windows should locate the device and install the appropriate drivers automatically. If it doesn’t, you may have to download and install the appropriate drivers from your Android device’s manufacturer. Do not mount the device after connecting it – just plug it in.
3) Using ADB
Open a Windows Explorer window and navigate to the android-sdkplatform-tools folder. On Windows, you’ll find this folder at C:Program Files (x86)Androidandroid-sdkplatform-tools by default. CheckC:Program FilesAndroidandroid-sdkplatform-tools if you’re using a 32-bit version of Windows.
07 Using ADB
Launch a Command Prompt window in this folder by pressing and holding the Shift button, right-clicking in the folder, and selecting Open command window here.
08 Using ADB
  • Run the adb shell command to enter ADB tools.
08 Using ADB
Command Code:
adb shell
  • Run pm get-install-location command to check the default install location which will be 0.
Using ADB
Command Code:
pm get-install-location
  • Run pm set-install-location 2 command for setting default install location to SD card.
Using ADB
Command Code:
pm set-install-location 2
0 [auto]: Let system decide the best location
1 [internal]: Install on internal device storage
2 [external]: Install on external media
  • Run pm get-install-location command again for conformation of location change.
Using ADB
Command Code:
pm get-install-location

4) Moving Apps to SD Card
Apps that refused to leave your system storage can now be moved to the external storage. For instance, below you’ll see screenshots of the Google Maps app. Before the change was made, the Move to USB Storage button was grayed out. After the change was made, the button is enabled and the app can be moved.
12 Moving
Warning.!!
Some apps shouldn’t be installed to your SD card and should remain installed on the internal storage. The external storage is unavailable when your Android device is mounted on your computer, so apps that remain running all the time should be left on your internal storage. Widgets, launchers, animated wallpapers, and anything you want to use while your Android’s SD card is mounted on your computer should be left on the internal storage.

21 Nov 2013

3 ways to speed up your android phone

You probably used to love your Android phone when it was new and you could zip through different apps with ease, but now you the lag between tapping something and your phone response has become unbearable. Your phone is not the only one that suffers from this malaise. Fear not, because in this article we take a look at some of the ways in which  you can speed up your Android phone.
android sick
In this article we provide 3 ways in which to speed up your android phone and get it back to normal / © AndroidPIT

Clear app cache

Ever since you got your phone, the apps on it have been writing into the app cache and this uses up your phone’s resources in the process which of course makes your phone slower. The way to fix this is to simply visit every app's property page within the settings on your phone and clear the cache on each and every app on your phone. The problem is that with a lot of apps on your phone, it can take a long time to do this so in order to speed up the process, you can install an app called app cache cleaner from the Google Play Store. This allows you to clear the cache on all the apps you have on your phone in one go, so you don’t have to spend a long time doing it manually.

Disable or uninstall the apps you don’t use

You can also disable and uninstall some of those apps that you don’t use as some may be eating up some system resources because they may be running in the background. Some apps that you probably want to target are those that came preloaded on your phone but you really don’t use all that much. If you have rooted your Android, you can get rid of these apps easily. If not, you can simply go to the app properties and disable the app to prevent it from running and using up your phone’s resources.

Remove widgets and shortcuts from the home screen

The widgets and shortcuts that you have on your home screen maybe aesthetically pleasing, but they also contribute to the slow response rate that you get from your phone, so unless you absolutely have to have the hottest YouTube videos on your home screen then just drag them of the screen. It also helps to remove all of the shortcuts from your home screen as well.
By implementing these three suggestions, you can significantly improve the speed of your Android handset. Do you have any other ways you know of that will improve the speed of a phone? If so, please leave us a comment below and we will get back to you.

17 Nov 2013

Android AsyncTask Example


Android how to work with AsyncTask  ?

Android AsyncTask work Threading in android.See this Android Painless Threading .

For Example ,i have AsyncTask which name is MyTask.

MyTask objMyTask = new MyTask();

Now to start AsyncTask call objMyTask.execute();

Rules::

  • The AsyncTask instance must be created in UI thread. 
  • .execute must be invoked on the UI thread.
  • Never call  objMyTask.onPreExecute(), objMyTask.doInBackground()objMyTask.onProgressUpdate() objMyTask.onPostExecute manually.
  • The AsyncTask can be executed only once (an exception will be thrown if a second execution is attempted.)

AsyncTask have Four Main Method...

  1. onPreExecute() 
  2. doInBackground()
  3. onProgressUpdate()
  4. onPostExecute() 

  • onPreExecute-This method is called first when you start AsyncTask using objAsync.execute().And mostly this method is use for initializing dialog(ProgressDialog,CustomDialog) and showing.
  • doInBackground-The main purpose of AsyncTask is accomplished by this method.Any non-UI thread process is running in this method.Such as Rss Feed Reader,Image and video Uploading and Downloading.You cant handle your View in this method.Because this method is non-UI thread.While any background process is running if you want to handle UI therea are  onProgressUpdate method. after completion of process this method send result to OnPostExecute.
  • onProgressUpdate-While backgrounding task is running ,you can handle your UI using this method .Such as status of downloading or uploading task.and this method is called from  doInBackground.Using publishProgress() you can call onProgressUpdate method to update UI while process is running.
  • onPostExecute -This method is called after the background computation finishes.The result of background process in passed in this method as parameters.And now you can dismiss progress dialog ,to indicate that background task is completed.


You can cancel AsyncTask using objAsyncTask.cancel().then you just check in doInBackground,

if (isCancelled()) {
break;
} else {
       //continue...
}


See this Image For more Clear.



15 Nov 2013

A simple example of Alarm Service, using AlarmManager





AlarmManager class provides access to the system alarm services. These allow you to schedule your application to be run at some point in the future. When an alarm goes off, the Intent that had been registered for it is broadcast by the system, automatically starting the target application if it is not already running.

In this exercise, a scheduled alarm of 10 seconds will start a service, MyAlarmService.














Modify main.xml to have two button to start and cancel the alarm.
<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"

android:orientation="vertical"

android:layout_width="fill_parent"

android:layout_height="fill_parent" >

<TextView

android:layout_width="fill_parent"

android:layout_height="wrap_content"

android:text="@string/hello" />

<Button

android:id="@+id/startalarm"

android:layout_width="fill_parent"

android:layout_height="wrap_content"

android:text="Start" />

<Button

android:id="@+id/cancelalarm"

android:layout_width="fill_parent"

android:layout_height="wrap_content"

android:text="Cancel" />

</LinearLayout>


AndroidAlarmService.java, the main activity.
package com.exercise.AndroidAlarmService;



import java.util.Calendar;



import android.app.Activity;

import android.app.AlarmManager;

import android.app.PendingIntent;

import android.content.Intent;

import android.os.Bundle;

import android.os.SystemClock;

import android.view.View;

import android.widget.Button;

import android.widget.Toast;



public class AndroidAlarmService extends Activity {



private PendingIntent pendingIntent;





/** Called when the activity is first created. */

@Override

public void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);

    setContentView(R.layout.main);

    Button buttonStart = (Button)findViewById(R.id.startalarm);

    Button buttonCancel = (Button)findViewById(R.id.cancelalarm);

    buttonStart.setOnClickListener(new Button.OnClickListener(){



 @Override

 public void onClick(View arg0) {

  // TODO Auto-generated method stub



  Intent myIntent = new Intent(AndroidAlarmService.this, MyAlarmService.class);

  pendingIntent = PendingIntent.getService(AndroidAlarmService.this, 0, myIntent, 0);



           AlarmManager alarmManager = (AlarmManager)getSystemService(ALARM_SERVICE);



           Calendar calendar = Calendar.getInstance();

           calendar.setTimeInMillis(System.currentTimeMillis());

           calendar.add(Calendar.SECOND, 10);

           alarmManager.set(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), pendingIntent);

       

  Toast.makeText(AndroidAlarmService.this, "Start Alarm", Toast.LENGTH_LONG).show();

 }});



    buttonCancel.setOnClickListener(new Button.OnClickListener(){



 @Override

 public void onClick(View arg0) {

  // TODO Auto-generated method stub

  AlarmManager alarmManager = (AlarmManager)getSystemService(ALARM_SERVICE);

  alarmManager.cancel(pendingIntent);



           // Tell the user about what we did.

           Toast.makeText(AndroidAlarmService.this, "Cancel!", Toast.LENGTH_LONG).show();





 }});



}

}


MyAlarmService.java, it will be started in 10 seconds triggered by AlarmManager
package com.exercise.AndroidAlarmService;



import android.app.Service;

import android.content.Intent;

import android.os.IBinder;

import android.widget.Toast;



public class MyAlarmService extends Service {



@Override

public void onCreate() {

// TODO Auto-generated method stub

Toast.makeText(this, "MyAlarmService.onCreate()", Toast.LENGTH_LONG).show();

}



@Override

public IBinder onBind(Intent intent) {

// TODO Auto-generated method stub

Toast.makeText(this, "MyAlarmService.onBind()", Toast.LENGTH_LONG).show();

return null;

}



@Override

public void onDestroy() {

// TODO Auto-generated method stub

super.onDestroy();

Toast.makeText(this, "MyAlarmService.onDestroy()", Toast.LENGTH_LONG).show();

}



@Override

public void onStart(Intent intent, int startId) {

// TODO Auto-generated method stub

super.onStart(intent, startId);

Toast.makeText(this, "MyAlarmService.onStart()", Toast.LENGTH_LONG).show();

}



@Override

public boolean onUnbind(Intent intent) {

// TODO Auto-generated method stub

Toast.makeText(this, "MyAlarmService.onUnbind()", Toast.LENGTH_LONG).show();

return super.onUnbind(intent);

}



}


Finally, modify AndroidManifest.xml to have our MyAlarmService listed as service.
<?xml version="1.0" encoding="utf-8"?>

<manifest xmlns:android="http://schemas.android.com/apk/res/android"

  package="com.exercise.AndroidAlarmService"

  android:versionCode="1"

  android:versionName="1.0">

<application android:icon="@drawable/icon" android:label="@string/app_name">

    <activity android:name=".AndroidAlarmService"

              android:label="@string/app_name">

        <intent-filter>

            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />

        </intent-filter>

    </activity>

<service android:name=".MyAlarmService" />

</application>

<uses-sdk android:minSdkVersion="4" />



</manifest>


download filesDownload the files

Voice Recording in Android

Put below code into your main Activity.

private static final String AUDIO_RECORDER_FILE_EXT_3GP = ".3gp";
private static final String AUDIO_RECORDER_FILE_EXT_MP4 = ".mp4";
private static final String AUDIO_RECORDER_FOLDER = "AudioRecorder";
private MediaRecorder recorder = null;
private int currentFormat = 0;
private int output_formats[] = { MediaRecorder.OutputFormat.MPEG_4, MediaRecorder.OutputFormat.THREE_GPP };
private String file_exts[] = { AUDIO_RECORDER_FILE_EXT_MP4, AUDIO_RECORDER_FILE_EXT_3GP };

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
setButtonHandlers();
enableButtons(false);
setFormatButtonCaption();
}

private void setButtonHandlers() {
    ((Button) findViewById(R.id.btnStart)).setOnClickListener(btnClick);
((Button) findViewById(R.id.btnStop)).setOnClickListener(btnClick);
((Button) findViewById(R.id.btnFormat)).setOnClickListener(btnClick);
}

private void enableButton(int id, boolean isEnable) {
((Button) findViewById(id)).setEnabled(isEnable);
}

private void enableButtons(boolean isRecording) {
enableButton(R.id.btnStart, !isRecording);
enableButton(R.id.btnFormat, !isRecording);
enableButton(R.id.btnStop, isRecording);
}

private void setFormatButtonCaption() {
((Button) findViewById(R.id.btnFormat)).setText(getString(R.string.audio_format) + " (" + file_exts[currentFormat] + ")");
}

private String getFilename() {
String filepath = Environment.getExternalStorageDirectory().getPath();
File file = new File(filepath, AUDIO_RECORDER_FOLDER);
if (!file.exists()) {
file.mkdirs();
}
return (file.getAbsolutePath() + "/" + System.currentTimeMillis() + file_exts[currentFormat]);
}

private void startRecording() {
recorder = new MediaRecorder();
recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
recorder.setOutputFormat(output_formats[currentFormat]);
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
recorder.setOutputFile(getFilename());
recorder.setOnErrorListener(errorListener);
recorder.setOnInfoListener(infoListener);
try {
recorder.prepare();
recorder.start();
} catch (IllegalStateException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}

private void stopRecording() {
  if (null != recorder) {
recorder.stop();
recorder.reset();
recorder.release();
recorder = null;
}
}

private void displayFormatDialog() {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
String formats[] = { "MPEG 4", "3GPP" };
builder.setTitle(getString(R.string.choose_format_title)).setSingleChoiceItems(formats, currentFormat, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
currentFormat = which;
setFormatButtonCaption();
dialog.dismiss();
}
}).show();
}

private MediaRecorder.OnErrorListener errorListener = new MediaRecorder.OnErrorListener() {
  @Override
public void onError(MediaRecorder mr, int what, int extra) {
Toast.makeText(AudioRecordingActivity.this, "Error: " + what + ", " + extra, Toast.LENGTH_SHORT).show();
    }
};

private MediaRecorder.OnInfoListener infoListener = new MediaRecorder.OnInfoListener() {
@Override
public void onInfo(MediaRecorder mr, int what, int extra) {
Toast.makeText(AudioRecordingActivity.this, "Warning: " + what + ", " + extra, Toast.LENGTH_SHORT).show();
}
};

private View.OnClickListener btnClick = new View.OnClickListener() {
@Override
public void onClick(View v) {
        switch (v.getId()) {
          case R.id.btnStart: {
             Toast.makeText(AudioRecordingActivity.this, "Start Recording", Toast.LENGTH_SHORT).show();
                enableButtons(true);
             startRecording();
             break;
          }
          case R.id.btnStop: {
             Toast.makeText(AudioRecordingActivity.this, "Stop Recording", Toast.LENGTH_SHORT).show();
             enableButtons(false);
             stopRecording();
             break;
          }
          case R.id.btnFormat: {
             displayFormatDialog();
             break;
          }
       }
    }
};


Main.xml File:-


<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:padding="20dip">
  
    <ImageView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:src="@drawable/ic_launcher"
        android:scaleType="fitCenter"/>
  
        <TextView 
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="@string/app_info"
        android:layout_weight="1.0"
        android:textSize="20dip"/>
      
    <LinearLayout
        android:orientation="horizontal"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content">
      
        <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:id="@+id/btnStart"
                android:text="@string/start_recording"
                android:layout_weight="1.0"/>
              
                <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:id="@+id/btnStop"
                android:text="@string/stop_recording"
                android:layout_weight="1.0"/>
              
        <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:id="@+id/btnFormat"
                android:text="Format (mp4)"
                android:layout_weight="1.0"/>
      
    </LinearLayout>
</LinearLayout>


Add Below Permissions to manifest.xml file.

<uses-permission android:name="android.permission.RECORD_AUDIO"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

Download Full Source Code from below link.

Voice Recording in Android

Don’t forget to provide feedback or follow this blog, if you find this blog is useful.