Reputation: 11659
This question relates to Android development on Intellij IDEA 13 or Android Studio.
I created a very simple custom View:
public class CustomView extends View{
public CustomView(Context context, AttributeSet attrs) {
super(context, attrs);
Log.i("TAG", "Hello Preview!");
}
}
I then embedded it into a layout:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.example.myapplication.app.CustomView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FFFF00"/>
</FrameLayout>
I can now see the view in the layout preview window:
If I ran the app on a device or emulator, I would expect to see the text "Hello Preview!" in the logcat window, but if I use preview mode, the log is empty:
Is there any way to log output from a custom view running in preview mode? I don't want run the app on a device or emulator just to see the log output from a view.
I don't care if the solution involves Log.i. You could suggest some other logging function or even a custom plugin or library.
Upvotes: 0
Views: 651
Reputation: 48232
There's no device connected so no one sends Log.i
to you. If you run the program on emulator or on a phone the output will be there
Upvotes: 1