Hey guys,
I have some kind of sophisticated problem:
For my current development project, I need to be able to list all resources an app has. As there is no native method I had two ideas in mind:
(1)Using aapt
(2)Using Reflection
As I don't know how to use aapt on android and think that it's to slow, I dont really want to do it.
The next idea is reflection pretty much loading the R class from the apk and iteration through it's inner classes (R$drawables etc.) and getting the fields.
Code:
String pathToApk = getPackageManager().getPackageInfo(packageid, 0).applicationInfo.sourceDir;
PathClassLoader pathClassLoader = new PathClassLoader(pathToApk, getClassLoader());
Class resClass = pathClassLoader.loadClass(packageid + ".R");
for (Class classObject: resClass.getDeclaredClasses()) {
for (Field field : classObject.getDeclaredFields()) {
//classObject.getName() is the type of resource
//field.getName() is the field
}
}
This works perfectly but it stops working once the apps are obfuscated. Is there a better way to do this? Or has anyone an idea how to spot the R class in obfuscated apps?
Thanks in advance
Well i dont think it would be a sign of good security within android if any normal app could read the clear names of variables etc from another app when this one is obfuscated, clearly with the aim of preventing others from reading those names. Maybe there is a way of doing so by using root permissions but i also think this could be hard, because the key to de-obfuscate an app is only stored on the owners dev computer..
---------------------------------
Phone : Nexus 4
OS :
- KitKat 4.4.4 stock
- Xposed: 58(app_process); 54(bridge)
- SU: SuperSU
- no custom recovery
---------------------------------
4d 61 73 72 65 70 75 73 20 66 74 77
Gesendet von Tapatalk
Related
Sir, I am new to android,please help me to fetch data's from database to a sliding menu of the app
aswanthrc said:
Sir, I am new to android,please help me to fetch data's from database to a sliding menu of the app
Click to expand...
Click to collapse
This code snippet assumes you have a getter/setter class for News items. In addition I am using the ActioBarSherlock library so if you aren't using that but you are using fragments then you need to replace instances of "getSherlockActivity()" with just "getActivity()" - if you're just using standard activities then you get replace it with "this"
Code:
List<HashMap<String, String>> newsListItems = new ArrayList<HashMap<String, String>>();
List<News> news = dbhandler.getAllNews();
for (News n : news) {
HashMap<String, String> map = new HashMap<String, String>();
map.put("listTitle", n.getTitle());
map.put("listDate", n.getDate());
newsListItems.add(map);
}
ListAdapter newsListAdapter = new SimpleAdapter(getSherlockActivity(), newsListItems, R.layout.list_news_nav_drawer,
new String[]{"listTitle", "listDate"}, new int[]{R.id.titleNews, R.id.dateNews});
newsListView.setAdapter(newsListAdapter);
The output of this code in my app is shown in this screenshot.
Please let me know if you need any help in understanding the code
Thaq
thaq...
Jonny said:
This code snippet assumes you have a getter/setter class for News items. In addition I am using the ActioBarSherlock library so if you aren't using that but you are using fragments then you need to replace instances of "getSherlockActivity()" with just "getActivity()" - if you're just using standard activities then you get replace it with "this"
Code:
List<HashMap<String, String>> newsListItems = new ArrayList<HashMap<String, String>>();
List<News> news = dbhandler.getAllNews();
for (News n : news) {
HashMap<String, String> map = new HashMap<String, String>();
map.put("listTitle", n.getTitle());
map.put("listDate", n.getDate());
newsListItems.add(map);
}
ListAdapter newsListAdapter = new SimpleAdapter(getSherlockActivity(), newsListItems, R.layout.list_news_nav_drawer,
new String[]{"listTitle", "listDate"}, new int[]{R.id.titleNews, R.id.dateNews});
newsListView.setAdapter(newsListAdapter);
The output of this code in my app is shown in this screenshot.
Please let me know if you need any help in understanding the code
Click to expand...
Click to collapse
what exactly does the ActionBarSherlock do? [emoji16]
---------------------------------
Phone : Nexus 4
OS:
Pure KitKat 4.4.2 stock, no root, no mods
---------------------------------
4d 61 73 72 65 70 75 73 20 66 74 77
Gesendet von Tapatalk
Masrepus said:
what exactly does the ActionBarSherlock do? [emoji16]
---------------------------------
Phone : Nexus 4
OS:
Pure KitKat 4.4.2 stock, no root, no mods
---------------------------------
4d 61 73 72 65 70 75 73 20 66 74 77
Gesendet von Tapatalk
Click to expand...
Click to collapse
http://actionbarsherlock.com/
For the purposes I use it for I guess I could use android.support.v7.app.ActionBarActivity but I started work on the app before the support library was updated (only been working on it off and on during spare time so its taken ages) and I'm way too lazy to go back and refactor/recode the needed bits now when I'm 90% finished
Thanks buddy
Haha okay i see
---------------------------------
Phone : Nexus 4
OS:
Pure KitKat 4.4.2 stock, no root, no mods
---------------------------------
4d 61 73 72 65 70 75 73 20 66 74 77
Gesendet von Tapatalk
Hi,
I am Bart, I am 14 years old and I live in Belgium. For my blog I would like toe make a sort of Material Design styled RSS reader so people can read my blog on their mobile devices. My blog is about Android so I would like to make it only for Android users, but the problem is: I don't know anything about Java or C++ so I would like to ask if someone could help me building the app. (Or if he/she wants building it for me)
I hope someone would like to help me.
Thanks!
Bart
Have a look at github.com for an open source rss reader or use an app builder service
Gesendet von meinem LG-D855 mit Tapatalk
Appyet.com is such a service you could try
---------------------------------
Phone : Nexus 4
OS :
- KitKat 4.4.4 stock
- Xposed: 58(app_process); 54(bridge)
- SU: SuperSU
- no custom recovery
---------------------------------
4d 61 73 72 65 70 75 73 20 66 74 77
Gesendet von Tapatalk
Hi, I'm doing an application which I need to send two variables encunetran in the following class:
public class MiLocationListener implements LocationListener{
public void onLocationChanged(Location loc){
if (loc != null) {
double lat = loc.getLatitude();
double lon = loc.getLongitude();
The lat and lon variable, I must send by post to the HttpHandler class
//AÑADIR PARAMETERS
List<NameValuePair> params = new ArrayList<NameValuePair>();
params.add(new BasicNameValuePair("latitud",lat)); // no reconoce lat ni lon
params.add(new BasicNameValuePair("longitud",lon)); // no reconoce lat ni lon
I should add code to take me the value of those variables?
I hope your help, I need it fast.
greetings
Try using shared prefs to save the two values
Or why dont you let your httphandler class implement locationlistener?
---------------------------------
Phone : Nexus 4
OS :
- KitKat 4.4.4 stock
- Xposed: 58(app_process); 54(bridge)
- SU: SuperSU
- no custom recovery
---------------------------------
4d 61 73 72 65 70 75 73 20 66 74 77
Gesendet von Tapatalk
Hi Guys,
I am new to live wallpaper..Can any one explain me how to create live wallpaper in android..:fingers-crossed::fingers-crossed:
Hey man, how about googling for tutorials and then asking SPECIFIC questions -_-
Well but there you are, because i dont want to only be unhelpful... http://www.vogella.com/tutorials/AndroidLiveWallpaper/article.html
---------------------------------
Phone : Nexus 4
OS :
- KitKat 4.4.4 stock
- Xposed: 58(app_process); 54(bridge)
- SU: SuperSU
- no custom recovery
---------------------------------
4d 61 73 72 65 70 75 73 20 66 74 77
Gesendet von Tapatalk
As mentioned above, this isn't very specific. If you wish to create a Live Wallpaper rendered with an OpenGl renderer, this source was of great help for me:
www.learnopengles.com/how-to-use-opengl-es-2-in-an-android-live-wallpaper/
If you have specific questions about using OpenGl in a live wallpaper (supposing that you already implemented something), it could be that I have some answers. Btw. I especially had problems with using both a wallpaper and an app frontend in the same apk. Maybe I could post parts of the Manifest file, if that's what you are interested in.
Hey guys,
am using the actionbar in my application. when rotating the device, one of them is added right next to the first instance of it. performing multiple orientation results in having a bunch of these icons right next to each other.
Do you might know why?
I'm using the navigation drawer and used the official tutorial to do that and a base activity to spread it accross my application. Only the visible icon is multiplied, so none of the ones hidden.
If any additional information is needed, let me know asap! I will post it but I am not sure what it might be, thus not doing it right now.
Bests,
mcmardy
Well what i would do, i would create a different menu.xml for landscape mode which contains one item more than the other one
---------------------------------
Phone : Nexus 4
OS :
- KitKat 4.4.4 stock
- Xposed: 58(app_process); 54(bridge)
- SU: SuperSU
- no custom recovery
---------------------------------
4d 61 73 72 65 70 75 73 20 66 74 77
Gesendet von Tapatalk