Search code examples
androidr.java-file

how to find the actual ID except the R.id?


i have a table in my layout, in my onClick function, i have this code:

Bundle dataBundle = new Bundle();  
dataBundle.putInt("id", 4);
dataBundle.putString("timeday", v.getId());
Intent intent = new Intent(getApplicationContext(), ir.udk.gcs.ViewCTRL.class);
intent.putExtras(dataBundle); 
startActivity(intent);

which in line 3, v.getid() returns an int number, but i want the id that i choose in my layout to be returnd as string, my table cels IDs in layout are something like = "sh00", "sh01", "sh02" and...

I want Them, to be puted in my dataBundle, not their int id in R file. Any suggestions?


Solution

  • String name = getResources().getResourceEntryName(v.getId());
    

    should do it. Here you can find the documentation