Tuesday, December 27, 2011

emulator-arm.exe has stopped working Android

If u encounter this problem while running Android emulator then just
  1) Just change the screen resolution of the target device, And lets hope it works (This didnt work for me)

   I was wondering whether i has something to do with my graphics card as it  was doing fine before I installed some Intel Drivers

Thursday, December 15, 2011

Testing the syntax highlighter for blogger and for java

public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);

this the real code and lets see how it works

To get this kind of code..
Follow steps at: http://heisencoder.net/2009/01/adding-syntax-highlighting-to-blogger.html#comment-form

But the sixth step has one more thing to do.. You have to add this....

<link href="http://lockimage.googlepages.com/SyntaxHighlighter.css" rel="stylesheet" type="text/css"/>

<script language="javascript" src="http://lockimage.googlepages.com/shCore.js"></script>

<script language="javascript" src="http://lockimage.googlepages.com/shBrushCpp.js"></script>

<script language="javascript">



</script>





How to post code in blogger and in html using javascript

Here is the usage and the code to post code....

Here is the link on how to use it....


and here is the main page of the project on googel code.


and here is the list of languages supported



How to use buttons in Android code

This is how I used to code for buttons.

onCreate() {

..
View silentButton = findViewById(R.id.silent_button);
silentButton.setOnClickListener(this);
....
}

public void onClick(View view) {
switch (view.getId()) {
case R.id.silent_button:
mAudio.setRingerMode(AudioManager.RINGER_MODE_SILENT);
break;
case R.id.normal_button:
mAudio.setRingerMode(AudioManager.RINGER_MODE_NORMAL);
break;

}

And this is how one should code


However, instead of applying an OnClickListener to the button in your activity, you can assign a method to your button in the XML layout, using the android:onClick attribute. For example:

 

android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="@string/self_destruct"
android:onClick="selfDestruct" />

Now, when a user clicks the button, the Android system calls the activity's selfDestruct(View) method. In order for this to work, the method must be public and accept a View as its only parameter. For example:

 public void selfDestruct(View view) {

// Kabloey
}

The View passed into the method is a reference to the widget that was clicked.

I knew this because I have started working on Catroid. Thanks





public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);





Code for silence mode, normal mode and vibration mode in android Development

Silence Ringer
You can use the AudioManager to enable and disable silent mode.
AudioManager mAudio = (AudioManager) getSystemService(Activity.AUDIO_SERVICE);
mAudio.setRingerMode(AudioManager.RINGER_MODE_SILENT); // for silent mode
// or...
mAudio.setRingerMode(AudioManager.RINGER_MODE_NORMAL);// for normal mode
Here is the link for class AudioManager.

Wednesday, December 14, 2011

How to kill process in Linux by name and killall process

Here are some of the commands to kill the process

pkill swiftfox

$ pgrep -l swiftfox
7206 swiftfox
7213 swiftfox-bin


This is my favourite. This kills all processes by the name chrome and it is case insensitive
killall -i chrome

How to search in Whole Eclipse Projects


1. Press CTRL+ H.
  1. Choose File Search for plain text search in workspace/selected projects
  2. For specific expression searches, choose the relevant tab (such as Java Search which allows to search for specific identifiers.
Here is the image