zoukankan      html  css  js  c++  java
  • javap -s 查看java方法签名

       工程先用eclipse生成class目录,转到class目录下执行: javap -s com.example.hellojni.MainActivity

    Compiled from "MainActivity.java"
    public class com.example.hellojni.MainActivity extends android.app.Activity {
      static {};
        Signature: ()V
    
      public com.example.hellojni.MainActivity();
        Signature: ()V
    
      protected void onCreate(android.os.Bundle);
        Signature: (Landroid/os/Bundle;)V
    
      public boolean onCreateOptionsMenu(android.view.Menu);
        Signature: (Landroid/view/Menu;)Z
    
      public native java.lang.String stringFromJNI(); //native 方法
        Signature: ()Ljava/lang/String;  //签名
    
      public native int max(int, int); //native 方法
        Signature: (II)I    //签名
    }

    最后附上com/example/hellojni/MainActivity.java代码:

     1 package com.example.hellojni;
     2 import android.os.Bundle;
     3 import android.app.Activity;
     4 import android.util.Log;
     5 import android.view.Menu;
     6 import android.widget.TextView;
     7 
     8 public class MainActivity extends Activity {
     9     @Override
    10     protected void onCreate(Bundle savedInstanceState) {
    11         super.onCreate(savedInstanceState);
    12         setContentView(R.layout.activity_main);
    13         TextView  tv = new TextView(this);
    14         tv.setText( stringFromJNI() );
    15         setContentView(tv);        
    16         Log.d("JNI", "max = " + max(10, 100));
    17     }
    18     @Override
    19     public boolean onCreateOptionsMenu(Menu menu) {
    20         getMenuInflater().inflate(R.menu.main, menu);
    21         return true;
    22     }
    23     
    24     public native String  stringFromJNI();
    25     public native int max(int a,int b); 
    26     static {
    27         System.loadLibrary("hellojni");
    28     }
    29 }
  • 相关阅读:
    remove white space from read
    optimize the access speed of django website
    dowload image from requests
    run jupyter from command
    crawl wechat page
    python version 2.7 required which was not found in the registry windows 7
    health
    alternate rows shading using conditional formatting
    word
    【JAVA基础】static 关键字
  • 原文地址:https://www.cnblogs.com/chuanwei-zhang/p/3941868.html
Copyright © 2011-2022 走看看