i have developed an app that runs perfectly fine on the simulator but when I try to run it on the phone, the app errors out stating java.io.FileNotException: res/drawable/divider_horizontal_dark.9.png
i thought the app was missing this file (probably android system file) so i found this file elsewhere on the web and placed it under drawable but in vain. the app still errors out with the same error as before.
any idea whats the problem here?
xml file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="wrap_content" android:gravity="left|center"
android:layout_width="wrap_content" android:paddingBottom="5px"
android:paddingTop="5px" android:paddingLeft="5px" >
<ImageView android:id="@+id/linkImage" android:layout_width="wrap_content"
android:layout_height="fill_parent" android:layout_marginRight="6dip"
android:src="@drawable/icon" />
<LinearLayout android:orientation="vertical"
android:layout_width="0dip" android:layout_weight="1"
android:layout_height="fill_parent">
<TextView android:id="@+id/firstLineView"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:gravity="center" android:textColor="#FFFF00" android:text="first line title"></TextView>
<TextView android:id="@+id/secondLineView"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:text="second line title" android:layout_marginLeft="10px" android:gravity="center"
android:textColor="#0099CC"></TextView>
</LinearLayout>
</LinearLayout>
and the part of the code where the app crashes while loading.. you could see that there is no where i have used the file divider_horizontal_dark.9.png
public View getView(int position, View convertView, ViewGroup parent){
ViewHolder holder;
if(convertView == null){
convertView = mInflater.inflate(R.layout.listview,null);
holder = new ViewHolder();
holder.firstLine = (TextView) convertView.findViewById(R.id.firstLineView);
holder.secondLine = (TextView) convertView.findViewById(R.id.secondLineView);
holder.imageView = (ImageView) convertView.findViewById(R.id.linkImage);
//holder.checkbox = (CheckBox) convertView.findViewById(R.id.star);
holder.firstLine.setFocusable(false);
holder.secondLine.setFocusable(false);
holder.imageView.setFocusable(false);
//holder.checkbox.setFocusable(false);
convertView.setTag(holder);
}else{
holder = (ViewHolder) convertView.getTag();
}
.....
seems like they have fixed the issue
http://code.google.com/p/transdroid/issues/detail?id=14
but i somehow dont get it
You need to use an id for the resource instead of trying to open the file by giving the path to it (in the source code). There is plenty of Android documentation to explain how to do that…
http://developer.android.com/guide/topics/resources/providing-resources.html
http://developer.android.com/guide/topics/resources/accessing-resources.html