Soru & Cevap

Telefonumda çalışan uygulama play store da çalışmıyor ...

13.01.2020 - 09:26

Merhaba,

 

Android uygulamam var. Telefonumda test ederken herhangi bir sorun yok. Ancak google playden indirdiğimde uygulama çalışıyor ancak sayfanın birisi çalışmıyor. Hatanın nereden kaynaklandığını nasıl bulabilirim ?

 

11 Görüntülenme

4 Cevap

Sitedeki sorulara cevap verebilmek için giriş yapın ya da üye olun.

picture-112887-1506457490.jpg
recepözen
21.01.2020 - 02:00

Gördüğüm kadarıyla şuanlık for içinde arka arka arkaya respose isteği gönderiyorsunuz. Bu patlamanın sebebi olabilir. Başka bir şey göremedim Log.e() mothodunu kullanarak elle debug etmeye çalışın farklı bir telefonlar denemeyi deneyin Log kaydına ulaşmadan sorunu bulmak biraz zor.

Profile picture for user betulsahin3387
betulsahin3387
13.01.2020 - 09:47
public class LocationListActivity extends AppCompatActivity {
    private static final String TAG = LocationListActivity.class.getSimpleName();

    private DatabaseQuery query;
    private List<LocationObject> allLocations;
    private LocationMapObject locationMapObject;
    private RequestQueue queue;
    private LocationListAdapter locationListAdapter;
    private List<LocationListModel> allData;

    private RecyclerView locationRecyclerView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
        setContentView(R.layout.activity_location_list);

        setTitle(R.string.location_list_title);
        if(getSupportActionBar() != null){
            getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        }

        queue = Volley.newRequestQueue(LocationListActivity.this);
        query = new DatabaseQuery(LocationListActivity.this);
        allData = new ArrayList<>();

        //arama terimini burada alıyoruz.
        handleIntent(getIntent());

        allLocations = query.getStoredDataLocations();
        if(allLocations != null){
            for(int i = 0; i < allLocations.size(); i++){
                // make volley network call here
                requestJsonObject(allLocations.get(i));
            }
        }

        LinearLayoutManager linearLayoutManager = new LinearLayoutManager(LocationListActivity.this);
        locationRecyclerView = findViewById(R.id.rv_location_list);
        locationRecyclerView.setLayoutManager(linearLayoutManager);
    }

    @Override
    protected void onNewIntent(Intent intent) {
        super.onNewIntent(intent);
        setIntent(intent);
        handleIntent(intent);
    }

    private void handleIntent(Intent intent) {
        DatabaseQuery query = new DatabaseQuery(LocationListActivity.this);

        if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
            String queryWord = intent.getStringExtra(SearchManager.QUERY);

            int numOfLocationsStored = query.countAllStoredLocations();

            //gelen arama terimini db ye kaydet
            if(numOfLocationsStored <= 10 ){
                DatabaseQuery dbQuery = new DatabaseQuery(LocationListActivity.this);
                dbQuery.insertNewLocation(queryWord);
            }
            else
                Toast.makeText(LocationListActivity.this, R.string.location_list_message, Toast.LENGTH_SHORT).show();
        }
    }

    private void requestJsonObject(final LocationObject paramValue){
        String url ="http://api.openweathermap.org/data/2.5/weather?q="+paramValue.getLocation()+"&lang=tr&APPID="+ Helper.API_KEY+"&units=metric";
        StringRequest stringRequest = new StringRequest(Request.Method.GET, url, new Response.Listener<String>() {
            @Override
            public void onResponse(String response) {
                GsonBuilder builder = new GsonBuilder();
                Gson gson = builder.create();
                locationMapObject = gson.fromJson(response, LocationMapObject.class);
                if (null == locationMapObject) {
                    Toast.makeText(getApplicationContext(), "Nothing was returned", Toast.LENGTH_LONG).show();
                } else {
                    int rowId = paramValue.getId();
                    Long tempVal = Math.round(Math.floor(Double.parseDouble(locationMapObject.getMain().getTemp())));
                    String city = locationMapObject.getName() + ", " + locationMapObject.getSys().getCountry();
                    String weatherInfo = String.valueOf(tempVal) + "<sup>o</sup>, " + Helper.capitalizeFirstLetter(locationMapObject.getWeather().get(0).getDescription());
                    allData.add(new LocationListModel(rowId, city, weatherInfo));

                    locationListAdapter = new LocationListAdapter(LocationListActivity.this, allData);
                    locationRecyclerView.setAdapter(locationListAdapter);
                }
            }
        }, new Response.ErrorListener() {
            @Override
            public void onErrorResponse(VolleyError error) {
                Log.d(TAG, "Error " + error.getMessage());
            }
        });
        queue.add(stringRequest);
    }
}

 

Konumları gösteren activity nin kodları bu şekilde.

 

Profile picture for user betulsahin3387
betulsahin3387
13.01.2020 - 09:43

3. sayfa açılmıyor. Orada db den veri çekip ekranda gösterecek. İlk olarak db yle ilgili sorun olduğunu düşündüm ama değil. db veri çekip ekranda gösterebildim ilk ekranda. 3. ekran hala açılmıyor.

/sites/default/files/cevaplar/dosya/2020/file-screenshot_20200107-191429.png /sites/default/files/cevaplar/dosya/2020/file-screenshot_20200107-191435.png /sites/default/files/cevaplar/dosya/2020/file-screenshot_20200107-192101.png