-1

I am trying to Print some messages using Log.i but it doesn't print anything, the problem starts after I updated the Android studio.

How can I solve the problem?

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Log.i("check","**************checking");
        setContentView(R.layout.activity_main);

    }
}
Markus Kauppinen
  • 3,025
  • 4
  • 20
  • 30
Mari
  • 15
  • 7

3 Answers3

0

Make sure you select the device you are using, you can do it on the top left side of the Logcat.

for example if you used an emulator and than a device make sure the device is selected.

Gal
  • 422
  • 5
  • 21
0

An alternate solution, but it's not the best.

System.out.print();
dcanh121
  • 4,665
  • 11
  • 37
  • 84
Dylan
  • 454
  • 2
  • 16
  • Using this will make it difficult to search, as it does not have tag. – dcanh121 May 08 '19 at 14:28
  • @dcanh121 I was just providing an alternative. Searching was not something the question stated was a necessity.. Why the downvote? – Dylan May 08 '19 at 14:33
  • 1
    You can always just incorporate the tag into your message – PPartisan May 08 '19 at 14:38
  • Using "Log" class has many advantages, rather than using System.out.println(). https://stackoverflow.com/a/2220559 – dcanh121 May 08 '19 at 14:41
  • @dcanh121 Sure it does, but again, I was just providing an alternative suggestion. Why downvote an alternative suggestion that works (for better or for worse).. To deter new contributors to the site from trying to help? – Dylan May 08 '19 at 14:58
  • @Dylan I appreciate the alternate solution even if it's not the best. Cannot remove downvote unless the answer is edited. – dcanh121 May 08 '19 at 15:28
-1

Try using the tag constant

public static final string TAG = "MainActivity"

Then do

Log.d(TAG, YOURMESSAGE)

Also as an alternative you can use System.out

Eshwar NE
  • 113
  • 1
  • 1
  • 8