SlideShare a Scribd company logo
Programming Android Java Programming for the New
Generation of Mobile Devices Second Edition
(2012-09-26) Zigurd Mednieks download pdf
https://ebookultra.com/download/programming-android-java-programming-
for-the-new-generation-of-mobile-devices-second-
edition-2012-09-26-zigurd-mednieks/
Visit ebookultra.com today to download the complete set of
ebook or textbook!
Here are some recommended products for you. Click the link to
download, or explore more at ebookultra.com
Programming Mobile Devices An Introduction for
Practitioners 1st Edition Tommi Mikkonen
https://ebookultra.com/download/programming-mobile-devices-an-
introduction-for-practitioners-1st-edition-tommi-mikkonen/
Programming Wireless Devices with the Java 2 Platform 2nd
Edition Roger Riggs
https://ebookultra.com/download/programming-wireless-devices-with-the-
java-2-platform-2nd-edition-roger-riggs/
20 Recipes for Programming PhoneGap Cross Platform Mobile
Development for Android and iPhone 1st Edition Munro
https://ebookultra.com/download/20-recipes-for-programming-phonegap-
cross-platform-mobile-development-for-android-and-iphone-1st-edition-
munro/
Java Programming for the Absolute Beginner 1st Edition
Joseph Russell
https://ebookultra.com/download/java-programming-for-the-absolute-
beginner-1st-edition-joseph-russell/
Java Programming 7th Edition Joyce Farrell
https://ebookultra.com/download/java-programming-7th-edition-joyce-
farrell/
Java Programming 8th Edition Joyce Farrell
https://ebookultra.com/download/java-programming-8th-edition-joyce-
farrell/
Programming the Mobile Web 2nd Edition Maximiliano Firtman
https://ebookultra.com/download/programming-the-mobile-web-2nd-
edition-maximiliano-firtman/
Advanced Java Game Programming Wallace Croft
https://ebookultra.com/download/advanced-java-game-programming-
wallace-croft/
Beginning Programming with Java For Dummies 4th Edition
Barry Burd
https://ebookultra.com/download/beginning-programming-with-java-for-
dummies-4th-edition-barry-burd/
Programming Android Java Programming for the New Generation of Mobile Devices Second Edition (2012-09-26) Zigurd Mednieks
Programming Android Java Programming for the New
Generation of Mobile Devices Second Edition (2012-09-
26) Zigurd Mednieks Digital Instant Download
Author(s): Zigurd Mednieks, Laird Dornin, G. Blake Meike, Masumi Nakamu
ISBN(s): 9781449316648, 1449316646
Edition: Second Edition (2012-09-26)
File Details: PDF, 13.61 MB
Year: 2012
Language: english
Programming Android Java Programming for the New Generation of Mobile Devices Second Edition (2012-09-26) Zigurd Mednieks
Programming Android Java Programming for the New Generation of Mobile Devices Second Edition (2012-09-26) Zigurd Mednieks
SECOND EDITION
Programming Android
Zigurd Mednieks, Laird Dornin, G. Blake Meike,
and Masumi Nakamura
Beijing • Cambridge • Farnham • Köln • Sebastopol • Tokyo
Programming Android, Second Edition
by Zigurd Mednieks, Laird Dornin, G. Blake Meike, and Masumi Nakamura
Copyright © 2012 Zigurd Mednieks, Laird Dornin, Blake Meike, and Masumi Nakamura. All rights
reserved.
Printed in the United States of America.
Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472.
O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions
are also available for most titles (http://my.safaribooksonline.com). For more information, contact our
corporate/institutional sales department: 800-998-9938 or corporate@oreilly.com.
Editors: Andy Oram and Rachel Roumeliotis
Production Editor: Melanie Yarbrough
Copyeditor: Audrey Doyle
Proofreader: Teresa Horton
Indexer: Ellen Troutman-Zaig
Cover Designer: Karen Montgomery
Interior Designer: David Futato
Illustrator: Robert Romano
September 2012: Second Edition.
Revision History for the Second Edition:
2012-09-26 First release
See http://oreilly.com/catalog/errata.csp?isbn=9781449316648 for release details.
Nutshell Handbook, the Nutshell Handbook logo, and the O’Reilly logo are registered trademarks of
O’Reilly Media, Inc. Programming Android, Second Edition, the cover image of a pine grosbeak, and
related trade dress are trademarks of O’Reilly Media, Inc.
Many of the designations used by manufacturers and sellers to distinguish their products are claimed as
trademarks. Where those designations appear in this book, and O’Reilly Media, Inc., was aware of a
trademark claim, the designations have been printed in caps or initial caps.
While every precaution has been taken in the preparation of this book, the publisher and authors assume
no responsibility for errors or omissions, or for damages resulting from the use of the information con-
tained herein.
ISBN: 978-1-449-31664-8
[LSI]
1348682639
Table of Contents
Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiii
Part I. Tools and Basics
1. Installing the Android SDK and Prerequisites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Installing the Android SDK and Prerequisites 3
The Java Development Kit (JDK) 4
The Eclipse Integrated Development Environment (IDE) 5
The Android SDK 7
Adding Build Targets to the SDK 8
The Android Developer Tools (ADT) Plug-in for Eclipse 9
Test Drive: Confirm That Your Installation Works 12
Making an Android Project 12
Making an Android Virtual Device (AVD) 16
Running a Program on an AVD 19
Running a Program on an Android Device 20
Troubleshooting SDK Problems: No Build Targets 21
Components of the SDK 21
The Android Debug Bridge (adb) 21
The Dalvik Debug Monitor Server (DDMS) 21
Components of the ADT Eclipse Plug-in 23
Android Virtual Devices 25
Other SDK Tools 26
Keeping Up-to-Date 27
Keeping the Android SDK Up-to-Date 28
Keeping Eclipse and the ADT Plug-in Up-to-Date 28
Keeping the JDK Up-to-Date 29
Example Code 30
SDK Example Code 30
Example Code from This Book 30
On Reading Code 31
iii
2. Java for Android . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Android Is Reshaping Client-Side Java 33
The Java Type System 34
Primitive Types 34
Objects and Classes 35
Object Creation 35
The Object Class and Its Methods 37
Objects, Inheritance, and Polymorphism 39
Final and Static Declarations 41
Abstract Classes 45
Interfaces 46
Exceptions 48
The Java Collections Framework 51
Garbage Collection 55
Scope 55
Java Packages 56
Access Modifiers and Encapsulation 57
Idioms of Java Programming 59
Type Safety in Java 59
Using Anonymous Classes 62
Modular Programming in Java 64
Basic Multithreaded Concurrent Programming in Java 67
Synchronization and Thread Safety 68
Thread Control with wait() and notify() Methods 71
Synchronization and Data Structures 72
3. The Ingredients of an Android Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
Traditional Programming Models Compared to Android 75
Activities, Intents, and Tasks 77
Other Android Components 79
Service 79
Content Providers 80
BroadcastReceiver 83
Component Life Cycles 83
The Activity Life Cycle 83
On Porting Software to Android 85
Static Application Resources and Context 86
Organizing Java Source 87
Resources 88
Application Manifests 90
Initialization Parameters in AndroidManifest.xml 91
Packaging an Android Application: The .apk File 94
The Android Application Runtime Environment 94
iv | Table of Contents
The Dalvik VM 95
Zygote: Forking a New Process 95
Sandboxing: Processes and Users 95
The Android Libraries 96
Extending Android 98
The Android Application Template 98
Overrides and Callbacks 99
Polymorphism and Composition 101
Extending Android Classes 102
Concurrency in Android 104
AsyncTask and the UI Thread 105
Threads in an Android Process 116
Serialization 118
Java Serialization 119
Parcelable 120
Classes That Support Serialization 124
Serialization and the Application Life Cycle 125
4. Getting Your Application into Users’ Hands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
Application Signing 127
Public Key Encryption and Cryptographic Signing 127
How Signatures Protect Software Users, Publishers, and
Secure Communications 129
Signing an Application 130
Placing an Application for Distribution in the Android Market 135
Becoming an Official Android Developer 135
Uploading Applications in the Market 136
Getting Paid 138
Alternative Distribution 139
Verizon Applications for Android 139
Amazon Applications for Android 141
Google Maps API Keys 143
Specifying API-Level Compatibility 144
Compatibility with Many Kinds of Screens 144
Testing for Screen Size Compatibility 145
Resource Qualifiers and Screen Sizes 145
5. Eclipse for Android Software Development . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
Eclipse Concepts and Terminology 148
Plug-ins 148
Workspaces 149
Java Environments 150
Projects 151
Table of Contents | v
Builders and Artifacts 151
Extensions 151
Associations 153
Eclipse Views and Perspectives 153
The Package Explorer View 154
The Task List View 154
The Outline View 155
The Problems View 155
Java Coding in Eclipse 156
Editing Java Code and Code Completion 156
Refactoring 156
Eclipse and Android 158
Preventing Bugs and Keeping Your Code Clean 158
Static Analyzers 158
Applying Static Analysis to Android Code 163
Limitations of Static Analysis 166
Eclipse Idiosyncrasies and Alternatives 166
Part II. About the Android Framework
6. Building a View . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
Android GUI Architecture 171
The Model 171
The View 172
The Controller 173
Putting It Together 173
Assembling a Graphical Interface 175
Wiring Up the Controller 180
Listening to the Model 182
Listening for Touch Events 187
Multiple Pointers and Gestures 190
Listening for Key Events 192
Choosing an Event Handler 193
Advanced Wiring: Focus and Threading 195
The Menu and the Action Bar 199
View Debugging and Optimization 202
7. Fragments and Multiplatform Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205
Creating a Fragment 206
Fragment Life Cycle 209
The Fragment Manager 210
Fragment Transactions 211
vi | Table of Contents
The Support Package 216
Fragments and Layout 217
8. Drawing 2D and 3D Graphics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225
Rolling Your Own Widgets 225
Layout 226
Canvas Drawing 231
Drawables 242
Bitmaps 247
Bling 248
Shadows, Gradients, Filters, and Hardware Acceleration 251
Animation 253
OpenGL Graphics 258
9. Handling and Persisting Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263
Relational Database Overview 263
SQLite 264
The SQL Language 264
SQL Data Definition Commands 265
SQL Data Manipulation Commands 268
Additional Database Concepts 270
Database Transactions 271
Example Database Manipulation Using sqlite3 271
SQL and the Database-Centric Data Model for Android Applications 275
The Android Database Classes 276
Database Design for Android Applications 277
Basic Structure of the SimpleVideoDbHelper Class 277
Using the Database API: MJAndroid 280
Android and Social Networking 280
The Source Folder (src) 282
Loading and Starting the Application 283
Database Queries and Reading Data from the Database 283
Modifying the Database 287
Part III. A Skeleton Application for Android
10. A Framework for a Well-Behaved Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295
Visualizing Life Cycles 296
Visualizing the Activity Life Cycle 296
Visualizing the Fragment Life Cycle 308
The Activity Class and Well-Behaved Applications 311
The Activity Life Cycle and the User Experience 311
Table of Contents | vii
Life Cycle Methods of the Application Class 312
11. Building a User Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315
Top-Level Design 316
Fragment, Activity, and Scalable Design 317
Visual Editing of User Interfaces 319
Starting with a Blank Slate 319
Laying Out the Fragments 323
Lay Out Fragments Using the Visual Editor 324
Multiple Layouts 325
Folding and Unfolding a Scalable UI 326
Decisions about Screen Size and Resolution 326
Delegating to Fragment Classes 330
Making Activity, Fragment, Action Bar, and Multiple Layouts Work To-
gether 333
Action Bar 333
Tabs and Fragments 333
The Other Activity 336
12. Using Content Providers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 341
Understanding Content Providers 342
Implementing a Content Provider 343
Browsing Video with Finch 344
Defining a Provider Public API 345
Defining the CONTENT_URI 346
Creating the Column Names 348
Declaring Column Specification Strings 348
Writing and Integrating a Content Provider 350
Common Content Provider Tasks 350
File Management and Binary Data 352
Android MVC and Content Observation 354
A Complete Content Provider: The SimpleFinchVideoContentProvider
Code 355
The SimpleFinchVideoContentProvider Class and Instance Variables 355
Implementing the onCreate Method 357
Implementing the getType Method 358
Implementing the Provider API 358
Determining How Often to Notify Observers 363
Declaring Your Content Provider 363
13. A Content Provider as a Facade for a RESTful Web Service . . . . . . . . . . . . . . . . . . . . 365
Developing RESTful Android Applications 366
A “Network MVC” 367
viii | Table of Contents
Summary of Benefits 369
Code Example: Dynamically Listing and Caching YouTube
Video Content 370
Structure of the Source Code for the Finch YouTube Video Example 371
Stepping Through the Search Application 372
Step 1: Our UI Collects User Input 373
Step 2: Our Controller Listens for Events 373
Step 3: The Controller Queries the Content Provider with a managedQuery
on the Content Provider/Model 374
Step 4: Implementing the RESTful Request 374
Constants and Initialization 375
Creating the Database 375
A Networked Query Method 375
insert and ResponseHandlers 388
File Management: Storing Thumbnails 390
Part IV. Advanced Topics
14. Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 395
Search Interface 395
Search Basics 395
Search Dialog 402
Search Widget 403
Query Suggestions 404
Recent Query Suggestions 404
Custom Query Suggestions 405
15. Location and Mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 411
Location-Based Services 412
Mapping 413
The Google Maps Activity 413
The MapView and MapActivity 414
Working with MapViews 415
MapView and MyLocationOverlay Initialization 415
Pausing and Resuming a MapActivity 418
Controlling the Map with Menu Buttons 419
Controlling the Map with the Keypad 421
Location Without Maps 422
The Manifest and Layout Files 422
Connecting to a Location Provider and Getting Location Updates 423
Updating the Emulated Location 426
StreetView 430
Table of Contents | ix
16. Multimedia . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 433
Audio and Video 433
Playing Audio and Video 434
Audio Playback 435
Video Playback 437
Recording Audio and Video 438
Audio Recording 439
Video Recording 442
Stored Media Content 443
17. Sensors, NFC, Speech, Gestures, and Accessibility . . . . . . . . . . . . . . . . . . . . . . . . . . . 445
Sensors 445
Position 447
Other Sensors 449
Near Field Communication (NFC) 450
Reading a Tag 451
Writing to a Tag 457
P2P Mode and Beam 459
Gesture Input 461
Accessibility 463
18. Communication, Identity, Sync, and Social Media . . . . . . . . . . . . . . . . . . . . . . . . . . 467
Account Contacts 467
Authentication and Synchronization 470
Authentication 471
Synchronization 478
Bluetooth 485
The Bluetooth Protocol Stack 485
BlueZ: The Linux Bluetooth Implementation 487
Using Bluetooth in Android Applications 487
19. The Android Native Development Kit (NDK) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 501
Native Methods and JNI Calls 502
Conventions in Native Method Calls 502
Conventions on the Java Side 503
The Android NDK 504
Setting Up the NDK Environment 504
Editing C/C++ Code in Eclipse 504
Compiling with the NDK 505
JNI, NDK, and SDK: A Sample App 506
Native Libraries and Headers Provided by the NDK 507
Building Your Own Custom Library Modules 509
Native Activities 512
x | Table of Contents
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 519
Table of Contents | xi
Programming Android Java Programming for the New Generation of Mobile Devices Second Edition (2012-09-26) Zigurd Mednieks
Preface
The purpose of this book is to enable you to create well-engineered Android applica-
tions that go beyond the scope of small example applications.
ThisbookisforpeoplecomingtoAndroidprogrammingfromavarietyofbackgrounds.
If you have been programming iPhone or Mac OS applications in Objective-C, you will
find coverage of Android tools and Java language features relevant to Android pro-
gramming that will help you bring your knowledge of mobile application development
to Android. If you are an experienced Java coder, you will find coverage of Android
application architecture that will enable you to use your Java expertise in this newly
vibrant world of client Java application development. In short, this is a book for people
with some relevant experience in object-oriented languages, mobile applications, REST
applications, and similar disciplines who want to go further than an introductory book
or online tutorials will take them.
How This Book Is Organized
We want to get you off to a fast start. The chapters in the first part of this book will
step you through using the SDK tools so that you can access example code in this book
and in the SDK, even as you expand your knowledge of SDK tools, Java, and database
design. The tools and basics covered in the first part might be familiar enough to you
that you would want to skip to Part II where we build foundational knowledge for
developing larger Android applications.
The central part of this book is an example of an application that uses web services to
deliver information to the user—something many applications have at their core. We
present an application architecture, and a novel approach to using Android’s frame-
work classes that enables you to do this particularly efficiently. You will be able to use
this application as a framework for creating your own applications, and as a tool for
learning about Android programming.
In the final part of this book, we explore Android APIs in specific application areas:
multimedia, location, sensors, and communication, among others, in order to equip
you to program applications in your specific area of interest.
xiii
By the time you reach the end of this book, we want you to have gained knowledge
beyond reference material and a walk-through of examples. We want you to have a
point of view on how to make great Android applications.
Conventions Used in This Book
The following typographical conventions are used in this book:
Italic
Indicates new terms, URLs, email addresses, filenames, and file extensions
Constant width
Used for program listings, as well as within paragraphs to refer to program elements
such as variable or function names, databases, data types, environment variables,
statements, and keywords
Constant width bold
Shows commands or other text that should be typed literally by the user
Constant width italic
Shows text that should be replaced with user-supplied values or by values deter-
mined by context
This icon signifies a tip, suggestion, or general note.
This icon indicates a warning or caution.
Using Code Examples
This book is here to help you get your job done. In general, you may use the code in
this book in your programs and documentation. You do not need to contact us for
permission unless you’re reproducing a significant portion of the code. For example,
writing a program that uses several chunks of code from this book does not require
permission. Selling or distributing a CD-ROM of examples from O’Reilly books does
require permission. Answering a question by citing this book and quoting example
code does not require permission. Incorporating a significant amount of example code
from this book into your product’s documentation does require permission.
We appreciate, but do not require, attribution. An attribution usually includes the
title, author, publisher, and ISBN. For example: “Programming Android, Second
xiv | Preface
Edition by Zigurd Mednieks, Laird Dornin, G. Blake Meike, and Masumi Nakamura.
Copyright 2012 O’Reilly Media, Inc., 978-1-449-31664-8.”
If you feel your use of code examples falls outside fair use or the permission given here,
feel free to contact us at permissions@oreilly.com.
Safari® Books Online
Safari Books Online (www.safaribooksonline.com) is an on-demand digital
library that delivers expert content in both book and video form from the
world’s leading authors in technology and business.
Technology professionals, software developers, web designers, and business and cre-
ative professionals use Safari Books Online as their primary resource for research,
problem solving, learning, and certification training.
Safari Books Online offers a range of product mixes and pricing programs for organi-
zations, government agencies, and individuals. Subscribers have access to thousands
of books, training videos, and prepublication manuscripts in one fully searchable da-
tabasefrompublisherslikeO’ReillyMedia,PrenticeHallProfessional,Addison-Wesley
Professional, Microsoft Press, Sams, Que, Peachpit Press, Focal Press, Cisco Press, John
Wiley & Sons, Syngress, Morgan Kaufmann, IBM Redbooks, Packt, Adobe Press, FT
Press, Apress, Manning, New Riders, McGraw-Hill, Jones & Bartlett, Course Tech-
nology, and dozens more. For more information about Safari Books Online, please visit
us online.
How to Contact Us
Please address comments and questions concerning this book to the publisher:
O’Reilly Media, Inc.
1005 Gravenstein Highway North
Sebastopol, CA 95472
800-998-9938 (in the United States or Canada)
707-829-0515 (international or local)
707-829-0104 (fax)
We have a web page for this book, where we list errata, examples, and any additional
information. You can access this page at http://oreil.ly/prog_android_2e.
To comment or ask technical questions about this book, send email to
bookquestions@oreilly.com.
For more information about our books, courses, conferences, and news, see our website
at http://www.oreilly.com.
Find us on Facebook: http://facebook.com/oreilly
Preface | xv
Follow us on Twitter: http://twitter.com/oreillymedia
Watch us on YouTube: http://www.youtube.com/oreillymedia
Acknowledgments
The authors have adapted portions of this book from their previously released title,
Android Application Development (O’Reilly).
Drafts of this book were released on the O’Reilly Open Feedback Publishing System
(OFPS) in order to get your feedback on whether and how we are meeting the goals for
this book. We are very grateful for the readers who participated in OFPS, and we owe
them much in correcting our errors and improving our writing. Open review of drafts
will be part of future editions, and we welcome your views on every aspect of this book.
Zigurd Mednieks
I am eternally grateful to Terry, my wife, and Maija and Charles, my children, who gave
me the time to do this. This book exists because our agent, Carole Jelen, at Waterside
Productions, whipped our proposal material into shape, and because Mike Hendrick-
son kicked off the project within O’Reilly. Brian Jepson and Andy Oram, our editors,
kept this large troupe of authors unified in purpose and result. Thanks to Johan van
der Hoeven, who provided review comments that contributed much to accuracy and
clarity. Thanks to all the reviewers who used the Open Feedback Publishing System to
help make this a better book.
Laird Dornin
Thanks to my wonderful Norah for encouraging me to take part in this project, even
though you had no idea of the amount of effort involved in writing a book. Cheers to
trips to Acadia, trips to New Hampshire, and late nights writing. I’m glad this book
did not stall our truly important project, the arrival of our beautiful daughter Claire.
Thanks to Andy our editor, and my coauthors for giving me this opportunity. Thanks
to Larry for reviewing and enabling me to work on this project. I’m glad that ideas I
developed at SavaJe could find a voice in this book. Finally, thanks to our main re-
viewers Vijay and Johan, you both found solid ways to improve the content.
G. Blake Meike
My thanks to our agent, Carole Jelen, Waterside Productions, without whom this book
would never have been more than a good idea. Thanks, also, to editors Brian Jepson
and Andy Oram, masters of the “gentle way.” Everyone who reads this book benefits
from the efforts of Johan van der Hoeven and Vijay Yellapragada, technical reviewers;
Sumita Mukherji, Adam Zaremba, and the rest of the O’Reilly production team; and
all those who used O’Reilly’s OFPS to wade through early and nearly incomprehensible
drafts, to produce salient comments and catch egregious errors. Thanks guys! Speaking
of “thanks guys,” it was quite an honor and certainly a pleasure to collaborate with my
coauthors, Zigurd, Laird, and Masumi. Of course, last, best, and as ever, thanks and
xvi | Preface
love to my wife Catherine, who challenges me in the good times and provides support
when it’s dark. Yeah, I know, the bookcase still isn’t done.
Masumi Nakamura
I would like to thank my friends and family for bearing with me as I worked on this
and other projects. An especially big thank you to Jessamyn for dealing with me all
these years. I also would like to thank Brian and Andy for getting us through the fine
points of writing and publishing, as well as my coauthors for bringing me in to work
on this piece. Also, a quick shout out to all the people at WHERE, Inc. who have been
very supportive in my technological wanderings. Finally, a thank you to you, the read-
ers, and all you developers working tirelessly to make Android a great platform to work
on and enjoy using.
Preface | xvii
Programming Android Java Programming for the New Generation of Mobile Devices Second Edition (2012-09-26) Zigurd Mednieks
Random documents with unrelated
content Scribd suggests to you:
But though in modern times we hear much said of immediate
knowledge and belief, it is a misconception to maintain that their
content, God, the Good, Just, &c., although the content of feeling
and conception, is not, as spiritual content, also posited through
thought. The animal has no religion, because it only feels; but what
is spiritual rests on the mediation of thought, and pertains to man.
Since Socrates thus introduces the infinitely important element of
leading back the truth of the objective to the thought of the subject,
just as Protagoras says that the objective first is through relation to
us, the battle of Socrates and Plato with the Sophists cannot rest on
the ground that these, as belonging to the old faith, maintained
against the others the religion and customs of Greece, for the
violation of which Anaxagoras was condemned. Quite the contrary.
Reflection, and the reference of any judgment to consciousness, is
held by Socrates in common with the Sophists. But the opposition
into which Socrates and Plato were in their philosophy necessarily
brought in regard to the Sophists, as the universal philosophic
culture of the times, was as follows:—The objective produced
through thought, is at the same time in and for itself, thus being
raised above all particularity of interests and desires, and being the
power over them. Hence because, on the one hand, to Socrates and
Plato the moment of subjective freedom is the directing of
consciousness into itself, on the other, this return is also determined
as a coming out from particular subjectivity. It is hereby implied that
contingency of events is abolished, and man has this outside within
him, as the spiritual universal. This is the true, the unity of
subjective and objective in modern terminology, while the Kantian
ideal is only phenomenal and not objective in itself.
In the third place Socrates accepted the Good at first only in the
particular significance of the practical, which nevertheless is only one
mode of the substantial Idea; the universal is not only for me, but
also, as end existent in and for itself, the principle of the philosophy
of nature, and in this higher sense it was taken by Plato and
Aristotle. Of Socrates it is hence said, in the older histories of
Philosophy, that his main distinction was having added ethics as a
new conception to Philosophy, which formerly only took nature into
consideration. Diogenes Laertius, in like manner says (III., 56), that
the Ionics founded natural philosophy, Socrates ethics, and Plato
added to them dialectic. Now ethics is partly objective, and partly
subjective and reflected morality [Sittlichkeit und Moralität],[117] and
the teaching of Socrates is properly subjectively moral, because in it
the subjective side, my perception and meaning, is the prevailing
moment, although this determination of self-positing is likewise
sublated, and the good and eternal is what is in and for itself.
Objective morality is, on the contrary, natural, since it signifies the
knowledge and doing of what is in and for itself good. The Athenians
before Socrates were objectively, and not subjectively, moral, for
they acted rationally in their relations without knowing that they
were particularly excellent. Reflective morality adds to natural
morality the reflection that this is the good and not that; the Kantian
philosophy, which is reflectively moral, again showed the difference.
Because Socrates in this way gave rise to moral philosophy, all
succeeding babblers about morality and popular philosophy
constituted him their patron and object of adoration, and made him
into a cloak which should cover all false philosophy. As he treated it,
it was undoubtedly popular; and what contributed to make it such
was that his death gave him the never-failing interest derived from
innocent suffering. Cicero (Tusc. Quæst. V. 4), whose manner of
thought was, on the one hand, of the present, and who, on the
other hand, had the belief that Philosophy should yield itself up, and
hence succeeded in attaining to no content in it, boasted of Socrates
(what has often enough been said since) that his most eminent
characteristic was to have brought Philosophy from heaven to earth,
to the homes and every-day life of men, or, as Diogenes Laertius
expresses it (II. 21), “into the market place.” There we have what
has just been said. This would seem as if the best and truest
Philosophy were only a domestic or fireside philosophy, which
conforms to all the ordinary ideas of men, and in which we see
friends and faithful ones talk together of righteousness, and of what
can be known on the earth, without having penetrated the depths of
the heavens, or rather the depths of consciousness. But this last is
exactly what Socrates, as these men themselves indicate, first
ventured to do. And it was not incumbent on him to reflect upon all
the speculations of past Philosophy, in order to be able to come
down in practical philosophy to inward thought. This gives a general
idea of his principle.
We must examine more closely this noteworthy phenomenon,
and begin with the history of Socrates’ life. This is, however, closely
intertwined with his interest in Philosophy, and the events of his life
are bound up with his principles. We have first of all to consider the
beginning of his life only. Socrates, whose birth occurs in the fourth
year of the 77th Olympiad (469 B.C.), was the son of Sophroniscus,
a sculptor, and of Phænarete, a midwife. His father brought him up
to sculpture, and it is said that Socrates acquired skill in the art, and
long after, statues of draped Graces, found in the Acropolis, were
ascribed to him. But his art did not satisfy him; a great desire for
Philosophy, and love of scientific research, got possession of him. He
pursued his art merely to get money for a necessary subsistence,
and to be able to apply himself to the study of the sciences; and it is
told of Crito, an Athenian, that he defrayed the cost of Socrates’
instruction by masters in all the arts. During the exercise of his art,
and specially after he gave it up altogether, he read the works of
ancient philosophers in so far as he could get possession of them. At
the same time he attended Anaxagoras’ instructions, and, after his
expulsion from Athens, at which time Socrates was thirty-seven
years old, those of Archelaus, who was regarded as Anaxagoras’
successor, besides those of Sophists celebrated in other sciences.
Amongst these he heard Prodicus, a celebrated teacher of oratory,
whom, according to Xenophon (Memorab. II. c. 1, §§ 21, 34), he
mentions with affection, and other teachers of music, poetry, etc. He
was esteemed as on all sides a man of culture, who was instructed
in everything then requisite thereto.[118]
Another feature in his life was that he fulfilled the duty of
protecting his country, which rested on him as an Athenian citizen.
Hence he made three campaigns in the Peloponnesian war, which
occurred during his life. The Peloponnesian war led to the dissolution
of Greek life, inasmuch as it was preparatory to it; and what took
place politically was by Socrates carried out in thinking
consciousness. In these campaigns he not only acquired the fame of
a brave warrior, but, what was best of all, the merit of having saved
the lives of other citizens. In the first, he was present at the tedious
siege of Potidæa in Thrace. Here Alcibiades had already attached
himself to him, and, according to Plato, he recited in the Banquet (p.
219-222, Steph.; p. 461-466, Bekk.), a eulogy on Socrates for being
able to endure all toil, hunger and thirst, heat and cold, with mind at
rest and health of body. In an engagement in this campaign he saw
Alcibiades wounded in the midst of the enemy, lifted him up, forced
his way through, and saved both him and his arms. The generals
rewarded him with a wreath, which was the prize of the bravest;
Socrates did not, however, take it, maintaining that it was given to
Alcibiades. In this campaign it is said that once, sunk in deep
meditation, he stood immovable on one spot the whole day and
night, until the morning sun awoke him from his trance—a condition
in which he is said often to have been. This was a cataleptic state,
which may bear some relation to magnetic somnambulism, in which
Socrates became quite dead to sensuous consciousness. From this
physical setting free of the inward abstract self from the concrete
bodily existence of the individual, we have, in the outward
manifestation, a proof of how the depths of his mind worked within
him. In him we see pre-eminently the inwardness of consciousness
that in an anthropological way existed in the first instance in him,
and became later on a usual thing. He made his other campaign in
Bœotia at Delium, a small fortification which the Athenians
possessed not far from the sea, and where they had an unfortunate,
though not an important engagement. Here Socrates saved another
of his favourites, Xenophon; he saw him in the flight, for Xenophon,
having lost his horse, lay wounded on the ground. Socrates took him
over his shoulders, carried him off, defending himself at the same
time with the greatest tranquillity and presence of mind from the
pursuing enemy. Finally he made his last campaign at Amphipolis in
Edonis, on the Strymonian Bay.[119]
Besides this, he occupied various civil offices. At the time when
the democratic constitution of Athens hitherto existing, was taken
away by the Lacedemonians, who now introduced everywhere an
aristocratic and indeed tyrannical rule, whereby they in great
measure put themselves at the head of affairs, he was chosen for
the council, which, as a representative body, took the place of the
people. Here he distinguished himself by his immovable firmness in
what he held to be right as against the wills of the thirty tyrants, as
formerly against the will of the people. For he sat in the tribunal
which condemned the ten generals to death, because, as admirals at
the battle of Arginusæ, though they certainly had conquered, yet,
being kept back through storm, they had not dragged out the bodies
nor buried them on the shore, and because they neglected to erect
trophies; i.e. really because they did not stand their ground, and
thus appeared to have been beaten. Socrates alone did not agree
with this decision, declaring himself more emphatically against the
people than against the rulers.[120] To-day he fares badly who says
anything against the people. “The people have excellent intelligence,
understand everything, and have only the most excellent intentions.”
As to rulers, governments, ministers, it is self-evident that “they
understand nothing, and only desire and bring forth what is bad.”
Along with these to him more accidental relationships to the
State, in which he acted only from the ordinary sense of citizenship,
without spontaneously making the affairs of the State his real
business, or pressing on to the head of public affairs, the real
business of his life was to discuss moral philosophy with any who
came in his way. His philosophy, which asserts that real existence is
in consciousness as a universal, is still not a properly speculative
philosophy, but remained individual; yet the aim of his philosophy
was that it should have a universal significance. Hence we have to
speak of his own individual being, of his thoroughly noble character,
which usually is depicted as a complete catalogue of the virtues
adorning the life of a private citizen; and these virtues of Socrates
are certainly to be looked at as his own, and as made habitual to
him by his own will. It has to be noted that with the ancients these
qualities have generally more of the character of virtue, because
with the ancients, in ordinary morality, individuality, as the form of
the universal, was given free scope, so that virtues were regarded
more as the actions of the individual will, and thus as personal
qualities; while with us they seem to be less what is meritorious to
the individual, or what comes from himself as this unit. We are
accustomed to think of them much more as what exists, as duty,
because we have a fuller consciousness of the universal, and
consider the pure individual, the personal inward consciousness, as
real existence and duty. With us virtues are hence actually either
elements in our dispositions and nature, or they have the form of
the universal and of what is necessary; but with Socrates they have
the form, not of ordinary morality or of a natural or necessary thing,
but of an independent determination. It is well known that his
appearance indicated naturally low and hateful qualities, which, as
indeed he says, he himself subdued.
He lived amongst his fellow-citizens, and stands before us as one
of those great plastic natures consistent through and through, such
as we often see in those times—resembling a perfect classical work
of art which has brought itself to this height of perfection. Such
individuals are not made, but have formed themselves into what
they are; they have become that which they wished to be, and are
true to this. In a real work of art the distinguishing point is that
some idea is brought forth, a character is presented in which every
trait is determined by the idea, and, because this is so, the work of
art is, on the one hand, living, and, on the other, beautiful, for the
highest beauty is just the most perfect carrying out of all sides of the
individuality in accordance with the one inward principle. Such works
of art are also seen in the great men of every time. The most plastic
individual as a statesman is Pericles, and round him, like stars,
Sophocles, Thucydides, Socrates, &c., worked out their individuality
into an existence of its own—into a character which regulated their
whole being, and which was one principle running throughout the
whole of their existence. Pericles alone lived with the sole end of
being a statesman. Plutarch (in Pericle, c. 5, 7) says of him that,
from the time that he devoted himself to the business of the State,
he laughed no more, and never again went to a feast. Thus, too,
Socrates formed himself, through his art and through the power of
self-conscious will, into this particular character, and acquired this
capacity for the business of his life. Through his principle he attained
that far-reaching influence which has lasted to the present day in
relation to religion, science, and justice, for since his time the genius
of inward conviction has been the basis which must be fundamental.
And since this principle proceeded from the plasticity of his
character, it is very inappropriate when Tennemann regrets (Vol. II.
p. 26) “that though we know what he was, we do not know how he
became such.”
Socrates was a peaceful, pious example of the moral virtues—of
wisdom, discretion, temperance, moderation, justice, courage,
inflexibility, firm sense of rectitude in relation to tyrants and people;
he was equally removed from cupidity and despotism. His
indifference to money was due to his own determination, for,
according to the custom of the times, he could acquire it through the
education of youth, like other teachers. On the other side, this
acquisition was purely matter of choice, and not, as with us,
something which is accepted, so that to take nothing would be to
break through a custom, thus to present the appearance of wishing
to become conspicuous, and to be more blamed than praised. For
this was not yet a State affair; it was under the Roman emperors
that there first were schools with payment. This moderation of his
life was likewise a power proceeding from conscious knowledge, but
this is not a principle found to hand, but the regulation of self in
accordance with circumstances; in company he was, however, a
good fellow. His sobriety in respect to wine is best depicted in Plato’s
“Symposium,” in a very characteristic scene in which we see what
Socrates called virtue. Alcibiades there appears, no longer sober, at a
feast given by Agathon, on the occasion of a success which his
tragedy had obtained on the previous day at the games. Since the
company had drunk much on the first day of the feast, the
assembled guests, amongst whom was Socrates, this evening took a
resolution, in opposition to the Greek custom at meals, to drink little.
Alcibiades, finding that he was coming in amongst abstemious men,
and that there was no one else in his own frame of mind, made
himself king of the feast, and offered the goblet to the others, in
order to bring them into the condition reached by himself; but with
Socrates he said that he could do nothing, because he remained as
he was, however much he drank. Plato then makes the individual
who tells what happened at the Banquet, also tell that he, with the
others, at last fell asleep on the couch, and as he awoke in the
morning, Socrates, cup in hand, still talked with Aristophanes and
Agathon about comedy and tragedy, and whether one man could
write both comedies and tragedies, and then went at the usual time
into the public places, to the Lyceum, as if nothing had happened,
and walked about the whole day as usual.[121] This is not a
moderation which exists in the least possible enjoyment, no aimless
abstemiousness and self-mortification, but a power belonging to
consciousness, which keeps its self-possession in bodily excess. We
see from this that we have not to think of Socrates throughout after
the fashion of the litany of moral virtues.
His behaviour to others was not only just, true, open, without
rudeness, and honourable, but we also see in him an example of the
most perfect Attic urbanity; i.e. he moves in the freest possible
relations, has a readiness for conversation which is always judicious,
and, because it has an inward universality, at the same time always
has the right living relationship to the individual, and bears upon the
case on which it operates. The intercourse is that of a most highly
cultured man who, in his relation to others, never places anything
personal in all his wit, and sets aside all that is unpleasant. Thus
Xenophon’s, but particularly Plato’s Socratic Dialogues belong to the
highest type of this fine social culture.
Because the philosophy of Socrates is no withdrawal from
existence now and here into the free, pure regions of thought, but is
in a piece with his life, it does not proceed to a system; and the
manner of his philosophizing, which appears to imply a withdrawal
from actual affairs as it did to Plato, yet in that very way gives itself
this inward connection with ordinary life. For his more special
business was his philosophic teaching, or rather his philosophic
social intercourse (for it was not, properly speaking, teaching) with
all; and this outwardly resembled ordinary Athenian life in which the
greater part of the day was passed without any particular business,
in loitering about the market-place, or frequenting the public
Lyceum, and there partly partaking of bodily exercises, and partly
and principally, talking with one another. This kind of intercourse was
only possible in the Athenian mode of life, where most of the work
which is now done by a free citizen—by a free republican and free
imperial citizen alike—was performed by slaves, seeing that it was
deemed unworthy of free men. A free citizen could in Athens
certainly be a handicraftsman, but he had slaves who did the work,
just as a master now has workmen. At the present day such a life of
movement would not be suitable to our customs. Now Socrates also
lounged about after this manner, and lived in this constant
discussion of ethical questions.[122] Thus what he did was what
came naturally to him, and what can in general be called moralizing;
but its nature and method was not that of preaching, exhortation or
teaching; it was not a dry morality. For amongst the Athenians and
in Attic urbanity, this had no place, since it is not a reciprocal, free,
and rational relationship. But with all men, however different their
characters, he entered on one kind of dialogue, with all that Attic
urbanity which, without presumption on his part, without instructing
others, or wishing to command them, while maintaining their perfect
right to freedom, and honouring it, yet causes all that is rude to be
suppressed.
1. The Socratic Method. In this conversation Socrates’ philosophy
is found, as also what is known as the Socratic method, which must
in its nature be dialectic, and of which we must speak before dealing
with the content. Socrates’ manner is not artificial; the dialogues of
the moderns, on the contrary, just because no internal reason
justifies their form, are necessarily tedious and heavy. But the
principle of his philosophy falls in with the method itself, which thus
far cannot be called method, since it is a mode which quite coincides
with the moralizing peculiar to Socrates. For the chief content is to
know the good as the absolute, and that particularly in relation to
actions. Socrates gives this point of view so high a place, that he
both puts aside the sciences which involve the contemplation of the
universal in nature, mind, &c., himself, and calls upon others to do
the same.[123] Thus it can be said that in content his philosophy had
an altogether practical aspect, and similarly the Socratic method,
which is essential to it, was distinguished by the system of first
bringing a person to reflection upon his duty by any occasion that
might either happen to be offered spontaneously, or that was
brought about by Socrates. By going to the work-places of tailors
and shoemakers, and entering into discourse with them, as also with
youths and old men, Sophists, statesmen, and citizens of all kinds,
he in the first place took their interests as his topic—whether these
were household interests, the education of children, or the interests
of knowledge or of truth. Then he led them on from a definite case
to think of the universal, and of truths and beauties which had
absolute value, since in every case, from the individual’s own
thoughts, he derived the conviction and consciousness of that which
is the definite right. This method has two prominent aspects, the
one the development of the universal from the concrete case, and
the exhibition of the notion which implicitly exists in every
consciousness,[124] and the other is the resolution of the firmly
established, and, when taken immediately in consciousness,
universal determinations of the sensuous conception or of thought,
and the causing of confusion between these and what is concrete.
a. If we proceed from the general account of Socrates’ method to
a nearer view, in the first place its effect is to inspire men with
distrust towards their presuppositions, after faith had become
wavering and they were driven to seek that which is, in themselves.
Now whether it was that he wished to bring the manner of the
Sophists into disrepute, or that he was desirous to awaken the desire
for knowledge and independent thought in the youths whom he
attracted to himself, he certainly began by adopting the ordinary
conceptions which they considered to be true. But in order to bring
others to express these, he represents himself as in ignorance of
them, and, with a seeming ingenuousness, puts questions to his
audience as if they were to instruct him, while he really wished to
draw them out. This is the celebrated Socratic irony, which in his
case is a particular mode of carrying on intercourse between one
person and another, and is thus only a subjective form of dialectic,
for real dialectic deals with the reasons for things. What he wished
to effect was, that when other people brought forward their
principles, he, from each definite proposition, should deduce as its
consequence the direct opposite of what the proposition stated, or
else allow the opposite to be deduced from their own inner
consciousness without maintaining it directly against their
statements. Sometimes he also derived the opposite from a concrete
case. But as this opposite was a principle held by men as firmly as
the other, he then went on to show that they contradicted
themselves. Thus Socrates taught those with whom he associated to
know that they knew nothing; indeed, what is more, he himself said
that he knew nothing, and therefore taught nothing. It may actually
be said that Socrates knew nothing, for he did not reach the
systematic construction of a philosophy. He was conscious of this,
and it was also not at all his aim to establish a science.
On the one view, this irony seems to be something untrue. But
when we deal with objects which have a universal interest, and
speak about them to one and to another, it is always the case that
one does not understand another’s conception of the object. For
every individual has certain ultimate words as to which he
presupposes a common knowledge. But if we really are to come to
an understanding, we find it is these presuppositions which have to
be investigated. For instance, if in more recent times belief and
reason are discussed as the subjects of present intellectual interest,
everyone pretends that he knows quite well what reason, &c., is,
and it is considered ill-bred to ask for an explanation of this, seeing
that all are supposed to know about it. A very celebrated divine, ten
years ago,[125] published ninety theses on reason, which contained
very interesting questions, but resulted in nothing, although they
were much discussed, because one person’s assertions issued from
the point of view of faith, and the other’s from that of reason, and
each remained in this state of opposition, without the one’s knowing
what the other meant. Thus what would make an understanding
possible is just the explanation of what we think is understood,
without really being so. If faith and knowledge certainly differ from
one another at the first, yet through this declaration of their notional
determinations the common element will at once appear; in that way
questions like these and the trouble taken with them may, for the
first time, become fruitful; otherwise men may chatter this way and
that for years, without making any advance. For if I say I know what
reason, what belief is, these are only quite abstract ideas; it is
necessary, in order to become concrete, that they should be
explained, and that it should be understood that what they really
are, is unknown. The irony of Socrates has this great quality of
showing how to make abstract ideas concrete and effect their
development, for on that alone depends the bringing of the Notion
into consciousness.
In recent times much has been said about the Socratic irony
which, like all dialectic, gives force to what is taken immediately, but
only in order to allow the dissolution inherent in it to come to pass;
and we may call this the universal irony of the world. Yet men have
tried to make this irony of Socrates into something quite different,
for they extended it into a universal principle; it is said to be the
highest attitude of the mind, and has been represented as the most
divine. It was Friedrich von Schlegel who first brought forward this
idea, and Ast repeated it, saying, “The most ardent love of all beauty
in the Idea, as in life, inspires Socrates’ words with inward,
unfathomable life.” This life is now said to be irony! But this irony
issues from the Fichtian philosophy, and is an essential point in the
comprehension of the conceptions of most recent times. It is when
subjective consciousness maintains its independence of everything,
that it says, “It is I who through my educated thoughts can annul all
determinations of right, morality, good, &c., because I am clearly
master of them, and I know that if anything seems good to me I can
easily subvert it, because things are only true to me in so far as they
please me now.” This irony is thus only a trifling with everything, and
it can transform all things into show: to this subjectivity nothing is
any longer serious, for any seriousness which it has, immediately
becomes dissipated again in jokes, and all noble or divine truth
vanishes away or becomes mere triviality. But the Greek gaiety, as it
breathes in Homer’s poems, is ironical, for Eros mocks the power of
Zeus and of Mars; Vulcan, limping along, serves the gods with wine,
and brings upon himself the uncontrollable laughter of the immortal
gods. Juno boxes Diana’s ears. Thus, too, there is irony in the
sacrifices of the ancients, who themselves consumed the best; in the
pain that laughs, in the keenest joy which is moved to tears, in the
scornful laughter of Mephistopheles, and in every transition from one
extreme to another—from what is best to what is worst. Sunday
morning may be passed in deep humility, profoundest contrition and
self-abasement, in striking the breast in penitence, and the evening
in eating and drinking to the full, going the round of pleasures, thus
allowing self to re-assert its independence of any such subjection.
Hypocrisy, which is of the same nature, is the truest irony. Socrates
and Plato were falsely stated to be the originators of this irony, of
which it is said that it is the “inmost and deepest life,” although they
possessed the element of subjectivity; in our time it was not
permitted to us to give effect to this irony. Ast’s “inmost, deepest
life” is just the subjective and arbitrary will, the inward divinity which
knows itself to be exalted above all. The divine is said to be the
purely negative attitude, the perception of the vanity of everything,
in which my vanity alone remains. Making the consciousness of the
nullity of everything ultimate, might indeed indicate depth of life, but
it only is the depth of emptiness, as may be seen from the ancient
comedies of Aristophanes. From this irony of our times, the irony of
Socrates is far removed; as is also the case with Plato, it has a
significance which is limited. Socrates’ premeditated irony may be
called a manner of speech, a pleasant rallying; there is in it no
satirical laughter or pretence, as though the idea were nothing but a
joke. But his tragic irony is his opposition of subjective reflection to
morality as it exists, not a consciousness of the fact that he stands
above it, but the natural aim of leading men, through thought, to the
true good and to the universal Idea.
b. Now the second element is what Socrates has called the art of
midwifery—an art which came to him from his mother.[126] It is the
assisting into the world of the thought which is already contained in
the consciousness of the individual—the showing from the concrete,
unreflected consciousness, the universality of the concrete, or from
the universally posited, the opposite which already is within it.
Socrates hence adopts a questioning attitude, and this kind of
questioning and answering has thus been called the Socratic
method; but in this method there is more than can be given in
questions and replies. For the answer seems occasionally to be quite
different from what was intended by the question, while in printed
dialogue, answers are altogether under the author’s control; but to
say that in actual life people are found to answer as they are here
made to do, is quite another thing. To Socrates those who reply may
be called pliable youths, because they reply directly to the questions,
which are so formed that they make the answer very easy, and
exclude any originality in reply. To this plastic manner, which we see
in the method of Socrates, as represented by Plato and Xenophon, it
is objected that we do not answer in the same relation in which the
questioner asks; while, with Socrates, the relation which the
questioner adopts is respected in the reply. The other way, which is
to bring forward another point of view, is undoubtedly the spirit of
an animated conversation, but such emulation is excluded from this
Socratic method, in which the principal matter is to keep to the
point. The spirit of dogmatism, self-assertion, stopping short when
we seem to get into difficulties, and escaping from them by a jest, or
by setting them aside—all these attitudes and methods are here
excluded; they do not constitute good manners, nor do they have a
place in Socrates’ dialogues. In these dialogues, it is hence not to be
wondered at that those questioned answered so precisely to the
point, while in the best modern dialogues there is always an
arbitrary element.
This difference concerns only what is external and formal. But
the principal point, and the reason why Socrates set to work with
questions in bringing the good and right into consciousness in
universal form, was that he did not proceed from what is present in
our consciousness in a simple form through setting forth the
conception allied to it in pure necessity, which would be a deduction,
a proof or, speaking generally, a consequence following from the
conception. But this concrete, as it is in natural consciousness
without thinking of it, or universality immersed in matter, he
analyzed, so that through the separation of the concrete, he brought
the universal contained therein to consciousness as universal. We
see this method also carried on to a large extent in Plato’s dialogues,
where there is, in this regard, particular skill displayed. It is the
same method which forms in every man his knowledge of the
universal; an education in self-consciousness, which is the
development of reason. The child, the uncultured man, lives in
concrete individual ideas, but to the man who grows and educates
himself, because he thereby goes back into himself as thinking,
reflection becomes reflection on the universal and the permanent
establishment of the same; and a freedom—formerly that of moving
in concrete ideas—is now that of so doing in abstractions and in
thoughts. We see such a development of universal from particular,
where a number of examples are given, treated in a very tedious
way. For us who are trained in presenting to ourselves what is
abstract, who are taught from youth up in universal principles, the
Socratic method of so-called deference, with its eloquence, has often
something tiresome and tedious about it. The universal of the
concrete case is already present to us as universal, because our
reflection is already accustomed to the universal, and we do not
require, first of all, to take the trouble of making a separation; and
thus, if Socrates were now to bring what is abstract before
consciousness, we should not require, in order to establish it as
universal, that all these examples should be adduced, so that
through repetition the subjective certainty of abstraction might arise.
c. The next result of this method of procedure may be that
consciousness is surprised that what it never looked for should be
found in consciousness. If we reflect, for example, on the universally
known idea of Becoming, we find that what becomes is not and yet
it is; it is the identity of Being and non-being, and it may surprise us
that in this simple conception so great a distinction should exist.
The result attained was partly the altogether formal and negative
one of bringing home to those who conversed with Socrates, the
conviction that, however well acquainted with the subject they had
thought themselves, they now came to the conclusion, “that what
we knew has refuted itself.” Socrates thus put questions in the intent
that the speaker should be drawn on to make admissions, implying a
point of view opposed to that from which he started. That these
contradictions arise because they bring their ideas together, is the
drift of the greater part of Socrates’ dialogues; their main tendency
consequently was to show the bewilderment and confusion which
exist in knowledge. By this means, he tries to awaken shame, and
the perception that what we consider as true is not the truth, from
which the necessity for earnest effort after knowledge must result.
Plato, amongst others, gives these examples in his Meno (p. 71-80,
Steph.; p. 327-346, Bekk.). Socrates is made to say, “By the gods,
tell me what is virtue.” Meno proceeds to make various distinctions:
“Man’s virtue is to be skilful in managing state affairs, and thereby to
help friends and harm foes; woman’s to rule her household; other
virtues are those of boys, of young men, of old men,” &c. Socrates
interrupts him by saying, that it is not that about which he inquires,
but virtue in general, which comprehends every thing in itself. Meno
says “It is to govern and rule over others.” Socrates brings forward
the fact that the virtue of boys and slaves does not consist in
governing. Meno says that he cannot tell what is common in all
virtue. Socrates replies that it is the same as figure, which is what is
common in roundness, squareness, &c. There a digression occurs.
Meno says, “Virtue is the power of securing the good desired.”
Socrates interposes that it is superfluous to say the good, for from
the time that men know that something is an evil, they do not desire
it; and also the good must be acquired in a right way. Socrates thus
confounds Meno, and he sees that these ideas are false. The latter
says, “I used to hear of you, before I knew you, that you were
yourself in doubt (ἀπορεῖς), and also brought others into doubt, and
now you cast a spell on me too, so that I am at my wits’ end
(ἀπορίας). You seem, if I may venture to jest, to be like the torpedo
fish, for it is said of it that it makes torpid (ναρκᾷν) those who come
near it and touch it. You have done this to me, for I am become
torpid in body and soul, and I do not know how to answer you,
although I have talked thousands of times about virtue with many
persons, and, as it seemed to me, talked very well. But now I do not
know at all what to say. Hence you do well not to travel amongst
strangers, for you might be put to death as a magician.” Socrates
again wishes to “inquire.” Now Meno says, “How can you inquire
about what you say you do not know? Can you have a desire for
what you do not know? And if you find it out by chance, how can
you know that it is what you looked for, since you acknowledge that,
you do not know it?” A number of dialogues end in the same
manner, both in Xenophon and Plato, leaving us quite unsatisfied as
to the result. It is so in the Lysis, where Plato asks the question of
what love and friendship secures to men; and similarly the Republic
commences by inquiring what justice is. Philosophy must, generally
speaking, begin with a puzzle in order to bring about reflection;
everything must be doubted, all presuppositions given up, to reach
the truth as created through the Notion.
2. The Principle of the Good. This, in short, is Socrates’ method.
The affirmative, what Socrates develops in the consciousness, is
nothing but the good in as far as it is brought forth from
consciousness through knowledge—it is the eternal, in and for itself
universal, what is called the Idea, the true, which just in so far as it
is end, is the Good. In this regard Socrates is opposed to the
Sophists, for the proposition that man is the measure of all things, to
them still comprehends particular ends, while to Socrates the
universal brought forth through free thought is thereby expressed in
objective fashion. Nevertheless, we must not blame the Sophists
because, in the aimlessness of their time, they did not discover the
principle of the Good; for every discovery has its time, and that of
the Good, which as end in itself is now always made the starting
point, had not yet been made by Socrates. It now seems as if we
had not yet shown forth much of the Socratic philosophy, for we
have merely kept to the principle; but the main point with Socrates
is that his knowledge for the first time reached this abstraction. The
Good is nevertheless no longer as abstract as the νοῦς of
Anaxagoras, but is the universal which determines itself in itself,
realizes itself, and has to be realized as the end of the world and of
the individual. It is a principle, concrete within itself, which, however,
is not yet manifested in its development, and in this abstract attitude
we find what is wanting in the Socratic standpoint, of which nothing
that is affirmative can, beyond this, be adduced.
a. As regards the Socratic principle, the first determination is the
great determination which is, however, still merely formal, that
consciousness creates and has to create out of itself what is the
true. This principle of subjective freedom was present to the
consciousness of Socrates himself so vividly that he despised the
other sciences as being empty learning and useless to mankind; he
has to concern himself with his moral nature only in order to do
what is best—a one-sidedness which is very characteristic of
Socrates. This religion of the Good is to Socrates, not only the
essential point to which men have to direct their thoughts, but it is
that exclusively. We see him showing how from every individual this
universal, this absolute in consciousness may be found as his reality.
Here we see law, the true and good, what was formerly present as
an existent, return into consciousness. But it is not a single chance
manifestation in this individual Socrates, for we have to comprehend
Socrates and his manifestation. In the universal consciousness, in
the spirit of the people to which he belongs, we see natural turn into
reflective morality, and he stands above as the consciousness of this
change. The spirit of the world here begins to change, a change
which was later on carried to its completion. From this higher
standpoint, Socrates, as well as the Athenian people and Socrates in
them, have to be considered. The reflection of consciousness into
itself begins here, the knowledge of the consciousness of self as
such, that it is real existence—or that God is a Spirit, or again, in a
cruder and more sensuous form, that God takes human form. This
epoch begins where essence is given up as Being—even though it
be, as hitherto, abstract Being, Being as thought. But this epoch in a
naturally moral people in the highest state of development, makes
its appearance as the destruction threatening them or breaking in
upon them unprevented. For its morality, as was usually so with the
ancients, consisted in the fact that the Good was present as a
universal, without its having had the form of the conviction of the
individual in his individual consciousness, but simply that of the
immediate absolute. It is the authoritative, present law, without
testing investigation, but yet an ultimate ground on which this moral
consciousness rests. It is the law of the State; it has authority as the
law of the gods, and thus it is universal destiny which has the form
of an existent, and is recognized as such by all. But moral
consciousness asks if this is actually law in itself? This consciousness
turned back within itself from everything that has the form of the
existent, requires to understand, to know, that the above law is
posited in truth, i.e. it demands that it should find itself therein as
consciousness. In thus returning into themselves the Athenian
people are revealed to us: uncertainty as to existent laws as existent
has arisen, and a doubt about what was held to be right, the
greatest freedom respecting all that is and was respected. This
return into itself represents the highest point reached by the mind of
Greece, in so far as it becomes no longer the mere existence of
these moralities, but the living consciousness of the same, which has
a content which is similar, but which, as spirit, moves freely in it.
This is a culture which we never find the Lacedæmonians reach. This
deepest life of morality is so to speak a free personal consciousness
of morality or of God, and a happy enjoyment of them.
Consciousness and Being have here exactly the same value and
rank; what is, is consciousness; neither is powerful above another.
The authority of law is no oppressive bond to consciousness, and all
reality is likewise no obstacle to it, for it is secure in itself. But this
return is just on the point of abandoning the content, and indeed of
positing itself as abstract consciousness, without the content, and,
as existent, opposed to it. From this equilibrium of consciousness
and Being, consciousness takes up its position as independent. This
aspect of separation is an independent conception, because
consciousness, in the perception of its independence, no longer
immediately acknowledges what is put before it, but requires that
this should first justify itself to it, i.e. it must comprehend itself
therein. Thus this return is the isolation of the individual from the
universal, care for self at the cost of the State; to us, for instance, it
is the question as to whether I shall be in eternal bliss or
condemnation, whereas philosophic eternity is present now in time,
and is nothing other than the substantial man himself. The State has
lost its power, which consisted in the unbroken continuity of the
universal spirit, as formed of single individuals, so that the individual
consciousness knew no other content and reality than law. Morals
have become shaken, because we have the idea present that man
creates his maxims for himself. The fact that the individual comes to
care for his own morality, means that he becomes reflectively moral;
when public morality disappears, reflective morality is seen to have
arisen. We now see Socrates bringing forward the opinion, that in
these times every one has to look after his own morality, and thus
he looked after his through consciousness and reflection regarding
himself; for he sought the universal spirit which had disappeared
from reality, in his own consciousness. He also helped others to care
for their morality, for he awakened in them this consciousness of
having in their thoughts the good and true, i.e. having the
potentiality of action and of knowledge. This is no longer there
immediately, but must be provided, just as a ship must make
provision of water when it goes to places where none is to be found.
The immediate has no further authority but must justify itself to
thought. Thus we comprehend the special qualities of Socrates, and
his method in Philosophy, from the whole; and we also understand
his fate from the same.
This direction of consciousness back into itself takes the form—
very markedly in Plato—of asserting that man can learn nothing,
virtue included, and that not because the latter has no relation to
science. For the good does not come from without, Socrates shows;
it cannot be taught, but is implied in the nature of mind. That is to
say, man cannot passively receive anything that is given from
without like the wax that is moulded to a form, for everything is
latent in the mind of man, and he only seems to learn it. Certainly
everything begins from without, but this is only the beginning; the
truth is that this is only an impulse towards the development of
spirit. All that has value to men, the eternal, the self-existent, is
contained in man himself, and has to develop from himself. To learn
here only means to receive knowledge of what is externally
determined. This external comes indeed through experience, but the
universal therein belongs to thought, not to the subjective and bad,
but to the objective and true. The universal in the opposition of
subjective and objective, is that which is as subjective as it is
objective; the subjective is only a particular, the objective is similarly
only a particular as regards the subjective, but the universal is the
unity of both. According to the Socratic principle, nothing has any
value to men to which the spirit does not testify. Man in it is free, is
at home with himself, and that is the subjectivity of spirit. As it is
said in the Bible, “Flesh of my flesh, and bone of my bone,” that
which is held by me as truth and right is spirit of my spirit. But what
spirit derives from itself must come from it as from the spirit which
acts in a universal manner, and not from its passions, likings, and
arbitrary desires. These, too, certainly come from something inward
which is “implanted in us by nature,” but which is only in a natural
way our own, for it belongs to the particular; high above it is true
thought, the Notion, the rational. Socrates opposed to the
contingent and particular inward, that universal, true inward of
thought. And Socrates awakened this real conscience, for he not
only said that man is the measure of all things, but man as thinking
is the measure of all things. With Plato we shall, later on, find it
formulated that what man seems to receive he only remembers.
As to the question of what is the Good, Socrates recognized its
determination as being not only a determination in particularity to
the exclusion of the natural side, as determination is understood in
empirical science, but even in relation to the actions of men, he
holds the Good to be still undetermined, and the ultimate
determinateness, or the determining, is what we may call
subjectivity generally. That the Good should be determined, primarily
signifies that while, at first, in opposition to the Being of reality, it
was a general maxim only, that to which the activity of individuality
was still wanting, in the second place it was not permitted to be
inert, to be mere thought, but had to be present as the determining
and actual, and thus as the effectual. It is such only through
subjectivity, through the activity of man. That the Good is a
determinate thus further means that individuals know what the Good
is, and we call this standpoint reflective morality, while natural
morality does right unconsciously. Thus to Socrates virtue is
perception. For to the proposition of the Platonic Protagoras that all
other virtues have a relationship to one another, but that it is not so
with valour, since many brave men are to be found who are the most
irreligious, unjust, intemperate and uncultured of people (such as a
band of robbers), Plato makes Socrates answer that valour, like all
virtues, also is a science, that is, it is the knowledge and the right
estimation of what is to be feared.[127] By this the distinctive
qualities of valour are certainly not unfolded. The naturally moral
and upright man is such without his having considered the matter at
all; it is his character, and what is good is securely rooted within him.
When, on the other hand, consciousness is concerned, the question
arises as to whether I directly desire the good or not. Hence this
consciousness of morality easily becomes dangerous, and causes the
individual to be puffed up by a good opinion of himself, which
proceeds from the consciousness of his own power to decide for the
good. The ‘I’ is then the master, he who chooses the Good, and in
that there is the conceit of my knowing that I am an excellent man.
With Socrates this opposition of the good and the subject as
choosing is not reached, for what is dealt with is only the
determination of the Good and the connection therewith of
subjectivity; this last, as an individual person who can choose,
decides upon the inward universal. We have here on the one side
the knowledge of the Good, but, on the other, it is implied that the
subject is good, since this is his ordinary character; and the fact that
the subject is such, was by the ancients called virtue.
We understand from this the following criticism which Aristotle
makes (Magna Mor. I. 1) on the quality of virtue as expounded by
Socrates. He says: “Socrates spoke better of virtue than did
Pythagoras, but not quite justly, for he made virtues into a science
(ἐπιστήμας). But this is impossible, since, though all knowledge has
some basis (λόγος) this basis only exists in thought. Consequently,
he places all the virtues in the thinking (λογιστικῷ) side of the soul.
Hence it comes to pass that he does away with the feeling (ἄλογον)
part of the soul, that is, the inclination (πᾶθος) and the habits
(ἠθος),” which, however, also pertain to virtue. “But Plato rightly
distinguished the thinking and the feeling sides of the soul.” This is a
good criticism. We see that what Aristotle misses in the
determination of virtue in Socrates, is the side of subjective actuality,
which we now call the heart. Certainly virtue is determination in
accordance with universal, and not with particular ends, but
perception is not the only element in virtue. For in order that the
good perceived should be virtue, it must come to pass that the
whole man, the heart and mind, should be identical with it, and this
aspect of Being or of realization generally, is what Aristotle calls τὸ
ἄλογον. If we understand the reality of the good as universal
morality, substantiality is wanting to the perception; but matter,
when we regard the inclination of the individual subjective will as
this reality. This double want may also be considered as a want of
content and of activity, in so far as to the universal development is
wanting; and in the latter case, determining activity comes before us
as negative only in reference to the universal. Socrates thus omits,
in characterizing virtue, just what we saw had also disappeared in
actuality, that is, first the real spirit of a people, and then reality as
the sympathies of the individual. For it is just when consciousness is
not yet turned back into itself, that the universal good appears to the
individual as the object of his sympathy. To us, on the other hand,
because we are accustomed to put on one side the good or virtue as
practical reason, the other side, which is opposed to a reflective
morality, is an equally abstract sensuousness, inclination, passion,
and hence the bad. But in order that the universal should be reality,
it must be worked out through consciousness as individual, and the
carrying into effect pertains to this individuality. A passion, as for
example, love, ambition, is the universal itself, as it is self-realizing,
not in perception, but in activity; and if we did not fear being
misunderstood, we should say that for the individual the universal is
his own interests. Yet this is not the place in which to unravel all the
false ideas and contradictions present in our culture.
Aristotle (Eth. Nicom. VI. 13), supplementing the one-sidedness
of Socrates, further says of him: “Socrates in one respect worked on
right lines, but not in the other. For to call virtue scientific knowledge
is untrue, but to say that it is not without scientific basis is right.
Socrates made virtues into perceptions (λόγους), but we say that
virtue exists with perception.” This is a very true distinction; the one
side in virtue is that the universal of end belongs to thought. But in
virtue, as character, the other side, active individuality, real soul,
must necessarily come forth; and indeed with Socrates the latter
appears in a characteristic form of which we shall speak below (p.
421 et seq.).
b. If we consider the universal first, it has within it a positive and
a negative side, which we find both united in Xenophon’s
“Memorabilia,” a work which aims at justifying Socrates. And if we
inquire whether he or Plato depicts Socrates to us most faithfully in
his personality and doctrine, there is no question that in regard to
the personality and method, the externals of his teaching, we may
certainly receive from Plato a satisfactory, and perhaps a more
complete representation of what Socrates was. But in regard to the
content of his teaching and the point reached by him in the
development of thought, we have in the main to look to Xenophon.
The fact that the reality of morality had become shaken in the
mind of the people, came to consciousness in Socrates; he stands so
high because he gave expression to what was present in the times.
In this consciousness he elevated morality into perception, but this
action is just the bringing to consciousness of the fact that it is the
power of the Notion which sublates the determinate existence and
the immediate value of moral laws and the sacredness of their
implicitude. When perception likewise positively acknowledges as law
that which was held to be law (for the positive subsists through
having recourse to laws), this acknowledgment of them always
passes through the negative mode, and no longer has the form of
absolute being-in-itself: it is, however, just as far from being a
Platonic Republic. To the Notion too, because to it the
determinateness of laws in the form in which they have value to
unperceiving consciousness has dissolved, only the purely implicit
universal Good is the true. But since this is empty and without
reality, we demand, if we are not satisfied with a dull monotonous
round, that again a movement should be made towards the
extension of the determination of the universal. Now because
Socrates remains at the indeterminateness of the good, its
determination means for him simply the expression of the particular
good. Then it comes to pass that the universal results only from the
negation of the particular good; and since this last is just the
existing laws of Greek morality, we have here the doubtlessly right,
but dangerous element in perception, the showing in all that is
particular only its deficiencies. The inconsistency of making what is
limited into an absolute, certainly becomes unconsciously corrected
in the moral man; this improvement rests partly on the morality of
the subject and partly on the whole of the social life; and
unfortunate extremes resulting in conflict are unusual and
unfrequent. But since the dialectic sublates the particular, the
abstract universal also becomes shaken.
α. Now as regards the positive side, Xenophon tells us in the
fourth book of the Memorabilia (c. 2, § 40), how Socrates, once
having made the need for perception sensible to the youths, then
actually instructed them, and no longer wandered through mere
subtleties in his talk, but taught them the good in the clearest and
most open way. That is, he showed them the good and true in what
is determined, going back into it because he did not wish to remain
in mere abstraction. Xenophon gives an example of this (Memorab.
IV. c. 4, §§ 12-16, 25) in a dialogue with the Sophist Hippias.
Socrates there asserts that the just man is he who obeys the law,
and that these laws are divine. Xenophon makes Hippias reply by
asking how Socrates could declare it to be an absolute duty to obey
the laws, for the people and the governors themselves often
condemn them by changing them, which is allowing that they are
not absolute. But Socrates answers by demanding if those who
conduct war do not again make peace, which is not, any more than
in the other case, to condemn war, for each was just in its turn.
Socrates thus says, in a word, that the best and happiest State is
that in which the citizens are of one mind and obedient to law. Now
this is the one side in which Socrates looks away from the
contradiction and makes laws and justice, as they are accepted by
each individually, to be the affirmative content. But if we here ask
what these laws are, they are, we find, just those which have a
value at some one time, as they happen to be present in the State
and in the idea; at another time they abrogate themselves as
determined, and are not held to be absolute.
β. We hence see this other negative side in the same connection
when Socrates brings Euthydemus into the conversation, for he asks
him whether he did not strive after the virtue without which neither
the private man nor the citizen could be useful to himself or to his
people or the State. Euthydemus declares that this undoubtedly is
so. But without justice, replies Socrates, this is not possible, and he
further asks whether Euthydemus had thus attained to justice in
himself. Euthydemus answers affirmatively, for he says that he thinks
he is no less just than any other man. Socrates now replies, “Just as
workmen can show their work, the just will be able to say what their
works are.” This he also agrees to, and replies that he could easily
do so. Socrates now proposes if this is so to write, “on the one hand
under Δ the actions of the just, and on the other, under Α, those of
the unjust?” With the approbation of Euthydemus, lies, deceit,
robbery, making a slave of a free man, thus fall on the side of the
unjust. Now Socrates asks, “But if a general subdues the enemy’s
State, would this not be justice?” Euthydemus says “Yes.” Socrates
replies, “Likewise if he deceives and robs the enemy and makes
slaves?” Euthydemus has to admit the justice of this. It is thus
shown “that the same qualities come under the determination both
of justice and of injustice.” Here it strikes Euthydemus to add the
qualification that he intended that Socrates should understand the
action to be only in reference to friends; as regards them it is wrong.
Socrates accepts this, but proceeds, “If a general at the decisive
moment of the battle saw his own army in fear, and he deceived
them by falsely saying that help was coming in order to lead them
on to victory, could it be deemed right?” Euthydemus acknowledges
that it could. Socrates says, “If a father gives a sick child a medicine
which it does not wish to take, in its food, and makes it well through
deceit, is this right?” Euthydemus—“Yes.” Socrates—“Or is anyone
wrong who takes arms from his friend secretly or by force, when he
sees him in despair, and in the act of taking his own life?”
Euthydemus has to admit that this is not wrong.[128] Thus it is again
shown here, that as regards friends also, the same determinations
have to hold good on both sides, as justice as well as injustice. Here
we see that abstention from lying, deceit, and robbery, that which
we naturally hold to be established, contradicts itself by being put
into connection with something different, and something which holds
equally good. This example further explains how through thought,
which would lay hold of the universal in the form of the universal
only, the particular becomes uncertain.
γ. The positive, which Socrates sets in the place of what was
fixed and has now become vacillating, in order to give a content to
the universal, is, on the one hand, and in opposition to this last,
obedience to law (p. 416), that is, the mode of thought and idea
which is inconsistent; and, on the other hand, since such
determinations do not hold good for the Notion, it is perception, in
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
Let us accompany you on the journey of exploring knowledge and
personal growth!
ebookultra.com

More Related Content

Similar to Programming Android Java Programming for the New Generation of Mobile Devices Second Edition (2012-09-26) Zigurd Mednieks (20)

PDF
Android Application Development Programming With The Google Sdk 1st Edition R...
medardidanan90
 
PDF
(Ebook) Android Cookbook by Ian F. Darwin ISBN 9781449374457, 144937445X
limos9telmaum
 
PDF
Learning Android 1st Edition Marko Gargenta
desiovissio
 
PDF
Android in Action 3rd Edition W. Frank Ableson
krapeckijek
 
PDF
android-developer-fundamentals-course-concepts-en.pdf
GashawMenberu3
 
PDF
Android Cookbook 1st Edition Ian F. Darwin
luhatknytl
 
PPTX
Seminar on android app development
AbhishekKumar4779
 
PDF
First Steps with Android - An Exciting Introduction
Cesar Augusto Nogueira
 
PDF
Android in Action 3rd Edition W. Frank Ableson
mnuugcbsip808
 
PPT
Chapter 1 Introduction to android.ppt pl
ENBAKOMZAWUGA
 
PDF
Learning Android 1st Edition Marko Gargenta
ellykarman17
 
PDF
(Ebook) Android Cookbook by Ian F. Darwin ISBN 9781449374457, 144937445X
mandevraday
 
PDF
Android Cookbook 2nd [early release] Edition Ian F. Darwin
nedraelzeyda
 
PDF
Android Cookbook Problems And Solutions For Android Developers Darwin
akifabeglin
 
PPTX
Introduction to Android Development Part 1
Kainda Kiniel Daka
 
PDF
Profession android application development
Kwanzoo Dev
 
DOC
Google android white paper
Sravan Reddy
 
PPTX
mobile application development mobile application development
Kamrankhan925215
 
PDF
[Android] Introduction to Android Programming
Nikmesoft Ltd
 
PPT
Mobile appliaction w android week 1 by osama
Osama Ghandour Geris
 
Android Application Development Programming With The Google Sdk 1st Edition R...
medardidanan90
 
(Ebook) Android Cookbook by Ian F. Darwin ISBN 9781449374457, 144937445X
limos9telmaum
 
Learning Android 1st Edition Marko Gargenta
desiovissio
 
Android in Action 3rd Edition W. Frank Ableson
krapeckijek
 
android-developer-fundamentals-course-concepts-en.pdf
GashawMenberu3
 
Android Cookbook 1st Edition Ian F. Darwin
luhatknytl
 
Seminar on android app development
AbhishekKumar4779
 
First Steps with Android - An Exciting Introduction
Cesar Augusto Nogueira
 
Android in Action 3rd Edition W. Frank Ableson
mnuugcbsip808
 
Chapter 1 Introduction to android.ppt pl
ENBAKOMZAWUGA
 
Learning Android 1st Edition Marko Gargenta
ellykarman17
 
(Ebook) Android Cookbook by Ian F. Darwin ISBN 9781449374457, 144937445X
mandevraday
 
Android Cookbook 2nd [early release] Edition Ian F. Darwin
nedraelzeyda
 
Android Cookbook Problems And Solutions For Android Developers Darwin
akifabeglin
 
Introduction to Android Development Part 1
Kainda Kiniel Daka
 
Profession android application development
Kwanzoo Dev
 
Google android white paper
Sravan Reddy
 
mobile application development mobile application development
Kamrankhan925215
 
[Android] Introduction to Android Programming
Nikmesoft Ltd
 
Mobile appliaction w android week 1 by osama
Osama Ghandour Geris
 

Recently uploaded (20)

PDF
0725.WHITEPAPER-UNIQUEWAYSOFPROTOTYPINGANDUXNOW.pdf
Thomas GIRARD, MA, CDP
 
PDF
Dimensions of Societal Planning in Commonism
StefanMz
 
PDF
The dynastic history of the Chahmana.pdf
PrachiSontakke5
 
PDF
CEREBRAL PALSY: NURSING MANAGEMENT .pdf
PRADEEP ABOTHU
 
PPTX
Quarter1-English3-W4-Identifying Elements of the Story
FLORRACHELSANTOS
 
PDF
Generative AI: it's STILL not a robot (CIJ Summer 2025)
Paul Bradshaw
 
PPT
Talk on Critical Theory, Part One, Philosophy of Social Sciences
Soraj Hongladarom
 
PPTX
ASRB NET 2023 PREVIOUS YEAR QUESTION PAPER GENETICS AND PLANT BREEDING BY SAT...
Krashi Coaching
 
PDF
IMP NAAC REFORMS 2024 - 10 Attributes.pdf
BHARTIWADEKAR
 
PPTX
Stereochemistry-Optical Isomerism in organic compoundsptx
Tarannum Nadaf-Mansuri
 
PPSX
Health Planning in india - Unit 03 - CHN 2 - GNM 3RD YEAR.ppsx
Priyanshu Anand
 
PPTX
How to Convert an Opportunity into a Quotation in Odoo 18 CRM
Celine George
 
PPT
Talk on Critical Theory, Part II, Philosophy of Social Sciences
Soraj Hongladarom
 
PPTX
THE TAME BIRD AND THE FREE BIRD.pptxxxxx
MarcChristianNicolas
 
PDF
LAW OF CONTRACT ( 5 YEAR LLB & UNITARY LLB)- MODULE-3 - LEARN THROUGH PICTURE
APARNA T SHAIL KUMAR
 
PPTX
SPINA BIFIDA: NURSING MANAGEMENT .pptx
PRADEEP ABOTHU
 
PPSX
HEALTH ASSESSMENT (Community Health Nursing) - GNM 1st Year
Priyanshu Anand
 
PPTX
How to Manage Large Scrollbar in Odoo 18 POS
Celine George
 
PDF
Isharyanti-2025-Cross Language Communication in Indonesian Language
Neny Isharyanti
 
PPTX
STAFF DEVELOPMENT AND WELFARE: MANAGEMENT
PRADEEP ABOTHU
 
0725.WHITEPAPER-UNIQUEWAYSOFPROTOTYPINGANDUXNOW.pdf
Thomas GIRARD, MA, CDP
 
Dimensions of Societal Planning in Commonism
StefanMz
 
The dynastic history of the Chahmana.pdf
PrachiSontakke5
 
CEREBRAL PALSY: NURSING MANAGEMENT .pdf
PRADEEP ABOTHU
 
Quarter1-English3-W4-Identifying Elements of the Story
FLORRACHELSANTOS
 
Generative AI: it's STILL not a robot (CIJ Summer 2025)
Paul Bradshaw
 
Talk on Critical Theory, Part One, Philosophy of Social Sciences
Soraj Hongladarom
 
ASRB NET 2023 PREVIOUS YEAR QUESTION PAPER GENETICS AND PLANT BREEDING BY SAT...
Krashi Coaching
 
IMP NAAC REFORMS 2024 - 10 Attributes.pdf
BHARTIWADEKAR
 
Stereochemistry-Optical Isomerism in organic compoundsptx
Tarannum Nadaf-Mansuri
 
Health Planning in india - Unit 03 - CHN 2 - GNM 3RD YEAR.ppsx
Priyanshu Anand
 
How to Convert an Opportunity into a Quotation in Odoo 18 CRM
Celine George
 
Talk on Critical Theory, Part II, Philosophy of Social Sciences
Soraj Hongladarom
 
THE TAME BIRD AND THE FREE BIRD.pptxxxxx
MarcChristianNicolas
 
LAW OF CONTRACT ( 5 YEAR LLB & UNITARY LLB)- MODULE-3 - LEARN THROUGH PICTURE
APARNA T SHAIL KUMAR
 
SPINA BIFIDA: NURSING MANAGEMENT .pptx
PRADEEP ABOTHU
 
HEALTH ASSESSMENT (Community Health Nursing) - GNM 1st Year
Priyanshu Anand
 
How to Manage Large Scrollbar in Odoo 18 POS
Celine George
 
Isharyanti-2025-Cross Language Communication in Indonesian Language
Neny Isharyanti
 
STAFF DEVELOPMENT AND WELFARE: MANAGEMENT
PRADEEP ABOTHU
 
Ad

Programming Android Java Programming for the New Generation of Mobile Devices Second Edition (2012-09-26) Zigurd Mednieks

  • 1. Programming Android Java Programming for the New Generation of Mobile Devices Second Edition (2012-09-26) Zigurd Mednieks download pdf https://ebookultra.com/download/programming-android-java-programming- for-the-new-generation-of-mobile-devices-second- edition-2012-09-26-zigurd-mednieks/ Visit ebookultra.com today to download the complete set of ebook or textbook!
  • 2. Here are some recommended products for you. Click the link to download, or explore more at ebookultra.com Programming Mobile Devices An Introduction for Practitioners 1st Edition Tommi Mikkonen https://ebookultra.com/download/programming-mobile-devices-an- introduction-for-practitioners-1st-edition-tommi-mikkonen/ Programming Wireless Devices with the Java 2 Platform 2nd Edition Roger Riggs https://ebookultra.com/download/programming-wireless-devices-with-the- java-2-platform-2nd-edition-roger-riggs/ 20 Recipes for Programming PhoneGap Cross Platform Mobile Development for Android and iPhone 1st Edition Munro https://ebookultra.com/download/20-recipes-for-programming-phonegap- cross-platform-mobile-development-for-android-and-iphone-1st-edition- munro/ Java Programming for the Absolute Beginner 1st Edition Joseph Russell https://ebookultra.com/download/java-programming-for-the-absolute- beginner-1st-edition-joseph-russell/
  • 3. Java Programming 7th Edition Joyce Farrell https://ebookultra.com/download/java-programming-7th-edition-joyce- farrell/ Java Programming 8th Edition Joyce Farrell https://ebookultra.com/download/java-programming-8th-edition-joyce- farrell/ Programming the Mobile Web 2nd Edition Maximiliano Firtman https://ebookultra.com/download/programming-the-mobile-web-2nd- edition-maximiliano-firtman/ Advanced Java Game Programming Wallace Croft https://ebookultra.com/download/advanced-java-game-programming- wallace-croft/ Beginning Programming with Java For Dummies 4th Edition Barry Burd https://ebookultra.com/download/beginning-programming-with-java-for- dummies-4th-edition-barry-burd/
  • 5. Programming Android Java Programming for the New Generation of Mobile Devices Second Edition (2012-09- 26) Zigurd Mednieks Digital Instant Download Author(s): Zigurd Mednieks, Laird Dornin, G. Blake Meike, Masumi Nakamu ISBN(s): 9781449316648, 1449316646 Edition: Second Edition (2012-09-26) File Details: PDF, 13.61 MB Year: 2012 Language: english
  • 8. SECOND EDITION Programming Android Zigurd Mednieks, Laird Dornin, G. Blake Meike, and Masumi Nakamura Beijing • Cambridge • Farnham • Köln • Sebastopol • Tokyo
  • 9. Programming Android, Second Edition by Zigurd Mednieks, Laird Dornin, G. Blake Meike, and Masumi Nakamura Copyright © 2012 Zigurd Mednieks, Laird Dornin, Blake Meike, and Masumi Nakamura. All rights reserved. Printed in the United States of America. Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472. O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions are also available for most titles (http://my.safaribooksonline.com). For more information, contact our corporate/institutional sales department: 800-998-9938 or [email protected]. Editors: Andy Oram and Rachel Roumeliotis Production Editor: Melanie Yarbrough Copyeditor: Audrey Doyle Proofreader: Teresa Horton Indexer: Ellen Troutman-Zaig Cover Designer: Karen Montgomery Interior Designer: David Futato Illustrator: Robert Romano September 2012: Second Edition. Revision History for the Second Edition: 2012-09-26 First release See http://oreilly.com/catalog/errata.csp?isbn=9781449316648 for release details. Nutshell Handbook, the Nutshell Handbook logo, and the O’Reilly logo are registered trademarks of O’Reilly Media, Inc. Programming Android, Second Edition, the cover image of a pine grosbeak, and related trade dress are trademarks of O’Reilly Media, Inc. Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and O’Reilly Media, Inc., was aware of a trademark claim, the designations have been printed in caps or initial caps. While every precaution has been taken in the preparation of this book, the publisher and authors assume no responsibility for errors or omissions, or for damages resulting from the use of the information con- tained herein. ISBN: 978-1-449-31664-8 [LSI] 1348682639
  • 10. Table of Contents Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiii Part I. Tools and Basics 1. Installing the Android SDK and Prerequisites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 Installing the Android SDK and Prerequisites 3 The Java Development Kit (JDK) 4 The Eclipse Integrated Development Environment (IDE) 5 The Android SDK 7 Adding Build Targets to the SDK 8 The Android Developer Tools (ADT) Plug-in for Eclipse 9 Test Drive: Confirm That Your Installation Works 12 Making an Android Project 12 Making an Android Virtual Device (AVD) 16 Running a Program on an AVD 19 Running a Program on an Android Device 20 Troubleshooting SDK Problems: No Build Targets 21 Components of the SDK 21 The Android Debug Bridge (adb) 21 The Dalvik Debug Monitor Server (DDMS) 21 Components of the ADT Eclipse Plug-in 23 Android Virtual Devices 25 Other SDK Tools 26 Keeping Up-to-Date 27 Keeping the Android SDK Up-to-Date 28 Keeping Eclipse and the ADT Plug-in Up-to-Date 28 Keeping the JDK Up-to-Date 29 Example Code 30 SDK Example Code 30 Example Code from This Book 30 On Reading Code 31 iii
  • 11. 2. Java for Android . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 Android Is Reshaping Client-Side Java 33 The Java Type System 34 Primitive Types 34 Objects and Classes 35 Object Creation 35 The Object Class and Its Methods 37 Objects, Inheritance, and Polymorphism 39 Final and Static Declarations 41 Abstract Classes 45 Interfaces 46 Exceptions 48 The Java Collections Framework 51 Garbage Collection 55 Scope 55 Java Packages 56 Access Modifiers and Encapsulation 57 Idioms of Java Programming 59 Type Safety in Java 59 Using Anonymous Classes 62 Modular Programming in Java 64 Basic Multithreaded Concurrent Programming in Java 67 Synchronization and Thread Safety 68 Thread Control with wait() and notify() Methods 71 Synchronization and Data Structures 72 3. The Ingredients of an Android Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75 Traditional Programming Models Compared to Android 75 Activities, Intents, and Tasks 77 Other Android Components 79 Service 79 Content Providers 80 BroadcastReceiver 83 Component Life Cycles 83 The Activity Life Cycle 83 On Porting Software to Android 85 Static Application Resources and Context 86 Organizing Java Source 87 Resources 88 Application Manifests 90 Initialization Parameters in AndroidManifest.xml 91 Packaging an Android Application: The .apk File 94 The Android Application Runtime Environment 94 iv | Table of Contents
  • 12. The Dalvik VM 95 Zygote: Forking a New Process 95 Sandboxing: Processes and Users 95 The Android Libraries 96 Extending Android 98 The Android Application Template 98 Overrides and Callbacks 99 Polymorphism and Composition 101 Extending Android Classes 102 Concurrency in Android 104 AsyncTask and the UI Thread 105 Threads in an Android Process 116 Serialization 118 Java Serialization 119 Parcelable 120 Classes That Support Serialization 124 Serialization and the Application Life Cycle 125 4. Getting Your Application into Users’ Hands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127 Application Signing 127 Public Key Encryption and Cryptographic Signing 127 How Signatures Protect Software Users, Publishers, and Secure Communications 129 Signing an Application 130 Placing an Application for Distribution in the Android Market 135 Becoming an Official Android Developer 135 Uploading Applications in the Market 136 Getting Paid 138 Alternative Distribution 139 Verizon Applications for Android 139 Amazon Applications for Android 141 Google Maps API Keys 143 Specifying API-Level Compatibility 144 Compatibility with Many Kinds of Screens 144 Testing for Screen Size Compatibility 145 Resource Qualifiers and Screen Sizes 145 5. Eclipse for Android Software Development . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147 Eclipse Concepts and Terminology 148 Plug-ins 148 Workspaces 149 Java Environments 150 Projects 151 Table of Contents | v
  • 13. Builders and Artifacts 151 Extensions 151 Associations 153 Eclipse Views and Perspectives 153 The Package Explorer View 154 The Task List View 154 The Outline View 155 The Problems View 155 Java Coding in Eclipse 156 Editing Java Code and Code Completion 156 Refactoring 156 Eclipse and Android 158 Preventing Bugs and Keeping Your Code Clean 158 Static Analyzers 158 Applying Static Analysis to Android Code 163 Limitations of Static Analysis 166 Eclipse Idiosyncrasies and Alternatives 166 Part II. About the Android Framework 6. Building a View . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171 Android GUI Architecture 171 The Model 171 The View 172 The Controller 173 Putting It Together 173 Assembling a Graphical Interface 175 Wiring Up the Controller 180 Listening to the Model 182 Listening for Touch Events 187 Multiple Pointers and Gestures 190 Listening for Key Events 192 Choosing an Event Handler 193 Advanced Wiring: Focus and Threading 195 The Menu and the Action Bar 199 View Debugging and Optimization 202 7. Fragments and Multiplatform Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205 Creating a Fragment 206 Fragment Life Cycle 209 The Fragment Manager 210 Fragment Transactions 211 vi | Table of Contents
  • 14. The Support Package 216 Fragments and Layout 217 8. Drawing 2D and 3D Graphics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225 Rolling Your Own Widgets 225 Layout 226 Canvas Drawing 231 Drawables 242 Bitmaps 247 Bling 248 Shadows, Gradients, Filters, and Hardware Acceleration 251 Animation 253 OpenGL Graphics 258 9. Handling and Persisting Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263 Relational Database Overview 263 SQLite 264 The SQL Language 264 SQL Data Definition Commands 265 SQL Data Manipulation Commands 268 Additional Database Concepts 270 Database Transactions 271 Example Database Manipulation Using sqlite3 271 SQL and the Database-Centric Data Model for Android Applications 275 The Android Database Classes 276 Database Design for Android Applications 277 Basic Structure of the SimpleVideoDbHelper Class 277 Using the Database API: MJAndroid 280 Android and Social Networking 280 The Source Folder (src) 282 Loading and Starting the Application 283 Database Queries and Reading Data from the Database 283 Modifying the Database 287 Part III. A Skeleton Application for Android 10. A Framework for a Well-Behaved Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295 Visualizing Life Cycles 296 Visualizing the Activity Life Cycle 296 Visualizing the Fragment Life Cycle 308 The Activity Class and Well-Behaved Applications 311 The Activity Life Cycle and the User Experience 311 Table of Contents | vii
  • 15. Life Cycle Methods of the Application Class 312 11. Building a User Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315 Top-Level Design 316 Fragment, Activity, and Scalable Design 317 Visual Editing of User Interfaces 319 Starting with a Blank Slate 319 Laying Out the Fragments 323 Lay Out Fragments Using the Visual Editor 324 Multiple Layouts 325 Folding and Unfolding a Scalable UI 326 Decisions about Screen Size and Resolution 326 Delegating to Fragment Classes 330 Making Activity, Fragment, Action Bar, and Multiple Layouts Work To- gether 333 Action Bar 333 Tabs and Fragments 333 The Other Activity 336 12. Using Content Providers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 341 Understanding Content Providers 342 Implementing a Content Provider 343 Browsing Video with Finch 344 Defining a Provider Public API 345 Defining the CONTENT_URI 346 Creating the Column Names 348 Declaring Column Specification Strings 348 Writing and Integrating a Content Provider 350 Common Content Provider Tasks 350 File Management and Binary Data 352 Android MVC and Content Observation 354 A Complete Content Provider: The SimpleFinchVideoContentProvider Code 355 The SimpleFinchVideoContentProvider Class and Instance Variables 355 Implementing the onCreate Method 357 Implementing the getType Method 358 Implementing the Provider API 358 Determining How Often to Notify Observers 363 Declaring Your Content Provider 363 13. A Content Provider as a Facade for a RESTful Web Service . . . . . . . . . . . . . . . . . . . . 365 Developing RESTful Android Applications 366 A “Network MVC” 367 viii | Table of Contents
  • 16. Summary of Benefits 369 Code Example: Dynamically Listing and Caching YouTube Video Content 370 Structure of the Source Code for the Finch YouTube Video Example 371 Stepping Through the Search Application 372 Step 1: Our UI Collects User Input 373 Step 2: Our Controller Listens for Events 373 Step 3: The Controller Queries the Content Provider with a managedQuery on the Content Provider/Model 374 Step 4: Implementing the RESTful Request 374 Constants and Initialization 375 Creating the Database 375 A Networked Query Method 375 insert and ResponseHandlers 388 File Management: Storing Thumbnails 390 Part IV. Advanced Topics 14. Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 395 Search Interface 395 Search Basics 395 Search Dialog 402 Search Widget 403 Query Suggestions 404 Recent Query Suggestions 404 Custom Query Suggestions 405 15. Location and Mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 411 Location-Based Services 412 Mapping 413 The Google Maps Activity 413 The MapView and MapActivity 414 Working with MapViews 415 MapView and MyLocationOverlay Initialization 415 Pausing and Resuming a MapActivity 418 Controlling the Map with Menu Buttons 419 Controlling the Map with the Keypad 421 Location Without Maps 422 The Manifest and Layout Files 422 Connecting to a Location Provider and Getting Location Updates 423 Updating the Emulated Location 426 StreetView 430 Table of Contents | ix
  • 17. 16. Multimedia . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 433 Audio and Video 433 Playing Audio and Video 434 Audio Playback 435 Video Playback 437 Recording Audio and Video 438 Audio Recording 439 Video Recording 442 Stored Media Content 443 17. Sensors, NFC, Speech, Gestures, and Accessibility . . . . . . . . . . . . . . . . . . . . . . . . . . . 445 Sensors 445 Position 447 Other Sensors 449 Near Field Communication (NFC) 450 Reading a Tag 451 Writing to a Tag 457 P2P Mode and Beam 459 Gesture Input 461 Accessibility 463 18. Communication, Identity, Sync, and Social Media . . . . . . . . . . . . . . . . . . . . . . . . . . 467 Account Contacts 467 Authentication and Synchronization 470 Authentication 471 Synchronization 478 Bluetooth 485 The Bluetooth Protocol Stack 485 BlueZ: The Linux Bluetooth Implementation 487 Using Bluetooth in Android Applications 487 19. The Android Native Development Kit (NDK) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 501 Native Methods and JNI Calls 502 Conventions in Native Method Calls 502 Conventions on the Java Side 503 The Android NDK 504 Setting Up the NDK Environment 504 Editing C/C++ Code in Eclipse 504 Compiling with the NDK 505 JNI, NDK, and SDK: A Sample App 506 Native Libraries and Headers Provided by the NDK 507 Building Your Own Custom Library Modules 509 Native Activities 512 x | Table of Contents
  • 18. Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 519 Table of Contents | xi
  • 20. Preface The purpose of this book is to enable you to create well-engineered Android applica- tions that go beyond the scope of small example applications. ThisbookisforpeoplecomingtoAndroidprogrammingfromavarietyofbackgrounds. If you have been programming iPhone or Mac OS applications in Objective-C, you will find coverage of Android tools and Java language features relevant to Android pro- gramming that will help you bring your knowledge of mobile application development to Android. If you are an experienced Java coder, you will find coverage of Android application architecture that will enable you to use your Java expertise in this newly vibrant world of client Java application development. In short, this is a book for people with some relevant experience in object-oriented languages, mobile applications, REST applications, and similar disciplines who want to go further than an introductory book or online tutorials will take them. How This Book Is Organized We want to get you off to a fast start. The chapters in the first part of this book will step you through using the SDK tools so that you can access example code in this book and in the SDK, even as you expand your knowledge of SDK tools, Java, and database design. The tools and basics covered in the first part might be familiar enough to you that you would want to skip to Part II where we build foundational knowledge for developing larger Android applications. The central part of this book is an example of an application that uses web services to deliver information to the user—something many applications have at their core. We present an application architecture, and a novel approach to using Android’s frame- work classes that enables you to do this particularly efficiently. You will be able to use this application as a framework for creating your own applications, and as a tool for learning about Android programming. In the final part of this book, we explore Android APIs in specific application areas: multimedia, location, sensors, and communication, among others, in order to equip you to program applications in your specific area of interest. xiii
  • 21. By the time you reach the end of this book, we want you to have gained knowledge beyond reference material and a walk-through of examples. We want you to have a point of view on how to make great Android applications. Conventions Used in This Book The following typographical conventions are used in this book: Italic Indicates new terms, URLs, email addresses, filenames, and file extensions Constant width Used for program listings, as well as within paragraphs to refer to program elements such as variable or function names, databases, data types, environment variables, statements, and keywords Constant width bold Shows commands or other text that should be typed literally by the user Constant width italic Shows text that should be replaced with user-supplied values or by values deter- mined by context This icon signifies a tip, suggestion, or general note. This icon indicates a warning or caution. Using Code Examples This book is here to help you get your job done. In general, you may use the code in this book in your programs and documentation. You do not need to contact us for permission unless you’re reproducing a significant portion of the code. For example, writing a program that uses several chunks of code from this book does not require permission. Selling or distributing a CD-ROM of examples from O’Reilly books does require permission. Answering a question by citing this book and quoting example code does not require permission. Incorporating a significant amount of example code from this book into your product’s documentation does require permission. We appreciate, but do not require, attribution. An attribution usually includes the title, author, publisher, and ISBN. For example: “Programming Android, Second xiv | Preface
  • 22. Edition by Zigurd Mednieks, Laird Dornin, G. Blake Meike, and Masumi Nakamura. Copyright 2012 O’Reilly Media, Inc., 978-1-449-31664-8.” If you feel your use of code examples falls outside fair use or the permission given here, feel free to contact us at [email protected]. Safari® Books Online Safari Books Online (www.safaribooksonline.com) is an on-demand digital library that delivers expert content in both book and video form from the world’s leading authors in technology and business. Technology professionals, software developers, web designers, and business and cre- ative professionals use Safari Books Online as their primary resource for research, problem solving, learning, and certification training. Safari Books Online offers a range of product mixes and pricing programs for organi- zations, government agencies, and individuals. Subscribers have access to thousands of books, training videos, and prepublication manuscripts in one fully searchable da- tabasefrompublisherslikeO’ReillyMedia,PrenticeHallProfessional,Addison-Wesley Professional, Microsoft Press, Sams, Que, Peachpit Press, Focal Press, Cisco Press, John Wiley & Sons, Syngress, Morgan Kaufmann, IBM Redbooks, Packt, Adobe Press, FT Press, Apress, Manning, New Riders, McGraw-Hill, Jones & Bartlett, Course Tech- nology, and dozens more. For more information about Safari Books Online, please visit us online. How to Contact Us Please address comments and questions concerning this book to the publisher: O’Reilly Media, Inc. 1005 Gravenstein Highway North Sebastopol, CA 95472 800-998-9938 (in the United States or Canada) 707-829-0515 (international or local) 707-829-0104 (fax) We have a web page for this book, where we list errata, examples, and any additional information. You can access this page at http://oreil.ly/prog_android_2e. To comment or ask technical questions about this book, send email to [email protected]. For more information about our books, courses, conferences, and news, see our website at http://www.oreilly.com. Find us on Facebook: http://facebook.com/oreilly Preface | xv
  • 23. Follow us on Twitter: http://twitter.com/oreillymedia Watch us on YouTube: http://www.youtube.com/oreillymedia Acknowledgments The authors have adapted portions of this book from their previously released title, Android Application Development (O’Reilly). Drafts of this book were released on the O’Reilly Open Feedback Publishing System (OFPS) in order to get your feedback on whether and how we are meeting the goals for this book. We are very grateful for the readers who participated in OFPS, and we owe them much in correcting our errors and improving our writing. Open review of drafts will be part of future editions, and we welcome your views on every aspect of this book. Zigurd Mednieks I am eternally grateful to Terry, my wife, and Maija and Charles, my children, who gave me the time to do this. This book exists because our agent, Carole Jelen, at Waterside Productions, whipped our proposal material into shape, and because Mike Hendrick- son kicked off the project within O’Reilly. Brian Jepson and Andy Oram, our editors, kept this large troupe of authors unified in purpose and result. Thanks to Johan van der Hoeven, who provided review comments that contributed much to accuracy and clarity. Thanks to all the reviewers who used the Open Feedback Publishing System to help make this a better book. Laird Dornin Thanks to my wonderful Norah for encouraging me to take part in this project, even though you had no idea of the amount of effort involved in writing a book. Cheers to trips to Acadia, trips to New Hampshire, and late nights writing. I’m glad this book did not stall our truly important project, the arrival of our beautiful daughter Claire. Thanks to Andy our editor, and my coauthors for giving me this opportunity. Thanks to Larry for reviewing and enabling me to work on this project. I’m glad that ideas I developed at SavaJe could find a voice in this book. Finally, thanks to our main re- viewers Vijay and Johan, you both found solid ways to improve the content. G. Blake Meike My thanks to our agent, Carole Jelen, Waterside Productions, without whom this book would never have been more than a good idea. Thanks, also, to editors Brian Jepson and Andy Oram, masters of the “gentle way.” Everyone who reads this book benefits from the efforts of Johan van der Hoeven and Vijay Yellapragada, technical reviewers; Sumita Mukherji, Adam Zaremba, and the rest of the O’Reilly production team; and all those who used O’Reilly’s OFPS to wade through early and nearly incomprehensible drafts, to produce salient comments and catch egregious errors. Thanks guys! Speaking of “thanks guys,” it was quite an honor and certainly a pleasure to collaborate with my coauthors, Zigurd, Laird, and Masumi. Of course, last, best, and as ever, thanks and xvi | Preface
  • 24. love to my wife Catherine, who challenges me in the good times and provides support when it’s dark. Yeah, I know, the bookcase still isn’t done. Masumi Nakamura I would like to thank my friends and family for bearing with me as I worked on this and other projects. An especially big thank you to Jessamyn for dealing with me all these years. I also would like to thank Brian and Andy for getting us through the fine points of writing and publishing, as well as my coauthors for bringing me in to work on this piece. Also, a quick shout out to all the people at WHERE, Inc. who have been very supportive in my technological wanderings. Finally, a thank you to you, the read- ers, and all you developers working tirelessly to make Android a great platform to work on and enjoy using. Preface | xvii
  • 26. Random documents with unrelated content Scribd suggests to you:
  • 27. But though in modern times we hear much said of immediate knowledge and belief, it is a misconception to maintain that their content, God, the Good, Just, &c., although the content of feeling and conception, is not, as spiritual content, also posited through thought. The animal has no religion, because it only feels; but what is spiritual rests on the mediation of thought, and pertains to man. Since Socrates thus introduces the infinitely important element of leading back the truth of the objective to the thought of the subject, just as Protagoras says that the objective first is through relation to us, the battle of Socrates and Plato with the Sophists cannot rest on the ground that these, as belonging to the old faith, maintained against the others the religion and customs of Greece, for the violation of which Anaxagoras was condemned. Quite the contrary. Reflection, and the reference of any judgment to consciousness, is held by Socrates in common with the Sophists. But the opposition into which Socrates and Plato were in their philosophy necessarily brought in regard to the Sophists, as the universal philosophic culture of the times, was as follows:—The objective produced through thought, is at the same time in and for itself, thus being raised above all particularity of interests and desires, and being the power over them. Hence because, on the one hand, to Socrates and Plato the moment of subjective freedom is the directing of consciousness into itself, on the other, this return is also determined as a coming out from particular subjectivity. It is hereby implied that contingency of events is abolished, and man has this outside within him, as the spiritual universal. This is the true, the unity of subjective and objective in modern terminology, while the Kantian ideal is only phenomenal and not objective in itself. In the third place Socrates accepted the Good at first only in the particular significance of the practical, which nevertheless is only one mode of the substantial Idea; the universal is not only for me, but also, as end existent in and for itself, the principle of the philosophy of nature, and in this higher sense it was taken by Plato and Aristotle. Of Socrates it is hence said, in the older histories of Philosophy, that his main distinction was having added ethics as a
  • 28. new conception to Philosophy, which formerly only took nature into consideration. Diogenes Laertius, in like manner says (III., 56), that the Ionics founded natural philosophy, Socrates ethics, and Plato added to them dialectic. Now ethics is partly objective, and partly subjective and reflected morality [Sittlichkeit und Moralität],[117] and the teaching of Socrates is properly subjectively moral, because in it the subjective side, my perception and meaning, is the prevailing moment, although this determination of self-positing is likewise sublated, and the good and eternal is what is in and for itself. Objective morality is, on the contrary, natural, since it signifies the knowledge and doing of what is in and for itself good. The Athenians before Socrates were objectively, and not subjectively, moral, for they acted rationally in their relations without knowing that they were particularly excellent. Reflective morality adds to natural morality the reflection that this is the good and not that; the Kantian philosophy, which is reflectively moral, again showed the difference. Because Socrates in this way gave rise to moral philosophy, all succeeding babblers about morality and popular philosophy constituted him their patron and object of adoration, and made him into a cloak which should cover all false philosophy. As he treated it, it was undoubtedly popular; and what contributed to make it such was that his death gave him the never-failing interest derived from innocent suffering. Cicero (Tusc. Quæst. V. 4), whose manner of thought was, on the one hand, of the present, and who, on the other hand, had the belief that Philosophy should yield itself up, and hence succeeded in attaining to no content in it, boasted of Socrates (what has often enough been said since) that his most eminent characteristic was to have brought Philosophy from heaven to earth, to the homes and every-day life of men, or, as Diogenes Laertius expresses it (II. 21), “into the market place.” There we have what has just been said. This would seem as if the best and truest Philosophy were only a domestic or fireside philosophy, which conforms to all the ordinary ideas of men, and in which we see friends and faithful ones talk together of righteousness, and of what can be known on the earth, without having penetrated the depths of
  • 29. the heavens, or rather the depths of consciousness. But this last is exactly what Socrates, as these men themselves indicate, first ventured to do. And it was not incumbent on him to reflect upon all the speculations of past Philosophy, in order to be able to come down in practical philosophy to inward thought. This gives a general idea of his principle. We must examine more closely this noteworthy phenomenon, and begin with the history of Socrates’ life. This is, however, closely intertwined with his interest in Philosophy, and the events of his life are bound up with his principles. We have first of all to consider the beginning of his life only. Socrates, whose birth occurs in the fourth year of the 77th Olympiad (469 B.C.), was the son of Sophroniscus, a sculptor, and of Phænarete, a midwife. His father brought him up to sculpture, and it is said that Socrates acquired skill in the art, and long after, statues of draped Graces, found in the Acropolis, were ascribed to him. But his art did not satisfy him; a great desire for Philosophy, and love of scientific research, got possession of him. He pursued his art merely to get money for a necessary subsistence, and to be able to apply himself to the study of the sciences; and it is told of Crito, an Athenian, that he defrayed the cost of Socrates’ instruction by masters in all the arts. During the exercise of his art, and specially after he gave it up altogether, he read the works of ancient philosophers in so far as he could get possession of them. At the same time he attended Anaxagoras’ instructions, and, after his expulsion from Athens, at which time Socrates was thirty-seven years old, those of Archelaus, who was regarded as Anaxagoras’ successor, besides those of Sophists celebrated in other sciences. Amongst these he heard Prodicus, a celebrated teacher of oratory, whom, according to Xenophon (Memorab. II. c. 1, §§ 21, 34), he mentions with affection, and other teachers of music, poetry, etc. He was esteemed as on all sides a man of culture, who was instructed in everything then requisite thereto.[118] Another feature in his life was that he fulfilled the duty of protecting his country, which rested on him as an Athenian citizen. Hence he made three campaigns in the Peloponnesian war, which
  • 30. occurred during his life. The Peloponnesian war led to the dissolution of Greek life, inasmuch as it was preparatory to it; and what took place politically was by Socrates carried out in thinking consciousness. In these campaigns he not only acquired the fame of a brave warrior, but, what was best of all, the merit of having saved the lives of other citizens. In the first, he was present at the tedious siege of Potidæa in Thrace. Here Alcibiades had already attached himself to him, and, according to Plato, he recited in the Banquet (p. 219-222, Steph.; p. 461-466, Bekk.), a eulogy on Socrates for being able to endure all toil, hunger and thirst, heat and cold, with mind at rest and health of body. In an engagement in this campaign he saw Alcibiades wounded in the midst of the enemy, lifted him up, forced his way through, and saved both him and his arms. The generals rewarded him with a wreath, which was the prize of the bravest; Socrates did not, however, take it, maintaining that it was given to Alcibiades. In this campaign it is said that once, sunk in deep meditation, he stood immovable on one spot the whole day and night, until the morning sun awoke him from his trance—a condition in which he is said often to have been. This was a cataleptic state, which may bear some relation to magnetic somnambulism, in which Socrates became quite dead to sensuous consciousness. From this physical setting free of the inward abstract self from the concrete bodily existence of the individual, we have, in the outward manifestation, a proof of how the depths of his mind worked within him. In him we see pre-eminently the inwardness of consciousness that in an anthropological way existed in the first instance in him, and became later on a usual thing. He made his other campaign in Bœotia at Delium, a small fortification which the Athenians possessed not far from the sea, and where they had an unfortunate, though not an important engagement. Here Socrates saved another of his favourites, Xenophon; he saw him in the flight, for Xenophon, having lost his horse, lay wounded on the ground. Socrates took him over his shoulders, carried him off, defending himself at the same time with the greatest tranquillity and presence of mind from the
  • 31. pursuing enemy. Finally he made his last campaign at Amphipolis in Edonis, on the Strymonian Bay.[119] Besides this, he occupied various civil offices. At the time when the democratic constitution of Athens hitherto existing, was taken away by the Lacedemonians, who now introduced everywhere an aristocratic and indeed tyrannical rule, whereby they in great measure put themselves at the head of affairs, he was chosen for the council, which, as a representative body, took the place of the people. Here he distinguished himself by his immovable firmness in what he held to be right as against the wills of the thirty tyrants, as formerly against the will of the people. For he sat in the tribunal which condemned the ten generals to death, because, as admirals at the battle of Arginusæ, though they certainly had conquered, yet, being kept back through storm, they had not dragged out the bodies nor buried them on the shore, and because they neglected to erect trophies; i.e. really because they did not stand their ground, and thus appeared to have been beaten. Socrates alone did not agree with this decision, declaring himself more emphatically against the people than against the rulers.[120] To-day he fares badly who says anything against the people. “The people have excellent intelligence, understand everything, and have only the most excellent intentions.” As to rulers, governments, ministers, it is self-evident that “they understand nothing, and only desire and bring forth what is bad.” Along with these to him more accidental relationships to the State, in which he acted only from the ordinary sense of citizenship, without spontaneously making the affairs of the State his real business, or pressing on to the head of public affairs, the real business of his life was to discuss moral philosophy with any who came in his way. His philosophy, which asserts that real existence is in consciousness as a universal, is still not a properly speculative philosophy, but remained individual; yet the aim of his philosophy was that it should have a universal significance. Hence we have to speak of his own individual being, of his thoroughly noble character, which usually is depicted as a complete catalogue of the virtues adorning the life of a private citizen; and these virtues of Socrates
  • 32. are certainly to be looked at as his own, and as made habitual to him by his own will. It has to be noted that with the ancients these qualities have generally more of the character of virtue, because with the ancients, in ordinary morality, individuality, as the form of the universal, was given free scope, so that virtues were regarded more as the actions of the individual will, and thus as personal qualities; while with us they seem to be less what is meritorious to the individual, or what comes from himself as this unit. We are accustomed to think of them much more as what exists, as duty, because we have a fuller consciousness of the universal, and consider the pure individual, the personal inward consciousness, as real existence and duty. With us virtues are hence actually either elements in our dispositions and nature, or they have the form of the universal and of what is necessary; but with Socrates they have the form, not of ordinary morality or of a natural or necessary thing, but of an independent determination. It is well known that his appearance indicated naturally low and hateful qualities, which, as indeed he says, he himself subdued. He lived amongst his fellow-citizens, and stands before us as one of those great plastic natures consistent through and through, such as we often see in those times—resembling a perfect classical work of art which has brought itself to this height of perfection. Such individuals are not made, but have formed themselves into what they are; they have become that which they wished to be, and are true to this. In a real work of art the distinguishing point is that some idea is brought forth, a character is presented in which every trait is determined by the idea, and, because this is so, the work of art is, on the one hand, living, and, on the other, beautiful, for the highest beauty is just the most perfect carrying out of all sides of the individuality in accordance with the one inward principle. Such works of art are also seen in the great men of every time. The most plastic individual as a statesman is Pericles, and round him, like stars, Sophocles, Thucydides, Socrates, &c., worked out their individuality into an existence of its own—into a character which regulated their whole being, and which was one principle running throughout the
  • 33. whole of their existence. Pericles alone lived with the sole end of being a statesman. Plutarch (in Pericle, c. 5, 7) says of him that, from the time that he devoted himself to the business of the State, he laughed no more, and never again went to a feast. Thus, too, Socrates formed himself, through his art and through the power of self-conscious will, into this particular character, and acquired this capacity for the business of his life. Through his principle he attained that far-reaching influence which has lasted to the present day in relation to religion, science, and justice, for since his time the genius of inward conviction has been the basis which must be fundamental. And since this principle proceeded from the plasticity of his character, it is very inappropriate when Tennemann regrets (Vol. II. p. 26) “that though we know what he was, we do not know how he became such.” Socrates was a peaceful, pious example of the moral virtues—of wisdom, discretion, temperance, moderation, justice, courage, inflexibility, firm sense of rectitude in relation to tyrants and people; he was equally removed from cupidity and despotism. His indifference to money was due to his own determination, for, according to the custom of the times, he could acquire it through the education of youth, like other teachers. On the other side, this acquisition was purely matter of choice, and not, as with us, something which is accepted, so that to take nothing would be to break through a custom, thus to present the appearance of wishing to become conspicuous, and to be more blamed than praised. For this was not yet a State affair; it was under the Roman emperors that there first were schools with payment. This moderation of his life was likewise a power proceeding from conscious knowledge, but this is not a principle found to hand, but the regulation of self in accordance with circumstances; in company he was, however, a good fellow. His sobriety in respect to wine is best depicted in Plato’s “Symposium,” in a very characteristic scene in which we see what Socrates called virtue. Alcibiades there appears, no longer sober, at a feast given by Agathon, on the occasion of a success which his tragedy had obtained on the previous day at the games. Since the
  • 34. company had drunk much on the first day of the feast, the assembled guests, amongst whom was Socrates, this evening took a resolution, in opposition to the Greek custom at meals, to drink little. Alcibiades, finding that he was coming in amongst abstemious men, and that there was no one else in his own frame of mind, made himself king of the feast, and offered the goblet to the others, in order to bring them into the condition reached by himself; but with Socrates he said that he could do nothing, because he remained as he was, however much he drank. Plato then makes the individual who tells what happened at the Banquet, also tell that he, with the others, at last fell asleep on the couch, and as he awoke in the morning, Socrates, cup in hand, still talked with Aristophanes and Agathon about comedy and tragedy, and whether one man could write both comedies and tragedies, and then went at the usual time into the public places, to the Lyceum, as if nothing had happened, and walked about the whole day as usual.[121] This is not a moderation which exists in the least possible enjoyment, no aimless abstemiousness and self-mortification, but a power belonging to consciousness, which keeps its self-possession in bodily excess. We see from this that we have not to think of Socrates throughout after the fashion of the litany of moral virtues. His behaviour to others was not only just, true, open, without rudeness, and honourable, but we also see in him an example of the most perfect Attic urbanity; i.e. he moves in the freest possible relations, has a readiness for conversation which is always judicious, and, because it has an inward universality, at the same time always has the right living relationship to the individual, and bears upon the case on which it operates. The intercourse is that of a most highly cultured man who, in his relation to others, never places anything personal in all his wit, and sets aside all that is unpleasant. Thus Xenophon’s, but particularly Plato’s Socratic Dialogues belong to the highest type of this fine social culture. Because the philosophy of Socrates is no withdrawal from existence now and here into the free, pure regions of thought, but is in a piece with his life, it does not proceed to a system; and the
  • 35. manner of his philosophizing, which appears to imply a withdrawal from actual affairs as it did to Plato, yet in that very way gives itself this inward connection with ordinary life. For his more special business was his philosophic teaching, or rather his philosophic social intercourse (for it was not, properly speaking, teaching) with all; and this outwardly resembled ordinary Athenian life in which the greater part of the day was passed without any particular business, in loitering about the market-place, or frequenting the public Lyceum, and there partly partaking of bodily exercises, and partly and principally, talking with one another. This kind of intercourse was only possible in the Athenian mode of life, where most of the work which is now done by a free citizen—by a free republican and free imperial citizen alike—was performed by slaves, seeing that it was deemed unworthy of free men. A free citizen could in Athens certainly be a handicraftsman, but he had slaves who did the work, just as a master now has workmen. At the present day such a life of movement would not be suitable to our customs. Now Socrates also lounged about after this manner, and lived in this constant discussion of ethical questions.[122] Thus what he did was what came naturally to him, and what can in general be called moralizing; but its nature and method was not that of preaching, exhortation or teaching; it was not a dry morality. For amongst the Athenians and in Attic urbanity, this had no place, since it is not a reciprocal, free, and rational relationship. But with all men, however different their characters, he entered on one kind of dialogue, with all that Attic urbanity which, without presumption on his part, without instructing others, or wishing to command them, while maintaining their perfect right to freedom, and honouring it, yet causes all that is rude to be suppressed. 1. The Socratic Method. In this conversation Socrates’ philosophy is found, as also what is known as the Socratic method, which must in its nature be dialectic, and of which we must speak before dealing with the content. Socrates’ manner is not artificial; the dialogues of the moderns, on the contrary, just because no internal reason justifies their form, are necessarily tedious and heavy. But the
  • 36. principle of his philosophy falls in with the method itself, which thus far cannot be called method, since it is a mode which quite coincides with the moralizing peculiar to Socrates. For the chief content is to know the good as the absolute, and that particularly in relation to actions. Socrates gives this point of view so high a place, that he both puts aside the sciences which involve the contemplation of the universal in nature, mind, &c., himself, and calls upon others to do the same.[123] Thus it can be said that in content his philosophy had an altogether practical aspect, and similarly the Socratic method, which is essential to it, was distinguished by the system of first bringing a person to reflection upon his duty by any occasion that might either happen to be offered spontaneously, or that was brought about by Socrates. By going to the work-places of tailors and shoemakers, and entering into discourse with them, as also with youths and old men, Sophists, statesmen, and citizens of all kinds, he in the first place took their interests as his topic—whether these were household interests, the education of children, or the interests of knowledge or of truth. Then he led them on from a definite case to think of the universal, and of truths and beauties which had absolute value, since in every case, from the individual’s own thoughts, he derived the conviction and consciousness of that which is the definite right. This method has two prominent aspects, the one the development of the universal from the concrete case, and the exhibition of the notion which implicitly exists in every consciousness,[124] and the other is the resolution of the firmly established, and, when taken immediately in consciousness, universal determinations of the sensuous conception or of thought, and the causing of confusion between these and what is concrete. a. If we proceed from the general account of Socrates’ method to a nearer view, in the first place its effect is to inspire men with distrust towards their presuppositions, after faith had become wavering and they were driven to seek that which is, in themselves. Now whether it was that he wished to bring the manner of the Sophists into disrepute, or that he was desirous to awaken the desire for knowledge and independent thought in the youths whom he
  • 37. attracted to himself, he certainly began by adopting the ordinary conceptions which they considered to be true. But in order to bring others to express these, he represents himself as in ignorance of them, and, with a seeming ingenuousness, puts questions to his audience as if they were to instruct him, while he really wished to draw them out. This is the celebrated Socratic irony, which in his case is a particular mode of carrying on intercourse between one person and another, and is thus only a subjective form of dialectic, for real dialectic deals with the reasons for things. What he wished to effect was, that when other people brought forward their principles, he, from each definite proposition, should deduce as its consequence the direct opposite of what the proposition stated, or else allow the opposite to be deduced from their own inner consciousness without maintaining it directly against their statements. Sometimes he also derived the opposite from a concrete case. But as this opposite was a principle held by men as firmly as the other, he then went on to show that they contradicted themselves. Thus Socrates taught those with whom he associated to know that they knew nothing; indeed, what is more, he himself said that he knew nothing, and therefore taught nothing. It may actually be said that Socrates knew nothing, for he did not reach the systematic construction of a philosophy. He was conscious of this, and it was also not at all his aim to establish a science. On the one view, this irony seems to be something untrue. But when we deal with objects which have a universal interest, and speak about them to one and to another, it is always the case that one does not understand another’s conception of the object. For every individual has certain ultimate words as to which he presupposes a common knowledge. But if we really are to come to an understanding, we find it is these presuppositions which have to be investigated. For instance, if in more recent times belief and reason are discussed as the subjects of present intellectual interest, everyone pretends that he knows quite well what reason, &c., is, and it is considered ill-bred to ask for an explanation of this, seeing that all are supposed to know about it. A very celebrated divine, ten
  • 38. years ago,[125] published ninety theses on reason, which contained very interesting questions, but resulted in nothing, although they were much discussed, because one person’s assertions issued from the point of view of faith, and the other’s from that of reason, and each remained in this state of opposition, without the one’s knowing what the other meant. Thus what would make an understanding possible is just the explanation of what we think is understood, without really being so. If faith and knowledge certainly differ from one another at the first, yet through this declaration of their notional determinations the common element will at once appear; in that way questions like these and the trouble taken with them may, for the first time, become fruitful; otherwise men may chatter this way and that for years, without making any advance. For if I say I know what reason, what belief is, these are only quite abstract ideas; it is necessary, in order to become concrete, that they should be explained, and that it should be understood that what they really are, is unknown. The irony of Socrates has this great quality of showing how to make abstract ideas concrete and effect their development, for on that alone depends the bringing of the Notion into consciousness. In recent times much has been said about the Socratic irony which, like all dialectic, gives force to what is taken immediately, but only in order to allow the dissolution inherent in it to come to pass; and we may call this the universal irony of the world. Yet men have tried to make this irony of Socrates into something quite different, for they extended it into a universal principle; it is said to be the highest attitude of the mind, and has been represented as the most divine. It was Friedrich von Schlegel who first brought forward this idea, and Ast repeated it, saying, “The most ardent love of all beauty in the Idea, as in life, inspires Socrates’ words with inward, unfathomable life.” This life is now said to be irony! But this irony issues from the Fichtian philosophy, and is an essential point in the comprehension of the conceptions of most recent times. It is when subjective consciousness maintains its independence of everything, that it says, “It is I who through my educated thoughts can annul all
  • 39. determinations of right, morality, good, &c., because I am clearly master of them, and I know that if anything seems good to me I can easily subvert it, because things are only true to me in so far as they please me now.” This irony is thus only a trifling with everything, and it can transform all things into show: to this subjectivity nothing is any longer serious, for any seriousness which it has, immediately becomes dissipated again in jokes, and all noble or divine truth vanishes away or becomes mere triviality. But the Greek gaiety, as it breathes in Homer’s poems, is ironical, for Eros mocks the power of Zeus and of Mars; Vulcan, limping along, serves the gods with wine, and brings upon himself the uncontrollable laughter of the immortal gods. Juno boxes Diana’s ears. Thus, too, there is irony in the sacrifices of the ancients, who themselves consumed the best; in the pain that laughs, in the keenest joy which is moved to tears, in the scornful laughter of Mephistopheles, and in every transition from one extreme to another—from what is best to what is worst. Sunday morning may be passed in deep humility, profoundest contrition and self-abasement, in striking the breast in penitence, and the evening in eating and drinking to the full, going the round of pleasures, thus allowing self to re-assert its independence of any such subjection. Hypocrisy, which is of the same nature, is the truest irony. Socrates and Plato were falsely stated to be the originators of this irony, of which it is said that it is the “inmost and deepest life,” although they possessed the element of subjectivity; in our time it was not permitted to us to give effect to this irony. Ast’s “inmost, deepest life” is just the subjective and arbitrary will, the inward divinity which knows itself to be exalted above all. The divine is said to be the purely negative attitude, the perception of the vanity of everything, in which my vanity alone remains. Making the consciousness of the nullity of everything ultimate, might indeed indicate depth of life, but it only is the depth of emptiness, as may be seen from the ancient comedies of Aristophanes. From this irony of our times, the irony of Socrates is far removed; as is also the case with Plato, it has a significance which is limited. Socrates’ premeditated irony may be called a manner of speech, a pleasant rallying; there is in it no satirical laughter or pretence, as though the idea were nothing but a
  • 40. joke. But his tragic irony is his opposition of subjective reflection to morality as it exists, not a consciousness of the fact that he stands above it, but the natural aim of leading men, through thought, to the true good and to the universal Idea. b. Now the second element is what Socrates has called the art of midwifery—an art which came to him from his mother.[126] It is the assisting into the world of the thought which is already contained in the consciousness of the individual—the showing from the concrete, unreflected consciousness, the universality of the concrete, or from the universally posited, the opposite which already is within it. Socrates hence adopts a questioning attitude, and this kind of questioning and answering has thus been called the Socratic method; but in this method there is more than can be given in questions and replies. For the answer seems occasionally to be quite different from what was intended by the question, while in printed dialogue, answers are altogether under the author’s control; but to say that in actual life people are found to answer as they are here made to do, is quite another thing. To Socrates those who reply may be called pliable youths, because they reply directly to the questions, which are so formed that they make the answer very easy, and exclude any originality in reply. To this plastic manner, which we see in the method of Socrates, as represented by Plato and Xenophon, it is objected that we do not answer in the same relation in which the questioner asks; while, with Socrates, the relation which the questioner adopts is respected in the reply. The other way, which is to bring forward another point of view, is undoubtedly the spirit of an animated conversation, but such emulation is excluded from this Socratic method, in which the principal matter is to keep to the point. The spirit of dogmatism, self-assertion, stopping short when we seem to get into difficulties, and escaping from them by a jest, or by setting them aside—all these attitudes and methods are here excluded; they do not constitute good manners, nor do they have a place in Socrates’ dialogues. In these dialogues, it is hence not to be wondered at that those questioned answered so precisely to the
  • 41. point, while in the best modern dialogues there is always an arbitrary element. This difference concerns only what is external and formal. But the principal point, and the reason why Socrates set to work with questions in bringing the good and right into consciousness in universal form, was that he did not proceed from what is present in our consciousness in a simple form through setting forth the conception allied to it in pure necessity, which would be a deduction, a proof or, speaking generally, a consequence following from the conception. But this concrete, as it is in natural consciousness without thinking of it, or universality immersed in matter, he analyzed, so that through the separation of the concrete, he brought the universal contained therein to consciousness as universal. We see this method also carried on to a large extent in Plato’s dialogues, where there is, in this regard, particular skill displayed. It is the same method which forms in every man his knowledge of the universal; an education in self-consciousness, which is the development of reason. The child, the uncultured man, lives in concrete individual ideas, but to the man who grows and educates himself, because he thereby goes back into himself as thinking, reflection becomes reflection on the universal and the permanent establishment of the same; and a freedom—formerly that of moving in concrete ideas—is now that of so doing in abstractions and in thoughts. We see such a development of universal from particular, where a number of examples are given, treated in a very tedious way. For us who are trained in presenting to ourselves what is abstract, who are taught from youth up in universal principles, the Socratic method of so-called deference, with its eloquence, has often something tiresome and tedious about it. The universal of the concrete case is already present to us as universal, because our reflection is already accustomed to the universal, and we do not require, first of all, to take the trouble of making a separation; and thus, if Socrates were now to bring what is abstract before consciousness, we should not require, in order to establish it as
  • 42. universal, that all these examples should be adduced, so that through repetition the subjective certainty of abstraction might arise. c. The next result of this method of procedure may be that consciousness is surprised that what it never looked for should be found in consciousness. If we reflect, for example, on the universally known idea of Becoming, we find that what becomes is not and yet it is; it is the identity of Being and non-being, and it may surprise us that in this simple conception so great a distinction should exist. The result attained was partly the altogether formal and negative one of bringing home to those who conversed with Socrates, the conviction that, however well acquainted with the subject they had thought themselves, they now came to the conclusion, “that what we knew has refuted itself.” Socrates thus put questions in the intent that the speaker should be drawn on to make admissions, implying a point of view opposed to that from which he started. That these contradictions arise because they bring their ideas together, is the drift of the greater part of Socrates’ dialogues; their main tendency consequently was to show the bewilderment and confusion which exist in knowledge. By this means, he tries to awaken shame, and the perception that what we consider as true is not the truth, from which the necessity for earnest effort after knowledge must result. Plato, amongst others, gives these examples in his Meno (p. 71-80, Steph.; p. 327-346, Bekk.). Socrates is made to say, “By the gods, tell me what is virtue.” Meno proceeds to make various distinctions: “Man’s virtue is to be skilful in managing state affairs, and thereby to help friends and harm foes; woman’s to rule her household; other virtues are those of boys, of young men, of old men,” &c. Socrates interrupts him by saying, that it is not that about which he inquires, but virtue in general, which comprehends every thing in itself. Meno says “It is to govern and rule over others.” Socrates brings forward the fact that the virtue of boys and slaves does not consist in governing. Meno says that he cannot tell what is common in all virtue. Socrates replies that it is the same as figure, which is what is common in roundness, squareness, &c. There a digression occurs. Meno says, “Virtue is the power of securing the good desired.”
  • 43. Socrates interposes that it is superfluous to say the good, for from the time that men know that something is an evil, they do not desire it; and also the good must be acquired in a right way. Socrates thus confounds Meno, and he sees that these ideas are false. The latter says, “I used to hear of you, before I knew you, that you were yourself in doubt (ἀπορεῖς), and also brought others into doubt, and now you cast a spell on me too, so that I am at my wits’ end (ἀπορίας). You seem, if I may venture to jest, to be like the torpedo fish, for it is said of it that it makes torpid (ναρκᾷν) those who come near it and touch it. You have done this to me, for I am become torpid in body and soul, and I do not know how to answer you, although I have talked thousands of times about virtue with many persons, and, as it seemed to me, talked very well. But now I do not know at all what to say. Hence you do well not to travel amongst strangers, for you might be put to death as a magician.” Socrates again wishes to “inquire.” Now Meno says, “How can you inquire about what you say you do not know? Can you have a desire for what you do not know? And if you find it out by chance, how can you know that it is what you looked for, since you acknowledge that, you do not know it?” A number of dialogues end in the same manner, both in Xenophon and Plato, leaving us quite unsatisfied as to the result. It is so in the Lysis, where Plato asks the question of what love and friendship secures to men; and similarly the Republic commences by inquiring what justice is. Philosophy must, generally speaking, begin with a puzzle in order to bring about reflection; everything must be doubted, all presuppositions given up, to reach the truth as created through the Notion. 2. The Principle of the Good. This, in short, is Socrates’ method. The affirmative, what Socrates develops in the consciousness, is nothing but the good in as far as it is brought forth from consciousness through knowledge—it is the eternal, in and for itself universal, what is called the Idea, the true, which just in so far as it is end, is the Good. In this regard Socrates is opposed to the Sophists, for the proposition that man is the measure of all things, to them still comprehends particular ends, while to Socrates the
  • 44. universal brought forth through free thought is thereby expressed in objective fashion. Nevertheless, we must not blame the Sophists because, in the aimlessness of their time, they did not discover the principle of the Good; for every discovery has its time, and that of the Good, which as end in itself is now always made the starting point, had not yet been made by Socrates. It now seems as if we had not yet shown forth much of the Socratic philosophy, for we have merely kept to the principle; but the main point with Socrates is that his knowledge for the first time reached this abstraction. The Good is nevertheless no longer as abstract as the νοῦς of Anaxagoras, but is the universal which determines itself in itself, realizes itself, and has to be realized as the end of the world and of the individual. It is a principle, concrete within itself, which, however, is not yet manifested in its development, and in this abstract attitude we find what is wanting in the Socratic standpoint, of which nothing that is affirmative can, beyond this, be adduced. a. As regards the Socratic principle, the first determination is the great determination which is, however, still merely formal, that consciousness creates and has to create out of itself what is the true. This principle of subjective freedom was present to the consciousness of Socrates himself so vividly that he despised the other sciences as being empty learning and useless to mankind; he has to concern himself with his moral nature only in order to do what is best—a one-sidedness which is very characteristic of Socrates. This religion of the Good is to Socrates, not only the essential point to which men have to direct their thoughts, but it is that exclusively. We see him showing how from every individual this universal, this absolute in consciousness may be found as his reality. Here we see law, the true and good, what was formerly present as an existent, return into consciousness. But it is not a single chance manifestation in this individual Socrates, for we have to comprehend Socrates and his manifestation. In the universal consciousness, in the spirit of the people to which he belongs, we see natural turn into reflective morality, and he stands above as the consciousness of this change. The spirit of the world here begins to change, a change
  • 45. which was later on carried to its completion. From this higher standpoint, Socrates, as well as the Athenian people and Socrates in them, have to be considered. The reflection of consciousness into itself begins here, the knowledge of the consciousness of self as such, that it is real existence—or that God is a Spirit, or again, in a cruder and more sensuous form, that God takes human form. This epoch begins where essence is given up as Being—even though it be, as hitherto, abstract Being, Being as thought. But this epoch in a naturally moral people in the highest state of development, makes its appearance as the destruction threatening them or breaking in upon them unprevented. For its morality, as was usually so with the ancients, consisted in the fact that the Good was present as a universal, without its having had the form of the conviction of the individual in his individual consciousness, but simply that of the immediate absolute. It is the authoritative, present law, without testing investigation, but yet an ultimate ground on which this moral consciousness rests. It is the law of the State; it has authority as the law of the gods, and thus it is universal destiny which has the form of an existent, and is recognized as such by all. But moral consciousness asks if this is actually law in itself? This consciousness turned back within itself from everything that has the form of the existent, requires to understand, to know, that the above law is posited in truth, i.e. it demands that it should find itself therein as consciousness. In thus returning into themselves the Athenian people are revealed to us: uncertainty as to existent laws as existent has arisen, and a doubt about what was held to be right, the greatest freedom respecting all that is and was respected. This return into itself represents the highest point reached by the mind of Greece, in so far as it becomes no longer the mere existence of these moralities, but the living consciousness of the same, which has a content which is similar, but which, as spirit, moves freely in it. This is a culture which we never find the Lacedæmonians reach. This deepest life of morality is so to speak a free personal consciousness of morality or of God, and a happy enjoyment of them. Consciousness and Being have here exactly the same value and rank; what is, is consciousness; neither is powerful above another.
  • 46. The authority of law is no oppressive bond to consciousness, and all reality is likewise no obstacle to it, for it is secure in itself. But this return is just on the point of abandoning the content, and indeed of positing itself as abstract consciousness, without the content, and, as existent, opposed to it. From this equilibrium of consciousness and Being, consciousness takes up its position as independent. This aspect of separation is an independent conception, because consciousness, in the perception of its independence, no longer immediately acknowledges what is put before it, but requires that this should first justify itself to it, i.e. it must comprehend itself therein. Thus this return is the isolation of the individual from the universal, care for self at the cost of the State; to us, for instance, it is the question as to whether I shall be in eternal bliss or condemnation, whereas philosophic eternity is present now in time, and is nothing other than the substantial man himself. The State has lost its power, which consisted in the unbroken continuity of the universal spirit, as formed of single individuals, so that the individual consciousness knew no other content and reality than law. Morals have become shaken, because we have the idea present that man creates his maxims for himself. The fact that the individual comes to care for his own morality, means that he becomes reflectively moral; when public morality disappears, reflective morality is seen to have arisen. We now see Socrates bringing forward the opinion, that in these times every one has to look after his own morality, and thus he looked after his through consciousness and reflection regarding himself; for he sought the universal spirit which had disappeared from reality, in his own consciousness. He also helped others to care for their morality, for he awakened in them this consciousness of having in their thoughts the good and true, i.e. having the potentiality of action and of knowledge. This is no longer there immediately, but must be provided, just as a ship must make provision of water when it goes to places where none is to be found. The immediate has no further authority but must justify itself to thought. Thus we comprehend the special qualities of Socrates, and his method in Philosophy, from the whole; and we also understand his fate from the same.
  • 47. This direction of consciousness back into itself takes the form— very markedly in Plato—of asserting that man can learn nothing, virtue included, and that not because the latter has no relation to science. For the good does not come from without, Socrates shows; it cannot be taught, but is implied in the nature of mind. That is to say, man cannot passively receive anything that is given from without like the wax that is moulded to a form, for everything is latent in the mind of man, and he only seems to learn it. Certainly everything begins from without, but this is only the beginning; the truth is that this is only an impulse towards the development of spirit. All that has value to men, the eternal, the self-existent, is contained in man himself, and has to develop from himself. To learn here only means to receive knowledge of what is externally determined. This external comes indeed through experience, but the universal therein belongs to thought, not to the subjective and bad, but to the objective and true. The universal in the opposition of subjective and objective, is that which is as subjective as it is objective; the subjective is only a particular, the objective is similarly only a particular as regards the subjective, but the universal is the unity of both. According to the Socratic principle, nothing has any value to men to which the spirit does not testify. Man in it is free, is at home with himself, and that is the subjectivity of spirit. As it is said in the Bible, “Flesh of my flesh, and bone of my bone,” that which is held by me as truth and right is spirit of my spirit. But what spirit derives from itself must come from it as from the spirit which acts in a universal manner, and not from its passions, likings, and arbitrary desires. These, too, certainly come from something inward which is “implanted in us by nature,” but which is only in a natural way our own, for it belongs to the particular; high above it is true thought, the Notion, the rational. Socrates opposed to the contingent and particular inward, that universal, true inward of thought. And Socrates awakened this real conscience, for he not only said that man is the measure of all things, but man as thinking is the measure of all things. With Plato we shall, later on, find it formulated that what man seems to receive he only remembers.
  • 48. As to the question of what is the Good, Socrates recognized its determination as being not only a determination in particularity to the exclusion of the natural side, as determination is understood in empirical science, but even in relation to the actions of men, he holds the Good to be still undetermined, and the ultimate determinateness, or the determining, is what we may call subjectivity generally. That the Good should be determined, primarily signifies that while, at first, in opposition to the Being of reality, it was a general maxim only, that to which the activity of individuality was still wanting, in the second place it was not permitted to be inert, to be mere thought, but had to be present as the determining and actual, and thus as the effectual. It is such only through subjectivity, through the activity of man. That the Good is a determinate thus further means that individuals know what the Good is, and we call this standpoint reflective morality, while natural morality does right unconsciously. Thus to Socrates virtue is perception. For to the proposition of the Platonic Protagoras that all other virtues have a relationship to one another, but that it is not so with valour, since many brave men are to be found who are the most irreligious, unjust, intemperate and uncultured of people (such as a band of robbers), Plato makes Socrates answer that valour, like all virtues, also is a science, that is, it is the knowledge and the right estimation of what is to be feared.[127] By this the distinctive qualities of valour are certainly not unfolded. The naturally moral and upright man is such without his having considered the matter at all; it is his character, and what is good is securely rooted within him. When, on the other hand, consciousness is concerned, the question arises as to whether I directly desire the good or not. Hence this consciousness of morality easily becomes dangerous, and causes the individual to be puffed up by a good opinion of himself, which proceeds from the consciousness of his own power to decide for the good. The ‘I’ is then the master, he who chooses the Good, and in that there is the conceit of my knowing that I am an excellent man. With Socrates this opposition of the good and the subject as choosing is not reached, for what is dealt with is only the
  • 49. determination of the Good and the connection therewith of subjectivity; this last, as an individual person who can choose, decides upon the inward universal. We have here on the one side the knowledge of the Good, but, on the other, it is implied that the subject is good, since this is his ordinary character; and the fact that the subject is such, was by the ancients called virtue. We understand from this the following criticism which Aristotle makes (Magna Mor. I. 1) on the quality of virtue as expounded by Socrates. He says: “Socrates spoke better of virtue than did Pythagoras, but not quite justly, for he made virtues into a science (ἐπιστήμας). But this is impossible, since, though all knowledge has some basis (λόγος) this basis only exists in thought. Consequently, he places all the virtues in the thinking (λογιστικῷ) side of the soul. Hence it comes to pass that he does away with the feeling (ἄλογον) part of the soul, that is, the inclination (πᾶθος) and the habits (ἠθος),” which, however, also pertain to virtue. “But Plato rightly distinguished the thinking and the feeling sides of the soul.” This is a good criticism. We see that what Aristotle misses in the determination of virtue in Socrates, is the side of subjective actuality, which we now call the heart. Certainly virtue is determination in accordance with universal, and not with particular ends, but perception is not the only element in virtue. For in order that the good perceived should be virtue, it must come to pass that the whole man, the heart and mind, should be identical with it, and this aspect of Being or of realization generally, is what Aristotle calls τὸ ἄλογον. If we understand the reality of the good as universal morality, substantiality is wanting to the perception; but matter, when we regard the inclination of the individual subjective will as this reality. This double want may also be considered as a want of content and of activity, in so far as to the universal development is wanting; and in the latter case, determining activity comes before us as negative only in reference to the universal. Socrates thus omits, in characterizing virtue, just what we saw had also disappeared in actuality, that is, first the real spirit of a people, and then reality as the sympathies of the individual. For it is just when consciousness is
  • 50. not yet turned back into itself, that the universal good appears to the individual as the object of his sympathy. To us, on the other hand, because we are accustomed to put on one side the good or virtue as practical reason, the other side, which is opposed to a reflective morality, is an equally abstract sensuousness, inclination, passion, and hence the bad. But in order that the universal should be reality, it must be worked out through consciousness as individual, and the carrying into effect pertains to this individuality. A passion, as for example, love, ambition, is the universal itself, as it is self-realizing, not in perception, but in activity; and if we did not fear being misunderstood, we should say that for the individual the universal is his own interests. Yet this is not the place in which to unravel all the false ideas and contradictions present in our culture. Aristotle (Eth. Nicom. VI. 13), supplementing the one-sidedness of Socrates, further says of him: “Socrates in one respect worked on right lines, but not in the other. For to call virtue scientific knowledge is untrue, but to say that it is not without scientific basis is right. Socrates made virtues into perceptions (λόγους), but we say that virtue exists with perception.” This is a very true distinction; the one side in virtue is that the universal of end belongs to thought. But in virtue, as character, the other side, active individuality, real soul, must necessarily come forth; and indeed with Socrates the latter appears in a characteristic form of which we shall speak below (p. 421 et seq.). b. If we consider the universal first, it has within it a positive and a negative side, which we find both united in Xenophon’s “Memorabilia,” a work which aims at justifying Socrates. And if we inquire whether he or Plato depicts Socrates to us most faithfully in his personality and doctrine, there is no question that in regard to the personality and method, the externals of his teaching, we may certainly receive from Plato a satisfactory, and perhaps a more complete representation of what Socrates was. But in regard to the content of his teaching and the point reached by him in the development of thought, we have in the main to look to Xenophon.
  • 51. The fact that the reality of morality had become shaken in the mind of the people, came to consciousness in Socrates; he stands so high because he gave expression to what was present in the times. In this consciousness he elevated morality into perception, but this action is just the bringing to consciousness of the fact that it is the power of the Notion which sublates the determinate existence and the immediate value of moral laws and the sacredness of their implicitude. When perception likewise positively acknowledges as law that which was held to be law (for the positive subsists through having recourse to laws), this acknowledgment of them always passes through the negative mode, and no longer has the form of absolute being-in-itself: it is, however, just as far from being a Platonic Republic. To the Notion too, because to it the determinateness of laws in the form in which they have value to unperceiving consciousness has dissolved, only the purely implicit universal Good is the true. But since this is empty and without reality, we demand, if we are not satisfied with a dull monotonous round, that again a movement should be made towards the extension of the determination of the universal. Now because Socrates remains at the indeterminateness of the good, its determination means for him simply the expression of the particular good. Then it comes to pass that the universal results only from the negation of the particular good; and since this last is just the existing laws of Greek morality, we have here the doubtlessly right, but dangerous element in perception, the showing in all that is particular only its deficiencies. The inconsistency of making what is limited into an absolute, certainly becomes unconsciously corrected in the moral man; this improvement rests partly on the morality of the subject and partly on the whole of the social life; and unfortunate extremes resulting in conflict are unusual and unfrequent. But since the dialectic sublates the particular, the abstract universal also becomes shaken. α. Now as regards the positive side, Xenophon tells us in the fourth book of the Memorabilia (c. 2, § 40), how Socrates, once having made the need for perception sensible to the youths, then
  • 52. actually instructed them, and no longer wandered through mere subtleties in his talk, but taught them the good in the clearest and most open way. That is, he showed them the good and true in what is determined, going back into it because he did not wish to remain in mere abstraction. Xenophon gives an example of this (Memorab. IV. c. 4, §§ 12-16, 25) in a dialogue with the Sophist Hippias. Socrates there asserts that the just man is he who obeys the law, and that these laws are divine. Xenophon makes Hippias reply by asking how Socrates could declare it to be an absolute duty to obey the laws, for the people and the governors themselves often condemn them by changing them, which is allowing that they are not absolute. But Socrates answers by demanding if those who conduct war do not again make peace, which is not, any more than in the other case, to condemn war, for each was just in its turn. Socrates thus says, in a word, that the best and happiest State is that in which the citizens are of one mind and obedient to law. Now this is the one side in which Socrates looks away from the contradiction and makes laws and justice, as they are accepted by each individually, to be the affirmative content. But if we here ask what these laws are, they are, we find, just those which have a value at some one time, as they happen to be present in the State and in the idea; at another time they abrogate themselves as determined, and are not held to be absolute. β. We hence see this other negative side in the same connection when Socrates brings Euthydemus into the conversation, for he asks him whether he did not strive after the virtue without which neither the private man nor the citizen could be useful to himself or to his people or the State. Euthydemus declares that this undoubtedly is so. But without justice, replies Socrates, this is not possible, and he further asks whether Euthydemus had thus attained to justice in himself. Euthydemus answers affirmatively, for he says that he thinks he is no less just than any other man. Socrates now replies, “Just as workmen can show their work, the just will be able to say what their works are.” This he also agrees to, and replies that he could easily do so. Socrates now proposes if this is so to write, “on the one hand
  • 53. under Δ the actions of the just, and on the other, under Α, those of the unjust?” With the approbation of Euthydemus, lies, deceit, robbery, making a slave of a free man, thus fall on the side of the unjust. Now Socrates asks, “But if a general subdues the enemy’s State, would this not be justice?” Euthydemus says “Yes.” Socrates replies, “Likewise if he deceives and robs the enemy and makes slaves?” Euthydemus has to admit the justice of this. It is thus shown “that the same qualities come under the determination both of justice and of injustice.” Here it strikes Euthydemus to add the qualification that he intended that Socrates should understand the action to be only in reference to friends; as regards them it is wrong. Socrates accepts this, but proceeds, “If a general at the decisive moment of the battle saw his own army in fear, and he deceived them by falsely saying that help was coming in order to lead them on to victory, could it be deemed right?” Euthydemus acknowledges that it could. Socrates says, “If a father gives a sick child a medicine which it does not wish to take, in its food, and makes it well through deceit, is this right?” Euthydemus—“Yes.” Socrates—“Or is anyone wrong who takes arms from his friend secretly or by force, when he sees him in despair, and in the act of taking his own life?” Euthydemus has to admit that this is not wrong.[128] Thus it is again shown here, that as regards friends also, the same determinations have to hold good on both sides, as justice as well as injustice. Here we see that abstention from lying, deceit, and robbery, that which we naturally hold to be established, contradicts itself by being put into connection with something different, and something which holds equally good. This example further explains how through thought, which would lay hold of the universal in the form of the universal only, the particular becomes uncertain. γ. The positive, which Socrates sets in the place of what was fixed and has now become vacillating, in order to give a content to the universal, is, on the one hand, and in opposition to this last, obedience to law (p. 416), that is, the mode of thought and idea which is inconsistent; and, on the other hand, since such determinations do not hold good for the Notion, it is perception, in
  • 54. Welcome to our website – the ideal destination for book lovers and knowledge seekers. With a mission to inspire endlessly, we offer a vast collection of books, ranging from classic literary works to specialized publications, self-development books, and children's literature. Each book is a new journey of discovery, expanding knowledge and enriching the soul of the reade Our website is not just a platform for buying books, but a bridge connecting readers to the timeless values of culture and wisdom. With an elegant, user-friendly interface and an intelligent search system, we are committed to providing a quick and convenient shopping experience. Additionally, our special promotions and home delivery services ensure that you save time and fully enjoy the joy of reading. Let us accompany you on the journey of exploring knowledge and personal growth! ebookultra.com