Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8159605
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T17:58:37+00:00 2026-06-06T17:58:37+00:00

I success go the flow of native call java method, but when the java

  • 0

I success go the flow of native call java method,
but when the java method contains ui method, ui method always failed,
and logcat will print VM aborting error:

E/ListenerTest( 1399): virtual void JNIListenerContext::postEv(int32_t)
W/dalvikvm( 1399): JNI WARNING: JNI method called with exception pending
W/dalvikvm( 1399):              in Ldalvik/system/NativeStart;.run:()V (CallStaticVoidMethodV)
W/dalvikvm( 1399): Pending exception is:
I/dalvikvm( 1399): "Binder Thread #2" prio=5 tid=10 NATIVE
I/dalvikvm( 1399):   | group="main" sCount=0 dsCount=0 obj=0x413f0b98 self=0x89b7e8
I/dalvikvm( 1399):   | sysTid=1411 nice=0 sched=0/0 cgrp=default handle=8998000
I/dalvikvm( 1399):   | schedstat=( 0 0 0 ) utm=0 stm=0 core=0
I/dalvikvm( 1399):   at dalvik.system.NativeStart.run(Native Method)
I/dalvikvm( 1399):
E/dalvikvm( 1399): VM aborting

In my native code:

JNIEnv *env = AndroidRuntime::getJNIEnv();
env->CallStaticVoidMethod( jclass, jmethod, arg);// call java method postEv(arg)

In my java code:

class ListenerClass {
    ... ...
    private static Listener mListener = null;
    public interface Listener {
        public void onMyListener( int arg );
    }

    public void registerListener (Listener listener) {
        Log.d( TAG,"registerListener");
        mListener = listener;
    }

    public static void postEv( int arg ) {
        Log.d( TAG,"postEv");
        if( mListener != null ) {
            mListener.onMyListener( arg );
        } else {
            Log.d( TAG,"no Listener");
        }
    }
}

public class ListenerDemo extends Activity implements ListenerClass.Listener
    ... ...
    private TextView info;
    private ListenerClass lisener = null;

    public void onCreate(Bundle savedInstanceState) {

        info = (TextView) findViewById(R.id.info);
        info.setTextColor(Color.WHITE);
        info.setTextSize(20);

        info.setText("haha");  // this works

        lisener = new ListenerClass();

        Log.d( TAG,"lisener.registerListener");
        lisener.registerListener(this);

    }

    public void onMyListener( int arg ) {
        Log.d(TAG,"arg is: " + arg );  // this works
        info.setText("haha");  // this not works
    }
    ... ...
}

I really don’t know why this happaned.
And I want the TextView to show, when an event has push to java’s onMyListener.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T17:58:38+00:00Added an answer on June 6, 2026 at 5:58 pm

    At last, I found the reason why ui method can not be called.

    My Native Call Java uses CallStaticVoidMethod(…), which means class method.

    “private TextView info” is none static, which means object variable.

    Although onMyListener is none static, it can use none static member info.

    Native static method -> Java none-static method -> Java none-static variable seems ok.
    =>
    Native static method –> Java none-static variable is not ok.

    You can’t use object variable in class method.
    The reason is very clear but the jni process hide the reason.

    My good job!
    At the beginning I doubt this static use, today i try CallVoidMethod and it success.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I get this response: {success:true,errorCode:-1,error:} No HTML inside the JSON, but the js say
I on success of an ajax call I am trying to populate each items
I already audit authorization success, failure and logout. I've considered auditing (logging) every method
I've been using the AbstractRoutingDataSource with great success, but have hit upon an issue
I get success when i test it using database wizard. But I get the
On success of a web service i receive a UUID. ie C3D668DC-1231-3902-49318B046AD48A5F I need
according documentation: On success, the function returns the converted integral number as a long
Have someone used with success TRAC ticketing + wiki system accessing a code base
I tried with no success: webBrowser1.Document.ExecCommand(alert('Hello World!'), true, null); also tried: private void webBrowser1_DocumentCompleted(object
When evaluating the success of products such as the iPhone, iPad, Google, Twitter, YouTube,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.