Android Development - Snippets: Unterschied zwischen den Versionen

Aus Wikizone
Wechseln zu: Navigation, Suche
Zeile 46: Zeile 46:
  
 
[[Android - Thread Priority]]
 
[[Android - Thread Priority]]
 +
 +
== Files ==
 +
=== Zugriff auf Ressourcen ===
 +
* http://stackoverflow.com/questions/8340445/how-can-i-specify-the-resource-to-get-from-r-res-drawable-dynamically
 +
==== Ressourcen Pfad herausfinden ====
 +
 +
Using Resource Name
 +
 +
Syntax:
 +
 +
android.resource://[package]/[res type]/[res name]
 +
 +
Example : If icon.png image file is available in res/drawable folder you can get path like :
 +
 +
String PATH="android.resource://com.my.package/drawable/icon";
 +
 +
Using Resource Id
 +
 +
Syntax :
 +
android.resource://[package]/[resource_id]
 +
 +
Example : If icon.png image file is available in res/drawable folder you can get path:
 +
 +
String PATH="android.resource://com.my.package/" + R.drawable.icon;
 +
 +
This were the examples to get the URI of any image file stored in drawable folder.
 +
 +
Similarly you can get URIs of res/raw folder also.

Version vom 6. März 2013, 23:05 Uhr

Activities

Android - Neue Activity anlegen und starten

Android - Neue Activity

Layouts

Lock Portrait or Landscape fullscreen - requestwindowfeature

Views

Vertical Seek Bar

Android - Vertical Seek Bar

Events

Android - OnClickListener

Graphic and Animation

Bitmap - ressource und input stream


Sprites

Sound

Unterstützte Formate

Links

Möglichkeiten zur Sound-Ausgabe

SoundPool

MediaPlayer

http://developer.android.com/reference/android/media/MediaPlayer.html

Generate Sound (Ring files + PCM Generation)

System Sounds

Fortgeschrittene Techniken

Threads

Java - Timer und TimerTask

Android - Thread Priority

Files

Zugriff auf Ressourcen

Ressourcen Pfad herausfinden

Using Resource Name

Syntax:

android.resource://[package]/[res type]/[res name]

Example : If icon.png image file is available in res/drawable folder you can get path like :

String PATH="android.resource://com.my.package/drawable/icon";

Using Resource Id

Syntax :

android.resource://[package]/[resource_id]

Example : If icon.png image file is available in res/drawable folder you can get path:

String PATH="android.resource://com.my.package/" + R.drawable.icon;

This were the examples to get the URI of any image file stored in drawable folder.

Similarly you can get URIs of res/raw folder also.