[Android Q&A, Help & Troubleshooting] flagello79:
Hi,

after he began to study and after much work I was able to decompile completly a Stock apk that have bug ( is the calendarcg.apk here ).

I've the bug only when use the phone setting in italian,franch,spanish,portuguese, (if the phone have english,russian,chinese, no bug)

I tried to contact the factory ( in china...no chanche to have assistance) but i've to solve this problem.

Please give me suggestions.

Tnx.

ERROR LOG

2-27 19:25:55.490: W/dalvikvm(10200): threadid=1: thread exiting with uncaught exception (group=0x4001b6a8)
12-27 19:25:55.496: E/AndroidRuntime(10200): FATAL EXCEPTION: main
12-27 19:25:55.496: E/AndroidRuntime(10200): java.lang.StringIndexOutOfBoundsException
12-27 19:25:55.496: E/AndroidRuntime(10200): at java.lang.String.substring(String.java:1682)
12-27 19:25:55.496: E/AndroidRuntime(10200): at com.android.iphoneview.TimeDateDayOfWeekListAdapter.getView(TimeDateDayOfWeekListAdapter.java:78)
12-27 19:25:55.496: E/AndroidRuntime(10200): at android.widget.AbsListView.obtainView(AbsListView.java:1481)
12-27 19:25:55.496: E/AndroidRuntime(10200): at android.widget.ListView.makeAndAddView(ListView.java:1786)
12-27 19:25:55.496: E/AndroidRuntime(10200): at android.widget.ListView.fillSpecific(ListView.java:1325)
12-27 19:25:55.496: E/AndroidRuntime(10200): at android.widget.ListView.layoutChildren(ListView.java:1629)
12-27 19:25:55.496: E/AndroidRuntime(10200): at android.widget.AbsListView.onLayout(AbsListView.java:1311)
12-27 19:25:55.496: E/AndroidRuntime(10200): at android.view.View.layout(View.java:7224)
12-27 19:25:55.496: E/AndroidRuntime(10200): at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1290)
12-27 19:25:55.496: E/AndroidRuntime(10200): at android.widget.LinearLayout.layoutHorizontal(LinearLayout.java:1279)
12-27 19:25:55.496: E/AndroidRuntime(10200): at android.widget.LinearLayout.onLayout(LinearLayout.java:1085)
12-27 19:25:55.496: E/AndroidRuntime(10200): at android.view.View.layout(View.java:7224)
12-27 19:25:55.496: E/AndroidRuntime(10200): at android.widget.RelativeLayout.onLayout(RelativeLayout.java:943)
12-27 19:25:55.496: E/AndroidRuntime(10200): at android.view.View.layout(View.java:7224)
12-27 19:25:55.496: E/AndroidRuntime(10200): at android.widget.FrameLayout.onLayout(FrameLayout.java:369)
12-27 19:25:55.496: E/AndroidRuntime(10200): at android.view.View.layout(View.java:7224)
12-27 19:25:55.496: E/AndroidRuntime(10200): at android.widget.FrameLayout.onLayout(FrameLayout.java:369)
12-27 19:25:55.496: E/AndroidRuntime(10200): at android.view.View.layout(View.java:7224)
12-27 19:25:55.496: E/AndroidRuntime(10200): at android.widget.FrameLayout.onLayout(FrameLayout.java:369)
12-27 19:25:55.496: E/AndroidRuntime(10200): at android.view.View.layout(View.java:7224)
12-27 19:25:55.496: E/AndroidRuntime(10200): at android.view.ViewRoot.performTraversals(ViewRoot.java:1181)
12-27 19:25:55.496: E/AndroidRuntime(10200): at android.view.ViewRoot.handleMessage(ViewRoot.java:1913)
12-27 19:25:55.496: E/AndroidRuntime(10200): at android.os.Handler.dispatchMessage(Handler.java:130)
12-27 19:25:55.496: E/AndroidRuntime(10200): at android.os.Looper.loop(SourceFile:351)
12-27 19:25:55.496: E/AndroidRuntime(10200): at android.app.ActivityThread.main(ActivityThread.java:3824)
12-27 19:25:55.496: E/AndroidRuntime(10200): at java.lang.reflect.Method.invokeNative(Native Method)
12-27 19:25:55.496: E/AndroidRuntime(10200): at java.lang.reflect.Method.invoke(Method.java:538)
12-27 19:25:55.496: E/AndroidRuntime(10200): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:969)
12-27 19:25:55.496: E/AndroidRuntime(10200): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:727)
12-27 19:25:55.496: E/AndroidRuntime(10200): at dalvik.system.NativeStart.main(Native Method)
12-27 19:25:55.502: D/Settings/Provide(185): lookupValue, table secure cache.fullyMatchesDisk() dropbox:system_app_crash
12-27 19:25:55.502: D/Settings/Provide(185): lookupValue, table secure cache.containsKey send_action_app_error
12-27 19:25:55.502: W/ActivityManager(185): Force finishing activity com.android.calendar/.StartAndEndActivity

And this is the TimeDateDayOfWeekListAdapter

package com.android.iphoneview;

import android.content.Context;
import android.content.res.Resources;
import android.text.format.Time;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.LinearLayout;
import android.widget.TextView;
import java.util.Calendar;
import java.util.Date;

public class TimeDateDayOfWeekListAdapter extends BaseAdapter
{
private int DAY_OF_MONTH = 2;
private int DAY_OF_WEEK = 0;
private final boolean DEBUG = false;
private int MAX_ITEM_COUNT = 20000;
private int MONTH = 1;
private final String TAG = "TimeListDateDayInWeekAdapter";
private int YEAR = 0;
private long mCenterPositonTimeInMillis;
private Context mContext;
private final LayoutInflater mLayoutInflater;

public TimeDateDayOfWeekListAdapter(Context paramContext)
{
this.mContext = paramContext;
this.mLayoutInflater = LayoutInflater.from(paramContext);
}

private Date getDate(long paramLong)
{
Calendar localCalendar = Calendar.getInstance();
localCalendar.setTimeInMillis(paramLong);
localCalendar.set(11, 0);
localCalendar.set(12, 0);
localCalendar.set(13, 0);
localCalendar.set(14, 0);
return localCalendar.getTime();
}

public int getCount()
{
return this.MAX_ITEM_COUNT;
}

public Object getItem(int paramInt)
{
int i = paramInt + 1 - this.MAX_ITEM_COUNT / 2;
String str1 = iphoneUtils.getDate(this.mContext, this.mCenterPositonTimeInMillis, i);
String str2 = String.valueOf(iphoneUtils.getDateTimeInMillis(this.mContext, this.mCenterPositonTimeInMillis, i));
String[] arrayOfString = new String[2];
arrayOfString[0] = str1;
arrayOfString[1] = str2;
return arrayOfString;
}

public long getItemId(int paramInt)
{
return paramInt;
}

public long getMTimeInMillis()
{
return this.mCenterPositonTimeInMillis;
}

public View getView(int paramInt, View paramView, ViewGroup paramViewGroup)
{
LinearLayout localLinearLayout;
TextView localTextView1;
TextView localTextView2;
String str1;
String str2;
if (paramView == null)
{
localLinearLayout = (LinearLayout)this.mLayoutInflater.inflate(2130903076, paramViewGroup, false);
localTextView1 = (TextView)localLinearLayout.findViewById(2131558417);
localTextView2 = (TextView)localLinearLayout.findViewById(2131558636);
int i = paramInt + 1 - this.MAX_ITEM_COUNT / 2;
str1 = iphoneUtils.getDate(this.mContext, this.mCenterPositonTimeInMillis, i);
str2 = iphoneUtils.getDayOfWeek(this.mContext, this.mCenterPositonTimeInMillis, i);
if ((str1.contains("r")) || (str1.contains("a")) || (str1.contains("u")) || (str1.contains("e")))
{
new String[0];
String[] arrayOfString = str1.split(" ");
str1 = arrayOfString[0].substring(0, 3) + " " + arrayOfString[1].toString();
}
int j = Time.getJulianDay(System.currentTimeMillis(), 28800L);
if (i + Time.getJulianDay(this.mCenterPositonTimeInMillis, 28800L) != j)
break label261;
localTextView1.setTextColor(this.mContext.getResources().getColor(2131165192));
localTextView1.setText(this.mContext.getResources().getString(2131361807));
localTextView2.setText("");
}
while (true)
{
return localLinearLayout;
localLinearLayout = (LinearLayout)paramView;
break;
label261: localTextView1.setTextColor(-16777216);
localTextView1.setText(str1);
localTextView2.setTextColor(-7829368);
localTextView2.setText(str2);
}
}

public void setMTimeInMillis(long paramLong)
{
this.mCenterPositonTimeInMillis = paramLong;
}
}