title: get application name from NDK
body: <p>I need to get name of my android application from the native side somethin like that:</p>
  
  <pre><code> android.content.context context=(android.content.context) this;//current activiy
   Resources appR =context.getResources();
   String packageName=context.getPackageName();
   int id=appR.getIdentifier("app_name","string",packageName );
   CharSequence txt = appR.getText(id);
  </code></pre>
  
  <p>my native code like that:</p>
  
  <pre><code>  jstring Java_com_AnalyticToolC_AnalyticToolActivity_JNISendData(JNIEnv* env,jobject entryObject,jobject contxt)
   {
  
     char *realAppName;
   realAppName=(char *)malloc(16 * 1024);
   jclass android_content_Context =(*env)-&gt;GetObjectClass(env, contxt);
      jmethodID midGetPackageName = (*env)-&gt;GetMethodID(env, android_content_Context, "getPackageName", "()Ljava/lang/String");
   jstring packageName=(*env)-&gt;CallObjectMethod(env, contxt, midGetPackageName);
  jmethodID midGetResources = (*env)-&gt;GetMethodID(env, android_content_Context, "getResources", "()L");
      jobject jResource=(*env)-&gt;CallObjectMethod(env, context, midGetResources);
  
     jclass resource_Class=(*env)-&gt;GetObjectClass(env, jResource);
     jmethodID midGetIdentifier = (*env)-&gt;GetMethodID(env, resource_Class, "getIdentifier", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String)I");
     jstring app_name=(*env)-&gt;NewStringUTF(env,"app_name");
     jstring TypeName=(*env)-&gt;NewStringUTF(env,"string");
     int id=(*env)-&gt;CallObjectMethod(env, jResource, midGetIdentifier,app_name,TypeName,packageName);
  
    jmethodID midGetAppName = (*env)-&gt;GetMethodID(env, resource_Class,"getText","(I)Ljava/lang/String");
    jstring appName=(*env)-&gt;CallObjectMethod(env, jResource, midGetAppName,id);   
  
    realAppName=(*env)-&gt;GetStringUTFChars(env, appName, NULL);
  }
  </code></pre>
  
  <p>and i just pass the activity to my native methon from java code.</p>
  
  <p>and i don't have a chance to write this code in java class then call it form my NDK application 
  I'm trying a lot to pass a context object as jobject to my native code but it always crash.
  dose any one have any idea?</p>