0 comments

Android how to generate google api key

google api key is use to build an android application witch is use with google map.
to generate it you need to open the open the keytool.exe by comment prompt in your window witch is contain in the java/jdk/bin directory they type keytool -list -keystore your debug.keystore where your debug.keystore is always store in the C:\Users\your user\.android\debug.keystore. please have a look with the image below.
after you do it correct it will ask you for the password. so your password should be "android" after that copy the Certificate fingerprint to past in http://code.google.com/android/maps-api-signup.html on the Certificate finger print fill and check on the I have read and agree with the terms and conditions then click on generate api key button fill with your google mail account. after that you will get the google key to use for build your android project that use with google map.
0 comments

Android using Bundle for sharing variables

Sharing variables between Activities is quite important point during development time of your Application. This Example suppose Activity1 from where you run up other Activity2 based on your selection from submenu. You gonna share variable myValue

From Activity1
Intent intent = new Intent(this,myActivity2.class);
Bundle bundle = new Bundle();
bundle.putString(“myValue“, myValue);
intent.putExtras(bundle);
navigation.this.startActivity(intent);
In Activity2
Bundle bundle = getIntent().getExtras();
act2MyValue= bundle.getString(“myValue“);
//Now is your application powered to share variables between two different activities.
0 comments

Android Button State change Example

This tutorial you will learn how to change the button state xml.
First you need to have 3 image to switch for their state
def.png
disable.png
press.png

Now you need to have button_selector.xml


 
     
     


main.xml


    
    
    

ButtonStateExample.java
package monstercodz.blogspot.com;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.Toast;

public class ButtonstateExample extends Activity implements OnClickListener {
 private Button btn1;
 private Button btn2;
 private boolean checkClick = false;
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        btn1 = (Button)findViewById(R.id.btn);
        btn2 = (Button)findViewById(R.id.btn1);
        btn1.setOnClickListener(this);
        btn2.setOnClickListener(this);
    }
 @Override
 public void onClick(View v) {
  // TODO Auto-generated method stub
  if(v == btn1){
   Toast.makeText(getApplicationContext(), "Button Enable You can click", Toast.LENGTH_LONG).show();
  }else{
   if(!checkClick){
    checkClick = true;
    btn1.setEnabled(false);
   }else{
    checkClick = false;
    btn1.setEnabled(true);
   }
  }
 }
}

you can also download Source codeClick here