Subversion Repository Public Repository

Nextrek

Diff Revisions 765 vs 785 for /Android/SmartCharging/SmartCharging/app/src/main/java/it/fedeloper/smartcharging/Manager/Utils.java

Diff revisions: vs.
  @@ -41,10 +41,16 @@
41 41 * Created by federico on 11/08/2015.
42 42 */
43 43 public class Utils {
44 - public static Uri getImageUri(Context inContext, Bitmap inImage) {
45 44
46 45
46 + public static String getTipologiaFromId(Context c,int id)
47 + {
48 + final String[] tipi = c.getResources().getStringArray(R.array.type_array);
49 + return tipi[id-1];
50 + }
51 +
47 52
53 + public static Uri getImageUri(Context inContext, Bitmap inImage) {
48 54
49 55 ByteArrayOutputStream bytes = new ByteArrayOutputStream();
50 56 inImage.compress(Bitmap.CompressFormat.JPEG, 100, bytes);
  @@ -308,7 +314,11 @@
308 314 }
309 315
310 316 public static void toast(Context c,int source) {
311 - Toast.makeText(c, c.getText(source), Toast.LENGTH_SHORT).show();
317 + try
318 + {
319 + Toast.makeText(c, c.getText(source), Toast.LENGTH_SHORT).show();
320 + }catch (Exception e){}
321 +
312 322
313 323 // LayoutInflater inflater = LayoutInflater.from(c);
314 324 // View layout = inflater.inflate(R.layout.toast_layout, null);