thanks for that code.......I tried that ,but still not getting output......can u please guide me.I will attach my code .......I can execute that code without any bug but it will out put only the two strings that we have have added in the xml code........
//here is the code//
Using java Syntax Highlighting
- package com.google.photo;
- import android.app.Activity;
- import android.os.Bundle;
- public class photo extends Activity {
- /** Called when the activity is first created. */
- @Override
- public void onCreate(Bundle icicle) {
- super.onCreate(icicle);
- setContentView(R.layout.main);
- getAllResourceIDs(R.drawable.class);
- }
- private int[] getAllResourceIDs(Class<R.drawable> aClass) throws IllegalArgumentException{
- /* Get all Fields from the class passed. */
- java.lang.reflect.Field[] IDFields = aClass.getFields();
- /* int-Array capable of storing all ids. */
- int[] IDs = new int[IDFields.length];
- try {
- /* Loop through all Fields and store id to array. */
- for(int i = 0; i < IDFields.length; i++){
- /* All fields within the subclasses of R
- * are Integers, so we need no type-check here. */
- // pass 'null' because class is static
- IDs[i] = IDFields[i].getInt(null);
- }
- } catch (Exception e) {
- /* Exception will only occur on bad class submitted. */
- throw new IllegalArgumentException();
- }
- return IDs;
- }
- }
Parsed in 0.035 seconds, using GeSHi 1.0.8.4
//code//
thanks in advance




