Sunday, October 7, 2012

In java, How to print reversely in a given String?

In java, How to print reversely in a given String?

class ReveseString{
public static void main(String args[]){
String s="String is immutable";
for(int i=s.length()-1; i>=0; i--){
System.out.print(s.charAt(i));
}
}
}

How to write a program in java to display given certain pattern?

How to write a program in java to display given certain pattern?

1
12
123
1234
12345
 
class Example5{
public static void main(String args[]){
 for(int i=1;i<6;i++){
System.out.println();
 for(int j=1; j<=i; j++){
System.out.print(j);
 }
}
}
}


Friday, October 5, 2012

How to Extend the Volume/Size of the C drive in Windows 7?

How to Extend the Volume/Size of the C drive in Windows 7?

1.Right click on my computer and select manage



2.Next Click Storage< Disk Management
You will be see something similar to this image.



3.You sould have free space near to C drive. for example if you have D drive adjacent to C drive. You should backup the data of D drive to another Drive and need to be delete the D drive.

4.Then Right click on C drive. you can see "extend voulme" option in the panel. If your "extend volume" option disable in that panel that means you don't have adjacent drive with free sapce. So you should do the step 3.

5.  After that You will be asked  for how much amount you need to allocate for the C drive. Select the Directions as what you want. Finally you have done.


Tuesday, January 3, 2012

How to Disable Back button in android


/**
* To disable back button(when click back button nothing happen)
*/
@Override
public void onBackPressed() {
  return;
}

How to Launch Activities from different application in android



For Example We have two application with same package and Different Namespace.
First Application: Com.Example.Application1
Second Application: Com.Example.Application2
In this case you can define common Manifest file for both Application1 and Application2 as given below
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="Com.Example">
And add given line to your manifest file
<activity android:name=".Application2/Activity2">
  <intent-filter>
    <action android:name="Application2.intent.action.Launch" />
    <category android:name="android.intent.category.DEFAULT" />
  </intent-filter>
</activity>
Now you can create an Intent to launch Activity2 from the Activity1 with this line of code:
Intent intent = new Intent("Application2.intent.action.Launch");
startActivity(intent);