Friday, November 26, 2010

Android same capability or methods


  1. Toast.makeText(this, "activity canceled", Toast.LENGTH_SHORT).show();           энэ method нь Tooltip текст шиг түр хугацаанд гарч ирээд алга болно.

  2. View v = activity.getViewInflate().inflate(R.layout.buttons, null, null);
      Button b = (Button)v.findViewById(R.id.button_small_left);               энэ жишээ кодыг ашиглаж *layout.xml дотор үүсгэсэн Button гэх мэт компонентоо авч өөрийнхөө Current Activity -д ашиглах боломжтой юм.
  3. Log.i, Log.d, Log.e, Log.i
    int ASSERT Priority constant for the println method.
    int DEBUG Priority constant for the println method; use Log.d.
    int ERROR Priority constant for the println method; use Log.e.
    int INFO Priority constant for the println method; use Log.i.
    int VERBOSE Priority constant for the println method; use Log.v.
    int WARN Priority constant for the println method; use Log.w.
     
  4. int resourceId = Activity.getResources().getIdentifier("imagename", "drawable", "your.package.name"); энэ чадварыг ашиглан resourse нэрээр Id -г авах боломжтой болно. Жишээ нь:
    Bitmap bitmap = BitmapFactory.decodeResource(getResources(), resourceId); 
    imageView.setImageBitmap(bitmap);

    No comments: