Recepty, články, nápady, programování. Dříve dum-zahrada, finance, internet a know-how.okhelp.cz Pro lepší výsledky hledání používejte i diakritiku.

String Array of Array Java Example


Set, get string , array of array of strings, Java example code

	public final static String[][]_arArOfString_1 = {
		new String[] {"bla","bla","hello world!"},
		new String[] {},
		new String[] {},
		new String[] {},
		new String[] {},
		new String[] {}
String sOut = _arArOfString_1[0][2]; // hello world!

397LW NO topic_id


Další témata ....(Topics)


Eclipse Log.e println needs a message | eclipse-log-e-println-needs-a-message

Log.e println needs a message error.
E/AndroidRuntime(330): FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to start activity ComponentInfo{b.paint/b.paint.MainActivity}: java.lang.NullPointerException: println needs a message

Try this code:

		// Error
                String s = null;
		Log.e("bla", s); // !!! error Log.e println needs a message error.
                // OK
		String s = null;
		Log.e("bla", s+""); // OK 


Do not hardcode /data/ use Context.getFilesDir().getPath() | do-not-hardcode-data-use-context-getfilesdir-getpath

// warning
private static String DB_PATH =  "/data/data/cz.okhelp.german_czech_phrases/databases/";

// OK
   public DataBaseHelper(Context context) {	 
    	super(context, DB_NAME, null, 1);
        this.myContext = context;
        // OK
         DB_PATH = context.getFilesDir().getParentFile().getPath()
              + "/databases/";

Conversion to Dalvik format failed with error 1 | conversion-to-dalvik-format-failed-with-error-1

java.lang.IllegalArgumentException: already added: Lcz/okhelp/MyMathClass;

First try this solution!!!!!
Select your project in project tree and go to the Eclipse menu Project » Clean » Clean projects selected below » select your project and click OK.

If you create *.apk package with proguard sometimes you must back up the project, delete project, and create new project if you are unable to create *.apk file.

Check your AndroidManifest.xml if all Activity is correctly inserted. If you add a library project to Main project you have to insert Activity from library to Main project AndroidManifest.xml

Problem with the library.
I deleted library project from project tree and again put the _library project into the main project. This problem was resolved.
1.)Go to Project » Properties » Java Build Path » Libraries and remove (your projects) click OK.
2.)Go to Project » Clean » Clean projects selected below » select your project and click OK.
3.)Add again your LIBRARY project to your MAIN project Project » Properties » Java Build Path » Libraries.
See image below.

Problem with a *.apk file
If you create signed *.apk, you have to delete previous *.apk from your PC folder.



Android Studio Delete Hide Module | android-studio-delete-hide-module

To hide a module File->Project Structure Ctrl+Alt+Shift+S
In left panel click on Module which want to hide.
Click on minus symbol (-) on upper left corner of window.
Click Yes.

To delete module from disk click on module in project tree (to select) and press Delete on keyboard.

Cursor managedQuery Deprecated | cursor-managedquery-deprecated

Try this code with CursorLoader:

Uri uri = getIntent().getData();

Cursor cursor = managedQuery(uri, null, null, null, null);

// WORKING - loadInBackground() preventing freezing of app
 Cursor cursor  = new CursorLoader(getApplicationContext(),uri, null, null, null, null).loadInBackground();

Editace: 2013-12-09 11:04:09
Počet článků v kategorii: 397

11 Share