android - Parse Error in some phones -
i have created simple app works fine on phone 4.2.1. works on 1 of friends phone runs icecream sandwich. when tested on friends phone(note 2) runs 4.1.1 not getting installed. doing wrong.
my xml file:
<scrollview xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/scrollview01" android:layout_width="match_parent" android:layout_height="match_parent" > <relativelayout android:id="@+id/relativelayout01" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@color/orange" > <textview android:id="@+id/textview2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentleft="true" android:layout_alignparenttop="true" android:layout_marginleft="15dp" android:layout_margintop="120dp" android:text="technical\nenglish -i" android:textappearance="?android:attr/textappearancemedium" android:textsize="18sp" /> <textview android:id="@+id/textview3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentleft="true" android:layout_alignparenttop="true" android:layout_marginleft="15dp" android:layout_margintop="185dp" android:text="engineering\nphysics i" android:textappearance="?android:attr/textappearancemedium" android:textsize="18sp" /> <textview android:id="@+id/textview4" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentleft="true" android:layout_alignparenttop="true" android:layout_marginleft="15dp" android:layout_margintop="250dp" android:text="engineering\nchemistry i" android:textappearance="?android:attr/textappearancemedium" android:textsize="18sp" /> <textview android:id="@+id/textview5" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentleft="true" android:layout_alignparenttop="true" android:layout_marginleft="15dp" android:layout_margintop="315dp" android:text="compter\nprogramming" android:textappearance="?android:attr/textappearancemedium" android:textsize="18sp" /> <textview android:id="@+id/textview6" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentleft="true" android:layout_alignparenttop="true" android:layout_marginleft="15dp" android:layout_margintop="380dp" android:text="engineering\ngraphics" android:textappearance="?android:attr/textappearancemedium" android:textsize="18sp" /> <textview android:id="@+id/textview7" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentleft="true" android:layout_alignparenttop="true" android:layout_marginleft="15dp" android:layout_margintop="445dp" android:text="computer\nprgramming lab" android:textappearance="?android:attr/textappearancemedium" android:textsize="18sp" /> <textview android:id="@+id/textview8" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentleft="true" android:layout_alignparenttop="true" android:layout_marginleft="15dp" android:layout_margintop="510dp" android:text="engineering\npractices lab" android:textappearance="?android:attr/textappearancemedium" android:textsize="18sp" /> <textview android:id="@+id/textview9" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentleft="true" android:layout_alignparenttop="true" android:layout_marginleft="15dp" android:layout_margintop="575dp" android:text="physics\nchemistry lab" android:textappearance="?android:attr/textappearancemedium" android:textsize="18sp" /> <spinner android:id="@+id/spinner1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentleft="true" android:layout_alignparenttop="true" android:layout_marginleft="200dp" android:layout_margintop="65dp" android:entries="@array/grade" android:prompt="@string/hello_world" android:text="medium text" android:textappearance="?android:attr/textappearancemedium" /> <spinner android:id="@+id/spinner2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentleft="true" android:layout_alignparenttop="true" android:layout_marginleft="200dp" android:layout_margintop="110dp" android:entries="@array/grade" android:prompt="@string/hello_world" android:text="medium text" android:textappearance="?android:attr/textappearancemedium" /> <spinner android:id="@+id/spinner3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentleft="true" android:layout_alignparenttop="true" android:layout_marginleft="200dp" android:layout_margintop="175dp" android:entries="@array/grade" android:prompt="@string/hello_world" android:text="medium text" android:textappearance="?android:attr/textappearancemedium" /> <spinner android:id="@+id/spinner4" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentleft="true" android:layout_alignparenttop="true" android:layout_marginleft="200dp" android:layout_margintop="240dp" android:entries="@array/grade" android:prompt="@string/hello_world" android:text="medium text" android:textappearance="?android:attr/textappearancemedium" /> <spinner android:id="@+id/spinner5" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentleft="true" android:layout_alignparenttop="true" android:layout_marginleft="200dp" android:layout_margintop="305dp" android:entries="@array/grade" android:prompt="@string/hello_world" android:text="medium text" android:textappearance="?android:attr/textappearancemedium" /> <spinner android:id="@+id/spinner6" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentleft="true" android:layout_alignparenttop="true" android:layout_marginleft="200dp" android:layout_margintop="370dp" android:entries="@array/grade" android:prompt="@string/hello_world" android:text="medium text" android:textappearance="?android:attr/textappearancemedium" /> <spinner android:id="@+id/spinner7" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentleft="true" android:layout_alignparenttop="true" android:layout_marginleft="200dp" android:layout_margintop="435dp" android:entries="@array/grade" android:prompt="@string/hello_world" android:text="medium text" android:textappearance="?android:attr/textappearancemedium" /> <spinner android:id="@+id/spinner8" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentleft="true" android:layout_alignparenttop="true" android:layout_marginleft="200dp" android:layout_margintop="500dp" android:entries="@array/grade" android:prompt="@string/hello_world" android:text="medium text" android:textappearance="?android:attr/textappearancemedium" /> <spinner android:id="@+id/spinner9" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentleft="true" android:layout_alignparenttop="true" android:layout_marginleft="200dp" android:layout_margintop="565dp" android:entries="@array/grade" android:prompt="@string/hello_world" android:text="medium text" android:textappearance="?android:attr/textappearancemedium" /> <space android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparenttop="true" android:layout_centerhorizontal="true" android:layout_margintop="55dp" /> <textview android:id="@+id/textview11" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerhorizontal="true" android:layout_margintop="30dp" android:gravity="center" android:text="semester - gpa calculator" android:textappearance="?android:attr/textappearancemedium" android:textsize="20dp" /> <textview android:id="@+id/textview1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentleft="true" android:layout_alignparenttop="true" android:layout_marginleft="15dp" android:layout_margintop="75dp" android:text="mathematics - i" android:textappearance="?android:attr/textappearancemedium" android:textsize="18sp" /> <button android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/textview9" android:layout_centerhorizontal="true" android:layout_margintop="37dp" android:text="calculate" /> <textview android:id="@+id/edittext1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/button1" android:layout_centerhorizontal="true" android:layout_margintop="13dp" android:editable="false" android:ems="10" android:gravity="center" android:inputtype="number" android:textsize="20sp" /> </relativelayout> </scrollview>
my manifest file:
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.gpa" android:versioncode="1" android:versionname="1.0" > <uses-sdk android:minsdkversion="11" android:targetsdkversion="19" /> <supports-screens android:anydensity="true" android:largescreens="true" android:normalscreens="true" android:resizeable="true" android:smallscreens="true" android:xlargescreens="true" /> <application android:allowbackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/apptheme" > <activity android:name="com.example.cgpa.mainactivity" android:label="@string/app_name" android:theme="@style/noactionbar" > <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter> </activity> </application> </manifest>
my main_activity file:
package com.example.cgpa; import java.text.decimalformat; import com.example.gpa.r; import android.os.bundle; import android.view.view; import android.view.view.onclicklistener; import android.widget.adapterview; import android.widget.adapterview.onitemselectedlistener; import android.widget.button; import android.widget.spinner; import android.widget.textview; import android.app.activity; public class mainactivity extends activity implements onclicklistener { textview e1; int g1, g2, g3, g4, g5, g6, g7, g8, g9, cr = 0; int co1 = 0, co2 = 0, co3 = 0, co4 = 0, co5 = 0, co6 = 0, co7 = 0, co8 = 0, co9 = 0; string an, ch; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); final spinner spinner1 = (spinner) findviewbyid(r.id.spinner1); final spinner spinner2 = (spinner) findviewbyid(r.id.spinner2); final spinner spinner3 = (spinner) findviewbyid(r.id.spinner3); final spinner spinner4 = (spinner) findviewbyid(r.id.spinner4); final spinner spinner5 = (spinner) findviewbyid(r.id.spinner5); final spinner spinner6 = (spinner) findviewbyid(r.id.spinner6); final spinner spinner7 = (spinner) findviewbyid(r.id.spinner7); final spinner spinner8 = (spinner) findviewbyid(r.id.spinner8); final spinner spinner9 = (spinner) findviewbyid(r.id.spinner9); button b = (button) findviewbyid(r.id.button1); e1 = (textview) findviewbyid(r.id.edittext1); spinner1.setonitemselectedlistener(new onitemselectedlistener() { @override public void onitemselected(adapterview<?> arg0, view arg1, int arg2, long arg3) { // todo auto-generated method stub string i1 = spinner1.getselecteditem().tostring(); if ("s".equals(i1)) { g1 = 10; co1++; if (co1 == 1) cr = cr + 4; } else if ("a".equals(i1)) { g1 = 9; co1++; if (co1 == 1) cr = cr + 4; } else if ("b".equals(i1)) { g1 = 8; co1++; if (co1 == 1) cr = cr + 4; } else if ("c".equals(i1)) { g1 = 7; co1++; if (co1 == 1) cr = cr + 4; } else if ("d".equals(i1)) { g1 = 6; co1++; if (co1 == 1) cr = cr + 4; } else if ("e".equals(i1)) { g1 = 5; co1++; if (co1 == 1) cr = cr + 4; } else if ("u".equals(i1)) { if (co1 >=1) { cr = cr - 4; co1 = 0; } g1 = 0; } } @override public void onnothingselected(adapterview<?> arg0) { // todo auto-generated method stub } }); spinner2.setonitemselectedlistener(new onitemselectedlistener() { @override public void onitemselected(adapterview<?> arg0, view arg1, int arg2, long arg3) { // todo auto-generated method stub string i2 = spinner2.getselecteditem().tostring(); if ("s".equals(i2)) { g2 = 10; co2++; if (co2 == 1) cr = cr + 4; } else if ("a".equals(i2)) { g2 = 9; co2++; if (co2 == 1) cr = cr + 4; } else if ("b".equals(i2)) { g2 = 8; co2++; if (co2 == 1) cr = cr + 4; } else if ("c".equals(i2)) { g2 = 7; co2++; if (co2 == 1) cr = cr + 4; } else if ("d".equals(i2)) { g2 = 6; co2++; if (co2 == 1) cr = cr + 4; } else if ("e".equals(i2)) { g2 = 5; co2++; if (co2 == 1) cr = cr + 4; } else if ("u".equals(i2)) { if (co2 >= 1) { cr = cr - 4; co2 = 0; } g2 = 0; } } @override public void onnothingselected(adapterview<?> arg0) { // todo auto-generated method stub } }); spinner3.setonitemselectedlistener(new onitemselectedlistener() { @override public void onitemselected(adapterview<?> arg0, view arg1, int arg2, long arg3) { // todo auto-generated method stub string i3 = spinner3.getselecteditem().tostring(); if ("s".equals(i3)) { g3 = 10; co3++; if (co3 == 1) cr = cr + 3; } else if ("a".equals(i3)) { g3 = 9; co3++; if (co3 == 1) cr = cr + 3; } else if ("b".equals(i3)) { g3 = 8; co3++; if (co3 == 1) cr = cr + 3; } else if ("c".equals(i3)) { g3 = 7; co3++; if (co3 == 1) cr = cr + 3; } else if ("d".equals(i3)) { g3 = 6; co3++; if (co3 == 1) cr = cr + 3; } else if ("e".equals(i3)) { g3 = 5; co3++; if (co3 == 1) cr = cr + 3; } else if ("u".equals(i3)) { if (co3 >= 1) { cr = cr - 3; co3 = 0; } g3 = 0; } } @override public void onnothingselected(adapterview<?> arg0) { // todo auto-generated method stub } }); spinner4.setonitemselectedlistener(new onitemselectedlistener() { @override public void onitemselected(adapterview<?> arg0, view arg1, int arg2, long arg3) { // todo auto-generated method stub string i4 = spinner4.getselecteditem().tostring(); if ("s".equals(i4)) { g4 = 10; co4++; if (co4 == 1) cr = cr + 3; } else if ("a".equals(i4)) { g4 = 9; co4++; if (co4 == 1) cr = cr + 3; } else if ("b".equals(i4)) { g4 = 8; co4++; if (co4 == 1) cr = cr + 3; } else if ("c".equals(i4)) { g4 = 7; co4++; if (co4 == 1) cr = cr + 3; } else if ("d".equals(i4)) { g4 = 6; co4++; if (co4 == 1) cr = cr + 3; } else if ("e".equals(i4)) { g4 = 5; co4++; if (co4 == 1) cr = cr + 3; } else if ("u".equals(i4)) { g4 = 0; if (co4 >= 1) { cr = cr - 3; co4 = 0; } } } @override public void onnothingselected(adapterview<?> arg0) { // todo auto-generated method stub } }); spinner5.setonitemselectedlistener(new onitemselectedlistener() { @override public void onitemselected(adapterview<?> arg0, view arg1, int arg2, long arg3) { // todo auto-generated method stub string i5 = spinner5.getselecteditem().tostring(); if ("s".equals(i5)) { g5 = 10; co5++; if (co5 == 1) cr = cr + 3; } else if ("a".equals(i5)) { g5 = 9; co5++; if (co5 == 1) cr = cr + 3; } else if ("b".equals(i5)) { g5 = 8; co5++; if (co5 == 1) cr = cr + 3; } else if ("c".equals(i5)) { g5 = 7; co5++; if (co5 == 1) cr = cr + 3; } else if ("d".equals(i5)) { g5 = 6; co5++; if (co5 == 1) cr = cr + 3; } else if ("e".equals(i5)) { g5 = 5; co5++; if (co5 == 1) cr = cr + 3; } else if ("u".equals(i5)) { g5 = 0; if (co5 >= 1) { cr = cr - 3; co5 = 0; } } } @override public void onnothingselected(adapterview<?> arg0) { // todo auto-generated method stub } }); spinner6.setonitemselectedlistener(new onitemselectedlistener() { @override public void onitemselected(adapterview<?> arg0, view arg1, int arg2, long arg3) { // todo auto-generated method stub string i6 = spinner6.getselecteditem().tostring(); if ("s".equals(i6)) { g6 = 10; co6++; if (co6 == 1) cr = cr + 4; } else if ("a".equals(i6)) { g6 = 9; co6++; if (co6 == 1) cr = cr + 4; } else if ("b".equals(i6)) { g6 = 8; co6++; if (co6 == 1) cr = cr + 4; } else if ("c".equals(i6)) { g6 = 7; co6++; if (co6 == 1) cr = cr + 4; } else if ("d".equals(i6)) { g6 = 6; co6++; if (co6 == 1) cr = cr + 4; } else if ("e".equals(i6)) { g6 = 5; co6++; if (co6 == 1) cr = cr + 4; } else if ("u".equals(i6)) { g6 = 0; if (co6 >= 1) { cr = cr - 4; co6 = 0; } } } @override public void onnothingselected(adapterview<?> arg0) { // todo auto-generated method stub } }); spinner7.setonitemselectedlistener(new onitemselectedlistener() { @override public void onitemselected(adapterview<?> arg0, view arg1, int arg2, long arg3) { // todo auto-generated method stub string i7 = spinner7.getselecteditem().tostring(); if ("s".equals(i7)) { g7 = 10; co7++; if (co7 == 1) cr = cr + 2; } else if ("a".equals(i7)) { g7 = 9; co7++; if (co7 == 1) cr = cr + 2; } else if ("b".equals(i7)) { g7 = 8; co7++; if (co7 == 1) cr = cr + 2; } else if ("c".equals(i7)) { g7 = 7; co7++; if (co7 == 1) cr = cr + 2; } else if ("d".equals(i7)) { g7 = 6; co7++; if (co7 == 1) cr = cr + 2; } else if ("e".equals(i7)) { g7 = 5; co7++; if (co7 == 1) cr = cr + 2; } else if ("u".equals(i7)) { g7 = 0; if (co7 >= 1) { cr = cr - 2; co7 = 0; } } } @override public void onnothingselected(adapterview<?> arg0) { // todo auto-generated method stub } }); spinner8.setonitemselectedlistener(new onitemselectedlistener() { @override public void onitemselected(adapterview<?> arg0, view arg1, int arg2, long arg3) { // todo auto-generated method stub string i8 = spinner8.getselecteditem().tostring(); if ("s".equals(i8)) { g8 = 10; co8++; if (co8 == 1) cr = cr + 2; } else if ("a".equals(i8)) { g8 = 9; co8++; if (co8 == 1) cr = cr + 2; } else if ("b".equals(i8)) { g8 = 8; co8++; if (co8 == 1) cr = cr + 2; } else if ("c".equals(i8)) { g8 = 7; co8++; if (co8 == 1) cr = cr + 2; } else if ("d".equals(i8)) { g8 = 6; co8++; if (co8 == 1) cr = cr + 2; } else if ("e".equals(i8)) { g8 = 5; co8++; if (co8 == 1) cr = cr + 2; } else if ("u".equals(i8)) { g8 = 0; if (co8 >= 1) { cr = cr - 2; co8 = 0; } } } @override public void onnothingselected(adapterview<?> arg0) { // todo auto-generated method stub } }); spinner9.setonitemselectedlistener(new onitemselectedlistener() { @override public void onitemselected(adapterview<?> arg0, view arg1, int arg2, long arg3) { // todo auto-generated method stub string i9 = spinner9.getselecteditem().tostring(); if ("s".equals(i9)) { g9 = 10; co9++; if (co9 == 1) cr = cr + 1; } else if ("a".equals(i9)) { g9 = 9; co9++; if (co9 == 1) cr = cr + 1; } else if ("b".equals(i9)) { g9 = 8; co9++; if (co9 == 1) cr = cr + 1; } else if ("c".equals(i9)) { g9 = 7; co9++; if (co9 == 1) cr = cr + 1; } else if ("d".equals(i9)) { g9 = 6; co9++; if (co9 == 1) cr = cr + 1; } else if ("e".equals(i9)) { g9 = 5; co9++; if (co9 == 1) cr = cr + 1; } else if ("u".equals(i9)) { g9 = 0; if (co9 >= 1) { cr = cr - 1; co9 = 0; } } } @override public void onnothingselected(adapterview<?> arg0) { // todo auto-generated method stub } }); b.setonclicklistener(new onclicklistener() { @override public void onclick(view v) { int = (g1 * 4 + g2 * 4 + g3 * 3 + g4 * 3 + g5 * 3 + g6 *4 + g7 * 2 + g8 * 2 + g9 * 1); double e11 = / (float) cr; decimalformat df = new decimalformat("#.00"); = df.format(e11); ch = string.valueof(an); e1.settext("your gpa " + ch); } }); } @override public void onclick(view arg0) { // todo auto-generated method stub } }
actually working had send him dropbox link , dowloaded link page instead of apk.
Comments
Post a Comment