Skip to content Skip to sidebar Skip to footer

Packagemanager Issue In Android

I can't get date in properManner, I use PackageManager: Code example ::List applications = getPackageManager().getInstalledPackages(0); for(PackageInfo

Solution 1:

Look right there in your code. It says long firstInstalled = info.firstInstallTime;. It is a number representing the number of milliseconds since January 1, 1970 00:00:00 UTC.

Maybe you want a more readable representation of that info?

Calendarcal= Calendar.getInstance();
cal.setTimeInMillis(firstInstalled);

Now you can extract and display the values for hour, day, year, etc. from the cal variable. See Calendar for further info.

Solution 2:

Use below code

Date d = newDate(firstInstalled);
d.getDate();
d.getMonth();
d.getYear();

Post a Comment for "Packagemanager Issue In Android"