Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android Android Lists and Adapters (2015) Acting on List Item Taps Tapping on a ListView Item

while tapping on the daily forecast list items im not getting the toast messages

package catalyst.com.stormy.ui;

import android.app.ListActivity; import android.content.Intent; import android.os.Bundle; import android.os.Parcelable; import android.view.View; import android.widget.ListView; import android.widget.Toast; import java.util.Arrays; import catalyst.com.stormy.R; import catalyst.com.stormy.adapters.DayAdapter; import catalyst.com.stormy.weather.Day;

public class DailyForecastActivity extends ListActivity {

private Day[] mDays;

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

    Intent intent = getIntent();
    Parcelable[] parcelables = intent.getParcelableArrayExtra(MainActivity.DAILY_FORECAST);
    mDays = Arrays.copyOf(parcelables, parcelables.length, Day[].class);

    DayAdapter adapter = new DayAdapter(this, mDays);
    setListAdapter(adapter);
}

@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
    super.onListItemClick(l, v, position, id);

    String dayOfTheWeek = mDays[position].getDayOfTheWeek();
    String conditions = mDays[position].getSummary();
    String highTemp = mDays[position].getTemperatureMax() + " ";
    String message = String.format("On %s the high will be %s and it will be %s",
            dayOfTheWeek,highTemp, conditions);

    Toast  toast = Toast.makeText(this, message, Toast.LENGTH_LONG);
    toast.show();

}

}

3 Answers

it says Could not open '/sys/class/power_supply/genymotion_fake_path/present'

Gnani Pasupula
Gnani Pasupula
3,915 Points

Re-install the genymotion , it works and don't change the directory of the folder after installation.

Thank-you Gnani

Gnani Pasupula
Gnani Pasupula
3,915 Points

Glad it worked . happy coding

Michael Watson
Michael Watson
13,204 Points

I had the same issue and added android:clickable="false" to the relative layout for list item, now it works.