在我的Android應用程序中..我想將用戶的詳細信息保存到SharedPreference ..在同一個應用程序中,我使用sharedpreference來保存登錄信息,並且工作正常。方法我用來保存用戶的詳細信息..但它不工作,並且appp崩潰..在用戶的詳細信息中,用戶名,中間名和姓以及他的出生日期被收集..我在這裏給我的代碼。請幫助..Android將Edittexts的值保存在SharedPreference中
UserDetailsActivity:
public void gReport(View V)
{
long sum1 = 0;
long sum2 = 0;
long sum3 = 0;
long sum7 = 0;
long sum8 = 0;
long sum9 = 0;
long sum10 = 0;
long sum11 = 0;
long sum12 = 0;
long sum13 = 0;
long sum14 = 0;
long sum15 = 0;
long sum16 = 0;
long sum17 = 0;
long sum18 = 0;
long sum19 = 0;
long sum20 = 0;
long sum22 = 0;
long sum23 = 0;
long sum24 = 0;
long sum25 = 0;
long sum70 = 0;
long sum80 = 0;
long sum90 = 0;
//Destiny Number Karmic Debt
long kar1 = 0;
long kar2 = 0;
long kar3 = 0;
long kar7 = 0;
//Heart Number Karmic Debt
long kar4 = 0;
long kar5 = 0;
long kar6 = 0;
long kar8 = 0;
//Talent Number Karmic Debt
//long kar9 = 0;
long kar10 = 0;
long kar11 = 0;
//Personality Number Karmic Debt
long kar12 = 0;
long kar13 = 0;
long kar14 = 0;
long kar15 = 0;
//Minor expression Number Karmic Debt
long kar16 = 0;
long kar17 = 0;
long kar18 = 0;
long kar19 = 0;
//Minor Heart Desire Number Karmic Debt
long kar20 = 0;
long kar21 = 0;
long kar22 = 0;
long kar23 = 0;
//Minor Personality Number Karmic Debt
long kar24 = 0;
long kar25 = 0;
long kar26 = 0;
long kar27 = 0;
//Balance Number Karmic Debt
long kar28 = 0;
//year now to single digit
long yearnow = 0;
//month now to single digit
long monthnow = 0;
//Day now to single digit
long daynow = 0;
long ch = 0;
long ch1 = 0;
long ch2 = 0;
long ch4 = 0;
long ch3 = 0;
long pin1 = 0;
long pin2 = 0;
long pin3 = 0;
long pin4 = 0;
long pin = 0;
long br1 = 0;
long br2 = 0;
long br3 = 0;
long a =0;
int yearat =0;
int monthat = 0;
int dayat = 0;
GregorianCalendar gc = new GregorianCalendar();
yearat = gc.get(Calendar.YEAR);
yearstr = Integer.toString(yearat);
monthat = gc.get(Calendar.MONTH) + 1;
monthstr = Integer.toString(monthat);
dayat = gc.get(Calendar.DAY_OF_MONTH);
daystr = Integer.toString(dayat);
List<Integer> sum21;
EditText et1 = (EditText) findViewById (R.id.editText1);
EditText et2 = (EditText) findViewById (R.id.editText2);
EditText et3 = (EditText) findViewById (R.id.editText3);
EditText et4 = (EditText) findViewById (R.id.editText4);
EditText et5 = (EditText) findViewById (R.id.editText5);
EditText et6 = (EditText) findViewById (R.id.editText6);
EditText et7 = (EditText) findViewById (R.id.editText7);
EditText et8 = (EditText) findViewById (R.id.editText8);
EditText et9 = (EditText) findViewById (R.id.editText9);
sum1 = getSum1(et1.getText().toString());
sum2 = getSum2(et2.getText().toString());
sum3 = getSum3(et3.getText().toString());
sum7 = getSum7(et7.getText().toString());
sum8 = getSum8(et8.getText().toString());
sum9 = getSum9(et9.getText().toString());
sum11 = getSum11((et7.getText().toString()) + (et8.getText().toString()) + (et9.getText().toString()));
sum12 = getSum12(et1.getText().toString() + et2.getText().toString() + et3.getText().toString());
sum13 = getSum13(et1.getText().toString() + et2.getText().toString() + et3.getText().toString());
sum14 = getSum14(et4.getText().toString() + et5.getText().toString() + et6.getText().toString());
sum15 = getSum15(et4.getText().toString() + et5.getText().toString() + et6.getText().toString());
sum16 = getSum16(et4.getText().toString() + et5.getText().toString() + et6.getText().toString());
sum18 = getSum18((yearstr) + (et7.getText().toString() + et8.getText().toString()));
sum19 = getSum19((monthstr) + (sum18));
sum20 = getSum20((daystr) + sum19);
sum21 = getMissingNo(et1.getText().toString() + et2.getText().toString() + et3.getText().toString());
//Destiny Numberkarmic debt
kar1 = getKar1(et1.getText().toString());
kar2 = getKar2(et2.getText().toString());
kar3 = getKar3(et3.getText().toString());
kar7 = getKar7(et1.getText().toString() + et2.getText().toString() + et3.getText().toString());
//Heart Number karmic debt
kar4 = getKar4(et1.getText().toString());
kar5 = getKar5(et2.getText().toString());
kar6 = getKar6(et3.getText().toString());
kar8 = getKar8(et1.getText().toString() + et2.getText().toString() + et3.getText().toString());
//Talent Number Karmic Debt
//kar9 = getKar9(et7.getText().toString());
kar10 = getKar10(et9.getText().toString());
kar11 = getKar11(et7.getText().toString() + et8.getText().toString() + et9.getText().toString());
//Personality Number karmic Debt
kar12 = getKar12(et1.getText().toString());
kar13 = getKar13(et2.getText().toString());
kar14 = getKar14(et3.getText().toString());
kar15 = getKar15(et1.getText().toString() + et2.getText().toString() + et3.getText().toString());
//Minor Expression Number Karmic Debt Calculation
kar16 = getKar16(et4.getText().toString());
kar17 = getKar17(et5.getText().toString());
kar18 = getKar18(et6.getText().toString());
kar19 = getKar19(et4.getText().toString() + et5.getText().toString() + et6.getText().toString());
//Minor Heart Desire Number karmic debt
kar20 = getKar20(et4.getText().toString());
kar21 = getKar21(et5.getText().toString());
kar22 = getKar22(et6.getText().toString());
kar23 = getKar23(et4.getText().toString() + et5.getText().toString() + et6.getText().toString());
//Minor Personality Number karmic Debt
kar24 = getKar24(et4.getText().toString());
kar25 = getKar25(et5.getText().toString());
kar26 = getKar26(et6.getText().toString());
kar27 = getKar27(et4.getText().toString() + et5.getText().toString() + et6.getText().toString());
//First Pinnacle Karmic Debt
sum70 = getsum70(et7.getText().toString());
sum80 = getSum80(et8.getText().toString());
sum90 = getSum90(et9.getText().toString());
sum10 = getSum10 ((et1.getText().toString()) + (et2.getText().toString()) + (et3.getText().toString()));
pin1 = getSumpin1(Integer.toString((int)sum70) + Integer.toString((int) sum80));
pin2 = getSumpin2(Integer.toString((int)sum70) + Integer.toString((int)sum90));
pin3 = getSumpin3(Integer.toString((int)pin1) + Integer.toString((int)pin2));
pin4 = getSumpin4(Integer.toString((int)sum80) + Integer.toString((int)sum90));
String firstName = et1.getText().toString();
String middleName = et2.getText().toString();
String lastName = et3.getText().toString();
String callFirstName = et4.getText().toString();
String dates = et7.getText().toString();
String months = et8.getText().toString();
String years = et9.getText().toString();
String aChar3 = "";
if(firstName.trim().length()>0)
{
aChar3 = firstName.substring(0,1);
}
String aChar4 = "";
if(middleName.trim().length()>0)
{
aChar4 = middleName.substring(0,1);
}
String aChar5 = "";
if (lastName.trim().length()>0)
{
aChar5 = lastName.substring(0,1);
}
StringBuilder sb = new StringBuilder();
sb.append(aChar3);
sb.append(aChar4);
sb.append(aChar5);
String aChar6 = sb.toString();
sum22 = getSum22(String.valueOf(aChar6));
//Balance Number Karmic Debt
kar28 = getKar28(String.valueOf(aChar6));
char aChar = firstName.charAt(0);
int strLength = firstName.length();
char aChar1 = firstName.charAt(strLength-1);
char aChar2 = gReport1(V);
int itemCount =9 - sum21.size();
sum23 = getSum23(String.valueOf(aChar1));
sum24 = getSum24(String.valueOf(aChar));
sum25 = getSum25(String.valueOf(aChar2));
//GregorianCalendar gc = new GregorianCalendar();
//int yearat = gc.get(Calendar.YEAR);
int day1 = Integer.parseInt(et7.getText().toString());
int month1 = Integer.parseInt(et8.getText().toString());
int year1 = Integer.parseInt(et9.getText().toString());
String s1 = String.valueOf(FullExplanationEntry.this.getAge(year1, month1, day1));
int val = 0;
long val1 = sum11;
//long val = sum16;
val = Integer.valueOf(s1);
long val2 = 36 - val1;
int val4 = 9;
long val5 = val2 + val4;
long val6 = val5 + val4;
long val7 = val6 + 80;
long val18 = val2 + 1;
long val19 = val5 + 1;
long val20 = val6 + 1;
long pYear = 0;
if (sum70 > sum80)
{
ch1 = (sum70 - sum80);
}
else
{
ch1 = (sum80 - sum70);
}
if (sum70 > sum90)
{
ch2 = (sum70 - sum90);
}
else
{
ch2 = (sum90 - sum70);
}
if (sum80 > sum90)
{
ch4 = (sum80 - sum90);
}
else
{
ch4 = (sum90 - sum80);
}
if (ch1 > ch2)
{
ch3 = ch1 - ch2;
}
else
{
ch3 = ch2 - ch1;
}
if (val <= val2)
{
ch = ch1;
}
else if ((val > val2) && (val <= val5))
{
ch = ch2;
}
else if ((val > val2) && (val> val5) && (val <= val6))
{
ch = ch3;
}
else if ((val > val2) && (val> val5) && (val > val6) && (val<= val7))
{
ch = ch4;
}
if (val <= val2)
{
pin = pin1;
}
else if ((val > val2) && (val <= val5))
{
pin = pin2;
}
else if ((val > val2) && (val> val5) && (val <= val6))
{
pin = pin3;
}
else if ((val > val2) && (val> val5) && (val > val6) && (val<= val7))
{
pin = pin4;
}
if (sum11 > sum10)
{
br1 = sum11 - sum10;
}
else
{
br1 = sum10 - sum11;
}
if(sum12 > sum13)
{
br2 = sum12 - sum13;
}
else
{
br2 = sum13 - sum12;
}
if(sum10 > sum12)
{
br3 = sum10 - sum12;
}
else
{
br3 = sum12 - sum10;
}
int dayS = Integer.parseInt(et7.getText().toString());
int monthS = Integer.parseInt(et8.getText().toString());
int yearS = Integer.parseInt(et9.getText().toString());
yearnow = getSumYear(String.valueOf(yearat));
monthnow = getSumMonth(String.valueOf(monthat));
daynow = getSumDay(String.valueOf(dayat));
//pYear = getKarPyar(String.valueOf(yearat));
//Karmic Debt Pinnacle
int karPin1 = 0;
long karPin2 = 0;
long karPin3 = 0;
int karPin4 = 0;
//Karmic day
int karDay = 0;
long karYear = 0;
//Karmic Debt Personal Year
long karPyr = 0;
long karPmn = 0;
long karPdy = 0;
int kPin1 = Integer.parseInt(et7.getText().toString()) + Integer.parseInt(et8.getText().toString());
long kPin2 = sum9 + Integer.parseInt(et7.getText().toString());
long kPin3 = pin1 + pin2;
long kPin4 = sum9 + Integer.parseInt(et8.getText().toString());
long kPyr = yearnow + kPin1;
long kPmn = monthnow + kPyr;
long kPdy = daynow + kPmn;
karYear = getKarYear(String.valueOf(yearnow));
//Karmic Debt First Pinnacle
if(kPin1 == 13)
{
karPin1 = 13;
}
else if(kPin1 == 14)
{
karPin1 = 14;
}
else if(kPin1 == 16)
{
karPin1 = 16;
}
else if(kPin1 == 19)
{
karPin1 = 19;
}
else
{
karPin1 = 0;
}
//Karmic Debt Pinnacle 2
if(kPin2 == 13)
{
karPin2 = 13;
}
else if(kPin2 == 14)
{
karPin2 = 14;
}
else if(kPin2 == 16)
{
karPin2 = 16;
}
else if(kPin2 == 19)
{
karPin2 = 19;
}
else
{
karPin2 = 0;
}
//Karmic Debt Pinnacle 3
if(kPin3 == 13)
{
karPin3 = 13;
}
else if(kPin3 == 14)
{
karPin3 = 14;
}
else if(kPin3 == 16)
{
karPin3 = 16;
}
else if(kPin3 == 19)
{
karPin3 = 19;
}
else
{
karPin3 = 0;
}
//Karmic Debt Pinnacle 4
if(kPin4 == 13)
{
karPin4 = 13;
}
else if(kPin4 == 14)
{
karPin4 = 14;
}
else if(kPin4 == 16)
{
karPin4 = 16;
}
else if(kPin4 == 19)
{
karPin4 = 19;
}
else
{
karPin4 = 0;
}
//Karmic Debt Personal Year No
if(kPyr == 13)
{
karPyr = 13;
}
else if(kPyr == 14)
{
karPyr = 14;
}
else if(kPyr == 16)
{
karPyr = 16;
}
else if(kPyr == 19)
{
karPyr = 19;
}
else
{
karPyr = 0;
}
//Karmic Debt Personal Month No
if(kPmn == 13)
{
karPmn = 13;
}
else if(kPmn == 14)
{
karPmn = 14;
}
else if(kPmn == 16)
{
karPmn = 16;
}
else if(kPmn == 19)
{
karPmn = 19;
}
else
{
karPmn = 0;
}
//Karmic Debt Personal Day No
if(kPdy == 13)
{
karPdy = 13;
}
else if(kPdy == 14)
{
karPdy = 14;
}
else if(kPdy == 16)
{
karPdy = 16;
}
else if(kPdy== 19)
{
karPdy = 19;
}
else
{
karPdy = 0;
}
//Karmic Debt day
if(dayS == 13)
{
karDay = 13;
}
else if(dayS == 14)
{
karDay = 14;
}
else if(dayS == 16)
{
karDay = 16;
}
else if(dayS == 19)
{
karDay = 19;
}
else
{
karDay = 0;
}
if(firstName.equals(""))
{
Toast.makeText(getApplicationContext(), "First Name should not be left blank.. Please enter your First Name and try once again.", Toast.LENGTH_LONG).show();
return;
}
else if(lastName.equals(""))
{
Toast.makeText(getApplicationContext(), "Last Name should not be left blank.. Please enter your Last Name and try once again.", Toast.LENGTH_LONG).show();
return;
}
else if(callFirstName.equals(""))
{
Toast.makeText(getApplicationContext(), "Please enter your First Name that is currently used and try once again.", Toast.LENGTH_LONG).show();
return;
}
else
{
SharedPreferences setting = getSharedPreferences(PREFS_NAME, 0);
SharedPreferences.Editor editors = setting.edit();
editors.putString("log", "log");
editors.commit();
Intent i = new Intent(this, TabLayoutActivity.class);
//Intent i = new Intent(this, FullExplanation.class);
//Intent i = new Intent(this, SecondResult.class);
//Personal Year
i.putExtra("name18",sum18 + "");
//Personal Month
i.putExtra("name19",sum19 + "");
//Personal Dya
i.putExtra("name20",sum20 + "");
//Current Pinnacle
i.putExtra("pin", pin + "");
//Current Challenge
i.putExtra("ch", ch + "");
i.putExtra("yearstr", yearstr);
i.putExtra("monthstr", monthstr);
i.putExtra("daystr", daystr);
startActivity(i);
}
}
MainActivity
public static final String PREFS_NAME = "LoginPrefs";
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
setContentView(R.layout.directcalc_xm);
/*
* Check if we successfully logged in before.
* If we did, redirect to calculation page
*/
SharedPreferences setting = getSharedPreferences(PREFS_NAME, 0);
/*if (settings.getString("logged", "").toString().equals("logged"))
{
Intent intent2 = new Intent(MainActivity.this,FullExplanationEntry.class);
startActivity(intent2);
} */
if (setting.getString("log", "").toString().equals("log"))
{
Intent intent1 = new Intent(DirectCalculation.this,TabLayoutActivity.class);
startActivity(intent1);
}
else
{
btn1 = (Button) findViewById (R.id.button1);
btn2 = (Button) findViewById (R.id.button2);
btn1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Intent intent = new Intent(MainActivity.this, SignInActivity.class);
startActivity(intent);
}
});
logcat的
01-20 12:27:39.684: I/dalvikvm(4750): threadid=3: reacting to signal 3
01-20 12:27:40.301: I/dalvikvm(4750): Wrote stack traces to '/data/anr/traces.txt'
01-20 12:27:44.073: I/Choreographer(4750): Skipped 224 frames! The application may be doing too much work on its main thread.
01-20 12:27:55.383: I/Choreographer(4750): Skipped 97 frames! The application may be doing too much work on its main thread.
01-20 12:27:59.350: D/gralloc_goldfish(4750): Emulator without GPU emulation detected.
01-20 12:28:00.944: I/Choreographer(4750): Skipped 73 frames! The application may be doing too much work on its main thread.
01-20 12:34:36.303: D/dalvikvm(4750): GC_CONCURRENT freed 94K, 8% free 2692K/2916K, paused 370ms+127ms, total 1369ms
01-20 12:34:36.724: I/Choreographer(4750): Skipped 77 frames! The application may be doing too much work on its main thread.
01-20 12:34:40.427: D/AndroidRuntime(4750): Shutting down VM
01-20 12:34:40.463: W/dalvikvm(4750): threadid=1: thread exiting with uncaught exception (group=0x40a71930)
01-20 12:34:40.913: E/AndroidRuntime(4750): FATAL EXCEPTION: main
01-20 12:34:40.913: E/AndroidRuntime(4750): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.numero/com.example.numero.TabLayoutActivity}: java.lang.NullPointerException
01-20 12:34:40.913: E/AndroidRuntime(4750): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
01-20 12:34:40.913: E/AndroidRuntime(4750): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
01-20 12:34:40.913: E/AndroidRuntime(4750): at android.app.ActivityThread.access$600(ActivityThread.java:141)
01-20 12:34:40.913: E/AndroidRuntime(4750): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
01-20 12:34:40.913: E/AndroidRuntime(4750): at android.os.Handler.dispatchMessage(Handler.java:99)
01-20 12:34:40.913: E/AndroidRuntime(4750): at android.os.Looper.loop(Looper.java:137)
01-20 12:34:40.913: E/AndroidRuntime(4750): at android.app.ActivityThread.main(ActivityThread.java:5041)
01-20 12:34:40.913: E/AndroidRuntime(4750): at java.lang.reflect.Method.invokeNative(Native Method)
01-20 12:34:40.913: E/AndroidRuntime(4750): at java.lang.reflect.Method.invoke(Method.java:511)
01-20 12:34:40.913: E/AndroidRuntime(4750): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
01-20 12:34:40.913: E/AndroidRuntime(4750): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
01-20 12:34:40.913: E/AndroidRuntime(4750): at dalvik.system.NativeStart.main(Native Method)
01-20 12:34:40.913: E/AndroidRuntime(4750): Caused by: java.lang.NullPointerException
01-20 12:34:40.913: E/AndroidRuntime(4750): at com.example.numero.TabLayoutActivity.getCalc(TabLayoutActivity.java:107)
01-20 12:34:40.913: E/AndroidRuntime(4750): at com.example.numero.TabLayoutActivity.onCreate(TabLayoutActivity.java:41)
01-20 12:34:40.913: E/AndroidRuntime(4750): at android.app.Activity.performCreate(Activity.java:5104)
01-20 12:34:40.913: E/AndroidRuntime(4750): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
01-20 12:34:40.913: E/AndroidRuntime(4750): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
01-20 12:34:40.913: E/AndroidRuntime(4750): ... 11 more
01-20 12:34:45.824: I/Process(4750): Sending signal. PID: 4750 SIG: 9
tablayoutActivity
public class TabLayoutActivity extends TabActivity
{
public static final String PREFS_NAME = "LoginPrefs";
String pyear, pmonth, pday,chn, pinn;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
setContentView(R.layout.tablay_xm);
TabHost tabHost = getTabHost();
pyear = getIntent().getStringExtra("name18");
pmonth = getIntent().getStringExtra("name19");
pday = getIntent().getStringExtra("name20");
pinn = getIntent().getStringExtra("pin");
chn= getIntent().getStringExtra("ch");
//value for current year, month and day.
String yearstring = getIntent().getStringExtra("yearstr");
String monthstring = getIntent().getStringExtra("monthstr");
String ms = getCalc(monthstring);
String daystring = getIntent().getStringExtra("daystr");
// Tab for Personal Year
TabSpec photospec = tabHost.newTabSpec("Personal Year");
// setting Title and Icon for the Tab
photospec.setIndicator(yearstring, getResources().getDrawable(R.drawable.icon_photos_tab));
Intent photosIntent = new Intent(this, TabPersonalYr.class);
//Intent for passing the value of Personal Year
photosIntent.putExtra("pyear", pyear);
photosIntent.putExtra("pinn", pinn);
photospec.setContent(photosIntent);
// Tab for Personal Month
TabSpec songspec = tabHost.newTabSpec("Personal Month");
songspec.setIndicator(daystring + " " + ms, getResources().getDrawable(R.drawable.icon_songs_tab));
Intent songsIntent = new Intent(this, TabPersonalMnth.class);
//Intent for passing the value of Personal Month
songsIntent.putExtra("pmonth", pmonth);
songsIntent.putExtra("pday", pday);
songspec.setContent(songsIntent);
// Tab for Videos
TabSpec videospec = tabHost.newTabSpec("Personal Day");
videospec.setIndicator("Challenge", getResources().getDrawable(R.drawable.icon_videos_tab));
Intent videosIntent = new Intent(this, TabPersonalDay.class);
//Intent for passing the value of Currrent Challenge
videosIntent.putExtra("chn", chn);
videospec.setContent(videosIntent);
// Adding all TabSpec to TabHost
tabHost.addTab(photospec); // Adding Personal Year tab
tabHost.addTab(songspec); // Adding Personal Month , Day tab
tabHost.addTab(videospec); // Adding Challenge tab
for (int i = 0;i<tabHost.getTabWidget().getChildCount(); i++) {
tabHost.getTabWidget().getChildAt(i).setBackgroundResource(R.drawable.icon_videos_tab);
TextView tv = (TextView) tabHost.getTabWidget().getChildAt(i).findViewById(android.R.id.title);
// tv.setTextColor(Color.parseColor("#000000"));
tv.setTextColor(Color.parseColor("#FFFFFF"));
}
TextView t = (TextView) tabHost.getCurrentTabView().findViewById(android.R.id.title); //for Selected Tab
t.setTextColor(Color.parseColor("#FFFFFF"));
}
private String getCalc(String monthstring) {
String ms = "0";
// TODO Auto-generated method stub
if(monthstring.equals("1")) // line number 107
{
ms= "January";
return ms;
}
else if(monthstring.equals("2"))
{
ms= "February";
return ms;
}
else if(monthstring.equals("3"))
{
ms= "March";
return ms;
}
else if(monthstring.equals("4"))
{
ms= "April";
return ms;
}
else if(monthstring.equals("5"))
{
ms= "May";
return ms;
}
else if(monthstring.equals("6"))
{
ms= "June";
return ms;
}
else if(monthstring.equals("7"))
{
ms= "July";
return ms;
}
else if(monthstring.equals("8"))
{
ms= "August";
return ms;
}
else if(monthstring.equals("9"))
{
ms= "September";
return ms;
}
else if(monthstring.equals("10"))
{
ms= "October";
return ms;
}
else if(monthstring.equals("11"))
{
ms= "November";
return ms;
}
else if(monthstring.equals("12"))
{
ms= "December";
return ms;
}
else
return "0";
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == R.id.button04) {
SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0);
SharedPreferences.Editor editor = settings.edit();
editor.remove("logged");
editor.commit();
finish();
}
return super.onOptionsItemSelected(item);
}
}
ya ...我宣佈了活動 – Jocheved
在tablayout活動中我使用tabhost ..是一個問題..? – Jocheved
你可以發佈TabLayoutActivity.java第107行嗎? –