2016-08-03 49 views
-3
GeoInformation geoInformation = new GeoInformation(d,cellid,locationid,lon,lat,m,mn,address,Signalstrength,ipAddress,ttt,timestamp,carrier); 
    Gson gson = new Gson(); 
    String jsonData = gson.toJson(geoInformation); 
    Log.i("**",jsonData); 
    Toast.makeText(MainActivity.this, jsonData, Toast.LENGTH_SHORT).show(); 
    Toast.makeText(MainActivity.this, jsonData, Toast.LENGTH_SHORT).show(); 
    geolocationtDbHelper = new GeolocationDbHelper(context); 
    sqLiteDatabase = geolocationtDbHelper.getWritableDatabase(); 
    geolocationtDbHelper.addInformation(timeData, jsonData, sqLiteDatabase); 
    Toast.makeText(getBaseContext(),"Data Saved", Toast.LENGTH_LONG).show(); 
    geolocationtDbHelper.close(); 
+0

糾正您的問題格式化。 –

回答

-1

Isha,我們有很多解決方案在android中每30秒重複任何任務: 因此,您可以使用延遲過後的android處理程序來完成此任務,這將在30秒後調用。

new Handler().post(new Runnable() { 
      @Override 
      public void run() { 
       //code here which you need to repeat after 30 secs. 
       Toast.makeText(MainActivity.this, "Call after 30 secs", Toast.LENGTH_SHORT).show(); 
       new Handler().postDelayed(this, 1000 * 30); 
      } 
     }); 

我希望它會幫助你。 如果您想了解處理程序,請點擊此鏈接: https://developer.android.com/reference/android/os/Handler.html#postDelayed(java.lang.Runnable,長)

相關問題