mercredi 25 novembre 2015

Android Studio SQLite database?

I keep getting red lines under certain lines of code and I'm not sure what's wrong - could someone please explain why? did i not name something correctly?

public class ResultsActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_results);

    Intent intent = getIntent();

    String keyword = intent.getExtras().getString("keyword");
    keyword = keyword.replaceAll("\\s", "+");

    FinalResultsDatabase db = new FinalResultsDatabase(this);

    String jsonResult = db.getResult(keyword);

    //if (the jsonResult variable did not get filled up from the local db){
    // jsonResult = runSearch(keyword);
    // db.insertData(keyword, jsonResult);
    // }

    ArrayList<String> searchResults = getValuesFromJSON(jsonResult);

    final ListView listView = (ListView) findViewById(R.id.listView);

    ArrayList<Information> searchResults = new ArrayList<>(); //here

    ArrayList<Information> searchResults = FinalResultsDatabase.getInformation(); //here

    ArrayAdapter<String> arrayAdapter = new ArrayAdapter<>
            (this,android.R.layout.simple_list_item_1, searchResults);

    listView.setAdapter(arrayAdapter);

}

Aucun commentaire:

Enregistrer un commentaire