You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
492 B
16 lines
492 B
package com.example.myapplication;
|
|
|
|
import android.content.Context;
|
|
import android.content.SharedPreferences;
|
|
import android.widget.Toast;
|
|
|
|
public class Utils {
|
|
public static void toast(Context ctx, String msg) {
|
|
Toast.makeText(ctx, msg, Toast.LENGTH_SHORT).show();
|
|
}
|
|
|
|
public static String getUser(Context ctx) {
|
|
SharedPreferences prefs = ctx.getSharedPreferences("app_prefs", Context.MODE_PRIVATE);
|
|
return prefs.getString("currentUser", "张三");
|
|
}
|
|
} |