He practised law in New York and Philadelphia, was chosen mayor of Philadelphia in 1828, and in 1829 was appointed by President Jackson, whom he had twice warmly supported for the presidency, United States attorney for the eastern district of Pennsylvania, a position long held by his father.