[Android Software Development] jllmoe:
Help to modify a APK

Hi I am new here and a new user of APKTool. Thanks to the developer of this great tool. I have used it to modify the guidelines for my backup camera. I recently installed a sideview camera plugged into the AV input; now I am trying to add the "bg_distance.png" (id: "sideviewruler") to the attached MTCAVIN.apk, but so far not successful. I thought it would be as easy as modifying the backup camera.

Here is what I have done:

1. made the bg_distance.png;

2. decompiled the apk using APKTool;

3. copied bg_distance.png into the drawable folders drawable-nodpi-v4 and drawable-nodpi-1024x600-v4;

4. added the id "sideviewruler" in the following ids.xml in folder res/values

<?xml version="1.0" encoding="utf-8"?>

<resources>

<item type="id" name="layout">false</item>

<item type="id" name="preview_content">false</item>

<item type="id" name="signalshow">false</item>

<item type="id" name="warntext">false</item>

<item type="id" name="bt_av1">false</item>

<item type="id" name="bt_av2">false</item>

<item type="id" name="sideviewruler">false</item>

</resources>

5. added the drawable "bg_distance.png" in the public.xml in folder res/values

<?xml version="1.0" encoding="utf-8"?>

<resources>

<public type="drawable" name="ic_avin" id="0x7f020000" />

<public type="drawable" name="ico_av1" id="0x7f020001" />

<public type="drawable" name="ico_av2" id="0x7f020002" />

<public type="drawable" name="no_signal_a" id="0x7f020003" />

<public type="drawable" name="bg_distance" id="0x7f020005" />

<public type="layout" name="main" id="0x7f030000" />

<public type="color" name="color_status_bar" id="0x7f040000" />

<public type="color" name="color_hl" id="0x7f040001" />

<public type="color" name="color_text_hl" id="0x7f040002" />

<public type="color" name="color_text" id="0x7f040003" />

<public type="string" name="app_name" id="0x7f050000" />

<public type="string" name="savewarn" id="0x7f050001" />

<public type="string" name="ok" id="0x7f050002" />

<public type="style" name="AvinTheme" id="0x7f060000" />

<public type="id" name="layout" id="0x7f070000" />

<public type="id" name="preview_content" id="0x7f070001" />

<public type="id" name="signalshow" id="0x7f070002" />

<public type="id" name="warntext" id="0x7f070003" />

<public type="id" name="bt_av1" id="0x7f070004" />

<public type="id" name="bt_av2" id="0x7f070005" />

</resources>

6. added the 2nd Imageview line in main.xml in folder res/layout

<?xml version="1.0" encoding="utf-8"?>

<FrameLayout android:id="@id/layout" android:layout_width="fill_parent" android:layout_height="fill_parent"

xmlns:android="http://schemas.android.com/apk/res/android">

<com.microntek.gl.GLFrameSurface android:id="@id/preview_content" android:layout_width="fill_parent" android:layout_height="fill_parent" />

<ImageView android:id="@id/signalshow" android:background="#ff000000" android:visibility="gone" android:layout_width="fill_parent" android:layout_height="fill_parent" android:src="@drawable/no_signal_a" android:scaleType="centerInside" />

<ImageView android:id="@id/sideviewruler" android:background="@drawable/bg_distance" android:visibility="gone" android:layout_width="fill_parent" android:layout_height="fill_parent" />

<TextView android:textSize="20.0sp" android:textColor="#ffff0000" android:gravity="center" android:id="@id/warntext" android:background="#ff000000" android:visibility="gone" android:layout_width="fill_parent" android:layout_height="fill_parent" android:text="@string/savewarn" />

<ImageView android:layout_gravity="right" android:id="@id/bt_av1" android:visibility="gone" android:layout_width="100.0px" android:layout_height="100.0px" android:layout_marginTop="60.0px" android:layout_marginRight="30.0px" android:src="@drawable/ico_av1" />

<ImageView android:layout_gravity="right" android:id="@id/bt_av2" android:visibility="gone" android:layout_width="100.0px" android:layout_height="100.0px" android:layout_marginTop="220.0px" android:layout_marginRight="30.0px" android:src="@drawable/ico_av2" />

</FrameLayout>

7. recompiled the app using APKTool; and

8. replaced the the META-INF folder and AndroidManifest.xml in the recompiled apk with those in the original apk.

Everything seems working out smoothly but did not do what I expected - i.e. the attached modified app is a working app but just does not display the "bg_distance.png".

Could experts here point out what I am missing?

Much appreciated!

Figured out by myself: simply revised to the following

<ImageView android:id="@id/sideviewruler" android:src="@drawable/bg_distance" android:visibility="visible" android:layout_width="fill_parent" android:layout_height="fill_parent" />

it is working perfect.

Hope this is helpful for some.