[android-developers] Android shared preference via JNI
in my android application in need to access the shared memory between the two application ,i knew android kernel is not like Linux kernel to implement the shared memory concept ,so i have choosen the shared preference in android but i need to implement this via JNI not in java part i have tried to create a shared preference in jni but i cant get it properly this my code JNIEXPORT jlong JNICALL Java_com_sharedpref1_test_savevalue (JNIEnv *env, jobject ctx, jstring store, jstring key, jlong value); jobject shared_preferences = (*env)-CallObjectMethod(env, ctx, (*env)-GetMethodID(env (*env)-FindClass(env, android/content/Context), getSharedPreferences, (L/java/lang/String;I)Landroid/content/SharedPreferences;), jstore, 1); jobject preferences_editor = (*env)-CallObjectMethod(env, shared_preferences, (*env)-GetMethodID(env, (*env)-FindClass(env, android/content/SharedPreferences), editor, ()Landroid/content/SharedPreferences$Editor;)); (*env)-CallObjectMethod(env, preferences_editor, (*env)-GetMethodID(env, (*env)-FindClass(env, android/content/SharedPreferences/Editor), putLong, (Ljava/lang/String;J)Landroid/content/SharedPreferences$Editor;), jkey, value); } can any know how to done shared preference in jni on android. -- -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[android-developers] Android :package with resource file in jar
I have planned to create an SDK in android, that means to share my class files and resource(layouts) to another application that requires them. If I export my application as JAR it does not include the resource files and R.class. I know currently Android does not support to packaging resource file via JAR but I searched the net and found one solution if compile our resource files with source code means we can access the resource in some other application. So for that reason I did it in the following way: 1.copied all res folders content into my source folder src -com.mypackege - res---here i put my res folder 2.finally my src folder look like src com.mypackage myfile.java drawable-hdpi drawable-ldpi drawable-mdpi drawable-xhdpi com.mypackage.drawable com.mypackage.layout com.mypackage.menu com.mypackage.values 3. and i build my project i got all class files including resource and r.class in my bin 4.then i create jar manually by jar -cvf mysample.jar com/mypackage/* 5.the final jar contain all classes and resource of my project in side mypackage. then I add `mysample.jar` into another application say `testapp`, here I put the JAR in asset folder(because of layout )and add to build path. And also I configure the build path In this application I call the `myfile.class` from `mysample.jar` which is needed to load the layout from that JAR. The problem is here it doesn't see resource under the JAR file it only see the resource in current project res folder and though `NULL pointer Exception` But it calls the R.java from JAR file. Ad also i tried to put xmlns:custom=http://schemas.android.com/apk/res-auto; in my manifest file it is also not working. I hope I exactly come to close this issue, it may be a resource mapping problem. do you have any idea to resolve this? -- -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[android-developers] Android updated zip not working
I need to push some .so files in android system directory such as system/lib and system/bin so I wrote updated-script in android and also I signed my zip, I did the following manner working directory system lib my.so I am using updated zip generator tool which create my updated script in META-INF\com\google\android folder(and also I put updated binary here) updated-script show_progress 0.1 0 copy_dir PACKAGE:system SYSTEM: show_progress 0.1 10 Copy the update.zip file to sdcard and apply it from recovery console,but it display some error installation aborted E:Error in /tmp/sidlod/package.zip status 0 as of my knowledge I did every thing is right I follow the procedure from [ here][1] [1]: http://www.londatiga.net/it/how-to-create-android-update-zip-package/ But why I get his error, apart from that any procedure is needed for coping file into android system folder via updated zip? -- -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[android-developers] Android c++ service at boot time
I need to start a service at boot time in android i don't use broadcast receiver , i wrote a service in c++ because i need access driver libusb layer to communicate with my extrernal device ,the service is working properly if i started manualy,if i want to start the service at boot time means i need to edit inir.rc file in android if i do that it also working good .but the problem is i cant edit the init.rc in all devices. i put my service in Sytem/bin location and edit the init.rc file as follow service sampleservice/system/bin/sampleservice oneshot disable for manualy i started the service from terminal like this #./system/bin/sampleservice but i cant start the service at each and every time when system restarts do have any idea to start the service at boot time with out edit init.rc -- -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[android-developers] webview inside popup window
in my application i have to show the popup page in webview,i use javainterface for showing the popup,but i got the popup window but the page was not display i got the empty popup window in main page i call the javainterface method to show pop,i have cretaed the popup like this public void showpopup() { LayoutInflater layoutInflater = (LayoutInflater)getBaseContext() .getSystemService(LAYOUT_INFLATER_SERVICE); View popupView = layoutInflater.inflate(R.layout.activity_main, null); final PopupWindow popupWindow = new PopupWindow( popupView, LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); popupWindow.setContentView(popupView); infoWebView = (WebView)popupView. findViewById(R.id.webviewActionView); WebSettings settings = infoWebView.getSettings(); // settings.setSupportMultipleWindows(false); settings.setJavaScriptEnabled(true); infoWebView.setWebViewClient(new WebViewClient()); infoWebView.setWebChromeClient(new WebChromeClient()); // settings.setJavaScriptCanOpenWindowsAutomatically(false); // settings.setBuiltInZoomControls(true); // infoWebView.requestFocusFromTouch(); infoWebView.loadUrl(http://www.google.com;); // popupWindow.setOutsideTouchable(false); infoWebView.setWebViewClient(new WebViewClient() { @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { view.loadUrl(url); return true; } }); buttton=(Button)popupView.findViewById(R.id.popup_closer); buttton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { popupWindow.dismiss(); } }); popupWindow.showAtLocation(Browser, Gravity.BOTTOM, 10,10); popupWindow.update(20, 70, 600, 500); } } what's the wron with this code ,can any onme know how do this -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] how to show popup window in webview
i have developed web applictaion in android here i need to show the pop inside the webview, i tried in many way when i using window.open means it open on the same webview or it can load in browser. i have done the following settings WebSettings settings = Browser.getSettings(); settings.setSupportMultipleWindows(false); settings.setJavaScriptEnabled(true); Browser.setWebViewClient(new WebViewClient()); Browser.setWebChromeClient(new WebChromeClient()); settings.setJavaScriptCanOpenWindowsAutomatically(false); settings.setBuiltInZoomControls(true); Browser.requestFocusFromTouch(); but i want show the poplike this do any idea about how to show the popup in side the webview. https://lh3.googleusercontent.com/-YmVjPkl096E/UP6k19dBviI/AIE/s1pCg3_NmKI/s1600/z0KQk.png -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] thread wait in android
i have one problem with handling the thread in android ,in my class i have to create one thread which create some UI after that thread finish i will get some value ,here i want to wait my Main Process until the thread complete it process but when i put wait() or notify in Main process thread does not show the UI in my application this is sample code protected void onCreate(Bundle savedInstanceState) { downloadThread = new MyThread(this); downloadThread.start(); synchronized(this){ try { this.wait(); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } String test=Recognition.gettemp(); public class MyThread extends Thread { private Recognition recognition; public MyThread(Recognition recognition) { this.recognition = recognition; // TODO Auto-generated constructor stub } @Override public void run() { synchronized(this) { handler.post(new MyRunnable()); } notifyAll(); } } } static public class MyRunnable implements Runnable { public void run() { settemp(template); } } } public static String gettemp() { return template; } public static void settemp(String template) { Recognition.template = template; } } here i will not use AsynTask because i have some other issue that is reason i choose Thread even now the problem is Thread wait do any give the suggestion for this -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] how to close custom dialog class in android
I have a problem with closing a custom dialog. I have two classes class 1- AndroidHTMLActivity class 2- CustomizeDialog In my `AndroidHTMLActivity` I use java interface which is call from javascript, in this class i call `CustomizeDialog` public class AndroidHTMLActivity extends Activity { WebView myBrowser; setContentView(R.layout.main); myBrowser = (WebView)findViewById(R.id.mybrowser); myBrowser.addJavascriptInterface(new MyJavaScriptInterface(this), AndroidFunction); myBrowser.getSettings().setJavaScriptEnabled(true); myBrowser.loadUrl(file:///android_asset/mypage.html); } public class MyJavaScriptInterface { Context mContext; MyJavaScriptInterface(Context c) { mContext = c; } public void openAndroidDialog(){ CustomizeDialog customizeDialog = new CustomizeDialog(mContext); customizeDialog.show(); } CustomizeDialog .java public class CustomizeDialog extends Dialog { Context ctx ; public CustomizeDialog(Context context) { super(context); ctx = context; } protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.test); MyThread downloadThread = new MyThread(); downloadThread.start(); } public class MyThread extends Thread { @Override public void run() { try { handler.post(new MyRunnable()); } } } static public class MyRunnable implements Runnable { public void run() { // here i want to close this customized dialog } } Here i can't use `finish()` method, I want to close the customized dialog box via the thread. Anyone has any idea about this? -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] how to close custom dialog class in android
I have a problem with closing a custom dialog. I have two classes class 1- AndroidHTMLActivity class 2- CustomizeDialog In my `AndroidHTMLActivity` I use java interface which is call from javascript, in this class i call `CustomizeDialog` public class AndroidHTMLActivity extends Activity { WebView myBrowser; setContentView(R.layout.main); myBrowser = (WebView)findViewById(R.id.mybrowser); myBrowser.addJavascriptInterface(new MyJavaScriptInterface(this), AndroidFunction); myBrowser.getSettings().setJavaScriptEnabled(true); myBrowser.loadUrl(file:///android_asset/mypage.html); } public class MyJavaScriptInterface { Context mContext; MyJavaScriptInterface(Context c) { mContext = c; } public void openAndroidDialog(){ CustomizeDialog customizeDialog = new CustomizeDialog(mContext); customizeDialog.show(); } CustomizeDialog .java public class CustomizeDialog extends Dialog { Context ctx ; public CustomizeDialog(Context context) { super(context); ctx = context; } protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.test); MyThread downloadThread = new MyThread(); downloadThread.start(); } public class MyThread extends Thread { @Override public void run() { try { handler.post(new MyRunnable()); } } } static public class MyRunnable implements Runnable { public void run() { // here i want to close this customized dialog } } Here i can't use `finish()` method, I want to close the customized dialog box via the thread. Anyone has any idea about this? -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] image view on Customized dialog box
I have one problem with customized dialog box in android,i have created the customized dialog using javainterface in android ,in my class CustomizeDialog i have one thread do some process in back ground after that i have set one imgae to this customized dialog i set the image in OnPostExecute but i got the following error android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views. i know we can't access the main ui from another thread but we access the main ui in OnPostExecuted in my case that also not working , in my another class(main.class) i will call this class by CustomizeDialog customizeDialog = new CustomizeDialog(mContext); customizeDialog.show(); this my code which create dialog box public class CustomizeDialog extends Dialog implements OnClickListener { Button okButton; ImageView img = null; ImageView img2=null; ImageView img3 = null; ImageView img4= null; Bitmap bm; public CustomizeDialog(Context context) { super(context); img2 = (ImageView) findViewById(R.id.imageView1); img3 = (ImageView) findViewById(R.id.imageView3); img4 = (ImageView) findViewById(R.id.imageView4); WindowManager.LayoutParams params = getWindow().getAttributes(); params.x = 30; params.height = 500; params.width = 500; params.y = 50; this.getWindow().setAttributes(params); setContentView(R.layout.test); img = (ImageView) findViewById(R.id.imageView2); img.setBackgroundResource(R.drawable.sample); AnimationDrawable frameAnimation = (AnimationDrawable) img.getBackground(); //Start the animation (looped playback by default). frameAnimation.start(); new LongOperation1(context).execute(); } else { Toast toast = Toast.makeText(getContext(), Erorr, Toast.LENGTH_SHORT); toast.setGravity(Gravity.CENTER_VERTICAL, 0, 0); toast.show(); } } private class LongOperation1 extends AsyncTaskString, String, String { @Override protected String doInBackground(String... params) { //here i do some process return Executed; } @Override protected void onPostExecute(String result) { // here i do some process to get bm img2.setImageBitmap(bm); } @Override protected void onPreExecute() { } @Override protected void onProgressUpdate(String... values) { } } do any have idea about how to do this -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Android Browser plug in
i am new android , i need to build a plug for android native browser ,i don't where i start it, i surfing internet i don't get correct source for my development any one have sample code for Android browser plug in -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] how to build stand alone shared library in Android
i want build one stand alone shared library in android, i compile one sample application using arm-linux-androideabi-gcc but when i compile i doesn't load standard include files i got this error, how to link the standard include files in Android arm-linux-androideabi-gcc -fpic -c hello.c hello.c:1:6: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token In file included from hello.c:2:0: f:\android-ndk-r8b\toolchains\arm-linux-androideabi-4.6\prebuilt\windows\bin\../lib/gcc/arm-linux-androideabi/4.6.x-google/include-fixed/stdio.h:50:23: fatal error: sys/cdefs.h: No such file or directory compilation terminated. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en