(Illustration by Dan Woodger)

I remember the day I stopped humming the theme song to the television show “Mister Rogers’ Neighborhood.” It was midway through the semester at Towson University, and I had just met with a student who was furious that I had asked her to leave class because she had been e-mailing. She couldn’t believe I would do such a thing. I was angry that she flouted my no-texting/e-mailing classroom policy and, worse, that she lacked even a whiff of contrition.

I walked into my next class, a course that explored the declining health of civility and community in American culture. As usual, everyone’s eyes were buried in their cellphones. When class started, the tension was palpable. Ever since we had started exploring the toxic state of community, students had grown defensive. They hadn’t bought my argument that they needed to break out of their hyperconnected cocoons — “ramparts” may be more accurate — and live in ever-expanding communities where face-to-face relationships breed tolerance and the rewards of individual sacrifice.

I posed a question. “I just read a study which says that 81 percent of your generation doesn’t trust most people or large institutions,” I said. “So, how can we create community if we only trust our small circle of friends and families?”

“What’s wrong with finding our own small communities?” Ashley huffed.

A wave of “Yeahs!” sounded.

That’s when I realized that “It’s a beautiful day in this neighborhood” didn’t cut it anymore. I needed a way to help students discover the power in community outside of texting or tweeting (or video games) and outside of their familiar, safe tribes. I couldn’t just stand by while my students piled stones to the rafters and walled themselves off.

So I came up with two assignments: (1) Consciously commit civil acts over five days. (2) Have dinner with a stranger.

Andrew Reiner (standing) teaches a class at Towson University called "Mr. Rogers 101: Why Community and Civility Still Matter." (Doug Kapustin/For The Washington Post)

Though I created “Mr. Rogers 101: Why Community and Civility Matter in the 21st Century,” I was reluctant to teach it. It’s painful to teach topics people dismiss as antiquated and charming, at best. But challenging students to look at these issues seemed more productive than the other ways I was venting my spleen, such as leaving behind copies of “George Washington’s Rules of Civility & Decent Behavior in Company and Conversation” in the smartphone-choked Starbucks.

My dissatisfaction may seem steeped in sentimentality or a cluelessness about the age. The sad truth is, many of us hide within our mobile turtle shell.

Although millennials have performed a lot of community service hours because of high school graduation and college Greek organization requirements, they are less interested in getting involved in their communities than were previous generations (Gen X, baby boomers). A 2014 Pew study discovered that Americans from both extremes of the political spectrum (conservatives, especially) are increasingly making decisions about whom they will and won’t live near, as well as talk to, based on political ideology.

Although the Internet isn’t the main culprit (the trend began in the 1960s), there’s no mistaking its contributions to the metastasizing disconnect. One of the biggest debates surrounding the Internet is whether it’s changing the concept of community.

By semester’s end, many students and I didn’t agree on whether cyber-communities translate into the real thing. But we agreed on this: The Internet is a game changer that’s not always for the better.

According to a 2014 survey conducted by Crowdtap and Ipsos MediaCT (arranged by Statista), 30 percent of millennials solder their attention to the Web as many as 18 hours a day, with 5.4 hours spent on user-generated content. In terms of community, this trend speaks directly to the 2009 Pew study “Social Isolation and New Technology,” which found that “users of social networking services are 30% less likely to know at least some neighbors.”

Jean Twenge, the San Diego psychologist and author, has written extensively about the rising narcissism and declining empathy associated with Generation Y. But this critique is not leveled solely at millennials. They are largely the inheritors of a culture that teaches wholesale stranger danger; an insular tribal mentality glorified on television (“Friends,” “How I Met Your Mother,” “That ’70s Show”); “Wolf of Wall Street” values that encourage depravity in the name of monetary success; and the teddy-bear comfort of remaining plugged in around the clock.

The legacy isn’t pretty: This is a generation terrified of looking up from the cellphone for fear of appearing out of the loop or having a real conversation where the muck of real emotions can’t be sterilized. If they continue to hide in fiber-optic fortresses, how will they ever build real community with strangers?

Melissa Miller, Jonathan Connelly and Anne Rubin ask passing students to record advice to others during exams week for Reiner’s class. Acts of civility build community, one person at a time, Reiner teaches. (Photo by Doug Kapustin/For The Washington Post) (Doug Kapustin/For The Washington Post)

I turned to someone I believed had the answers: Fred Rogers. The oft-lampooned creator of “Mister Rogers’ Neighborhood,” the long-lived children’s public television show, taught the building blocks of community better than anyone. In his 2003 obituary, Rogers was quoted: “We live in a world in which we need to share responsibility. It’s easy to say, ‘It’s not my child, not my community, not my world, not my problem.’ Then there are those who see the need and respond. I consider those people my heroes.”

P.M. Forni, director of the 16-year-old Civility Initiative at Johns Hopkins University, wrote in his book “Choosing Civility”: “Our first responsibility, when we are with others, is to pay attention. ... Attention entails a transcending of the Self. Through it we confer value upon the lives of others.”

My students in the Honors College are smart, thoughtful and fairly sophisticated intellectually, so they could riff on Forni’s ideas with equal eloquence. But as they bumped into each other, texting, on their way out the door each day, I wasn’t convinced they really got it.

I shared with them an anecdote about the time I got a flat tire traveling in Maine with my aging parents. While we waited for AAA, a stranger, caked in grease, pulled over in his pickup and insisted that he change the tire. “Being on this shoulder isn’t safe for your parents,” he told me.

I offered to pay him, but he refused it.

“You would do this for a stranger,” he said.

“But how do you know?” I challenged.

He put his grimy hand on my shoulder. “I know you would.”

Eighteen years later I’ve come to think of those words as some kind of charge (or benediction?) and drew on them for my first assignment: Commit conscious civil acts. The one thing I asked students was to push themselves beyond their comfort zones.

A few students, such as Tyler, got it. He encountered a young man in a hoodie standing by a dumpster outside his apartment building, clutching an overnight bag and staring down. “He was the picture of a dejected human being,” Tyler wrote. People just passed him by; Tyler stopped to talk.

The man told him he was afraid to go back into his apartment because his roommate had become hostile. The two swapped “terrible roommate” stories, and after a while, the troubled young man was ready to face his roommate. “ ‘Hey, thanks for stopping, man. I really appreciated it,’ ” he said.

“I was struck by the uniqueness of that experience,” Tyler wrote. “Two random strangers connecting on their own, private paths ... walking away better than when they had arrived.”

Beth and a friend followed the lead of the international Free Hugs movement; they stood in Towson’s busy Freedom Square holding up “Free Hugs” signs. “I assumed this was something that people would be excited to participate in, because I would be, so I was initially very confident,” she wrote. But they were laughed and “cringed” at, ignored and even slammed on social media. Someone YikYaked: “Shout out to the girls giving hugs in freedom square that no body actually wants to hug.”

By the end, Beth and her friend racked up 15 hugs and some sober wisdom. “I had hoped this experiment could help strengthen community by showing people that ‘stranger danger’ doesn’t always have to exist,” she wrote. “I don’t think I was successful, unfortunately.”

Other students had similarly moving experiences — Kristen reached out to a sobbing stranger; Amanda shared her umbrella at a bus stop — but quite a few balked in unspoken solidarity. They committed the least invasive and sacrificial act: holding open doors. Many of these dissidents wrote about the lack of gratitude they received and complained about what one student derided as “mandated volunteerism.” Worse, some resented that I was asking them to “be rude,” echoing a cultural yen for placing the sovereign rights of the individual above all else.

“My idea of building community might be considered a total invasion of someone else’s privacy,” one student wrote.

On the day students handed in their reflections, I asked whether there were any deeper reasons for holding back. My question was met with silence. Finally, Sam admitted: “Honestly? We’re terrified of being rejected and looking uncool.” A sea of lowered heads bobbled in silent concession.

Towson University student Amanda Shorr passes out Smarties and an encouraging note to other students as exams begin, for Reiner’s class. (Doug Kapustin/For The Washington Post)

Sam’s gutsy confession encouraged me. If I could find a way to get students to confront their fear of social imperfection, maybe we could begin to find community in the flesh. I introduced experiment No. 2.

“You’re kidding? Right?” Jenn snapped. The rest of the class sat bug-eyed and speechless.

“Guess Who’s Coming to Dinner” required each student to ask a stranger to eat lunch or dinner, just the two of them. No cellphones or other escape hatches. The goal, I explained, was to sit across from a stranger and to “show a willingness to engage him, to acknowledge another person’s existence.”

This potentially meant more resentment and lousy end-of-semester evaluations for me. But I knew that pushing students beyond their comfort zones could bring change and real learning.

I winced when I read the students’ reflections. They embodied Sartre’s famous observation: “Hell is other people.”

“I barely talk to my classmates. How am I supposed to eat a meal with a complete stranger?” Hannah wrote. “I did not see any positive outcomes with this assignment whatsoever.”

Katie was blunter: “I originally thought you were slightly crazy because I wasn’t sure how eating with a stranger would build community and pictured everything that could’ve gone wrong.”

A bit melodramatic? Miles didn’t think so. He described his four-strike day where none of the strangers he approached at two restaurants accepted his request. The most offensive were a hipster couple who said they were taking their food to go “but stayed” and an Asian American patron who Miles said ordered his food in “perfect English,” then pretended not to speak English when approached. “It’s really difficult to get people to just take a blind leap with someone they’ve never met,” he observed. “I wanted to show these people that getting beyond that initial stage of awkwardness could be enlightening. But none of them shared my willingness to be ‘real.’ ”

Allie related her McDonald’s lunch with Lloyd, a man in his 60s, who, tears welling, shared his sadness over his mother-in-law’s refusal to replace the battery in her pacemaker. “Looking at this older man made me realize that one day I would have the same white hair and wrinkly complexion,” she wrote. Still, bearing witness and empathy wasn’t enough of a game changer for her. “We believe as a society that putting ourselves out there to strangers might have an uplifting, movie-like result,” Allie observed. “But my lunch wasn’t an event that was full of rainbows and butterflies.”

At one of our final class meetings, I asked students if they found any value in building community on the micro scale, one person at a time. Once again, heads dropped, eyes diverted. I nervously shuffled two stacks of their graded reflections.

After a long uncomfortable silence, a hand raised. My chest tightened. It was Emily’s. She explained how morale had dropped on a student-run residence board she was on ever since one student had joined it to “beef up his résumé.” She used the experiment as an excuse to ask him to dinner. Afterward, “there was a shift on our executive board. I learned that a simple thing like dinner can transcend two people and have a much larger effect on community as a whole. Putting myself out of my comfort zone was a small price to pay.”

Someone’s cellphone rang, and for a moment I swore it tinkled Mr. Rogers’s theme song.

Andrew Reiner teaches at Towson University. To comment on this story,e-mail wpmagazine@washpost.com or visit washingtonpost.com/magazine.

E-mail us at wpmagazine@washpost.com.

For more articles, as well as features such as Date Lab, Gene Weingarten and more, visit The Washington Post Magazine.

Follow the Magazine on Twitter.

Like us on Facebook.