Questions tagged [android-identifiers]

59 questions
208
votes
3 answers

How can I assign an ID to a view programmatically?

In an XML file, we can assign an ID to a view like android:id="@+id/something" and then call findViewById(), but when creating a view programmatically, how do I assign an ID? I think setId() is not the same as default assignment. setId() is…
25
votes
11 answers

How to change Android App Name and ID of an existing application?

I have two Android projects in Eclipse. I copied the one project from the other, then changed the app name (in strings.xml) and the project name (in Eclipse). But now there is a problem: When I run either of the applications in the emulator, the…
VKurt
  • 395
  • 1
  • 5
  • 7
20
votes
5 answers

Unique Android Device ID after MarshMallow warning "get device identifiers is not recommended"?

I saw one of my best question Is there a unique Android device ID? Edited: I need a solution for Android 10 too. I used some following code to get Unique Id. public static String getDeviceId(Activity context) { PermissionsChecker checker = new…
Pratik Butani
  • 51,868
  • 51
  • 228
  • 375
10
votes
3 answers

android.Settings.Secure.ANDROID_ID

I'm developing an android application and I'm going to use the LVL library to check google play licence. After reading the LVL documentation, I've read that I have to obtain the android.Settings.Secure.ANDROID_ID to obfuscate the google play…
Eduardo
  • 1,079
  • 4
  • 21
  • 49
6
votes
3 answers

GSF ID KEY (google service framework id) as Android device unique identifier

I need to uniquely identify an Android device. I read about ANDROID_ID but it seems to have problems with Android 2.2. Then there are other identifiers related to TelephonyManager, but I reckon they don't work on tablets. So, looking for something…
user2461515
  • 319
  • 1
  • 2
  • 8
5
votes
1 answer

ANDROID - Get persistent device identifier (UUID)

I need a device identifier that persists after the app is uninstalled and reinstalled. I know that UUID class provides an identifier with the method String uniqueID = UUID.randomUUID().toString(); but Android guideline is unclear about its scope…
leodev
  • 208
  • 4
  • 12
5
votes
5 answers

Get View ids in a for loop programatically?

I simply want to know . is there a way to create an id's using for loop I have 10 buttons in xml . there id's are button1,button2,button3... button10 Now i create an Array of Button in java class and do it like this public class Menu extends…
AndroidGeek
  • 30,803
  • 14
  • 212
  • 262
4
votes
1 answer

Get a list of TextFields that are available during runtime?

I'm using an android library called Proteus which inflates layouts during run time with a JSON file we have sitting on our server. This library allows for data binding but my question is how can I get data out of these fields while using my app? I…
Drew
  • 41
  • 5
4
votes
2 answers

Are Android Device ID's case sensitive?

I have get my device IDs from the system all in lower case letters. Some Device ID app in PLayStore return the device IDs in upper case only. I've heard that these kind of IDs for iOS are case sensitive. Are Android device IDs case sensitive? I…
Ralf Wickum
  • 1,300
  • 5
  • 34
  • 66
4
votes
2 answers

Android: programmatically setId is gives a warning Expected resource of type id

I don't know why it happens: If I write the following code: TextView textView = new TextView(this); textView.setId(1); the 1 as id not working and giving me a warning like: Its not working in following values: textView.setId(0+1); //…
Pratik Butani
  • 51,868
  • 51
  • 228
  • 375
4
votes
1 answer

How to persist data between app installs on Android?

I thought there would be some straight forward solution to this. Requirements: Uniquely identify device across app install/uninstall sessions. Options: Use some kind of Android's device-identifier-API each time when needed (read it every time…
vale4674
  • 3,931
  • 13
  • 41
  • 72
3
votes
2 answers

Android_ID in Android O

We use the below code to get a unique ID: String id = Settings.Secure.getString(mContext.getContentResolver(), Settings.Secure.ANDROID_ID); In the Android O changes guide we can see the below points: Android O makes the following…
Sid
  • 1,064
  • 2
  • 18
  • 45
3
votes
0 answers

Attribute values must be constant while injecting views with RoboGuice

I have a project contains 2 applications and 1 library module. I would like to use RoboGuice because of the view injection feature. Currently i cannot inject views in my library module, because generated ids in the R.java file are not constants and…
Adam Varhegyi
  • 13,647
  • 32
  • 108
  • 194
3
votes
2 answers

Is there any legitimate use for @+android:id?

After I upgraded my android tools to latest version to work on API21, trying to compile my project resulted in the following error: update_languages_button_preference_layout.xml:2: note: did you mean to use @+id instead of…
PLNech
  • 3,817
  • 1
  • 21
  • 45
3
votes
5 answers

How to generate id in android randomly and programmatically?

I'm trying to generate random ids for views as shown in following screenshot. But it didn't work. It got null. How should I findViewById ?
Zin Win Htet
  • 2,142
  • 4
  • 26
  • 44
1
2 3 4