Showing posts with label Android codes. Show all posts
Showing posts with label Android codes. Show all posts

Friday, 22 June 2012


 

import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

public class FfffActivity extends Activity {
 String t="ms event";
 public void onCreate(Bundle                savedInstanceState) 
{
 super.onCreate(savedInstanceState);
 setContentView(R.layout.main);
  Log.d(t,"in the onCreate state");
}

 public void  onStart() {
  super.onStart();
  Log.d(t,"in the onStart state");       
  }
 public void  onRestart() {
  super.onRestart();
  Log.d(t,"in the onRetart state");
  }
 public void  onResume() {
  super.onResume();
  Log.d(t,"in the onResume state");
  }
 public void  onPause() {
  super.onPause();
  Log.d(t,"in the onPause state");
  }
 public void  onStop() {
  super.onStop();
  Log.d(t,"in the onStop state");
  }
 public void  onDestroy() {
  super.onDestroy();
  Log.d(t,"in the onDestroy state");
  }
  
}



Press on back button,home button,Call button And see the changes in Log cat

Thursday, 21 June 2012

JAVA  CODE

Button bt=(Button)findViewById(R.id.button1);bt.setOnClickListener(new View.OnClickListener() {public void onClick(View v) {
Context context = getApplicationContext();
CharSequence text = "This is the Toast message!";
int duration = Toast.LENGTH_SHORT;Toast toast = Toast.makeText(context, text, duration);toast.show();
              
            }
        });

A toast notification is a message that pops up on the surface of the window. It only fills the amount of space required for the message and the user's current activity remains visible and interactive. The notification automatically fades in and out, and does not accept interaction events.
Context context = getApplicationContext();
CharSequence text = "This is the Toast message!";
int duration = Toast.LENGTH_SHORT;
Toast toast = Toast.makeText(context, text, duration);
toast.show();

Saturday, 9 June 2012

AbsoluteLayout




AbsoluteLayout is based on the simple idea of placing each control at an absolute position. You specify the exact x and y coordinates on the screen for each control. This is not recommended for most UI development (in fact AbsoluteLayout is currently deprecated) since absolutely positioning every element on the screen makes an inflexible UI that is much more difficult to maintain.  Consider what happens if a control needs to be added to the UI. You would have to change the position of every single element that is shifted by the new control.

Blogroll

Blogger templates

About