EndLessMind's Profile User Rating: ****-

Reputation: 244 Stalwart
Group:
Expert
Active Posts:
1,186 (0.45 per day)
Joined:
13-March 09
Profile Views:
22,938
Last Active:
User is offline Apr 17 2016 02:38 AM
Currently:
Offline

Previous Fields

Country:
SE
OS Preference:
Windows
Favorite Browser:
Chrome
Favorite Processor:
Who Cares
Favorite Gaming Platform:
PC
Your Car:
BMW
Dream Kudos:
200
Expert In:
Android

Latest Visitors

Icon   EndLessMind Working on a Socket tutorial for Android with C# server.

Posts I've Made

  1. In Topic: How do I populate some type of view (gridview) from a json result?

    Posted 5 Apr 2016

    Create a class to hold your data.
    Then parse the json-data and add each field to their corresponding field in your class.

    Create a adapter that extends BaseAdapter and change the input data typ to ArrayList<*name of your class>

    Then in getView you'll need to inflate a layout to be used for the items and set data to the widgets in the layout.

    Here is a good tutorial on GridView
  2. In Topic: Some basic doubts in Android Programming ?

    Posted 24 Mar 2016

    We extend classes to inherit their properties, that is correct.
    There as basically 2 reason to why we want to do this.

    1. Add functionality.

    Maybe we want to extend object-class "Animal" to object-class "Dog".
    Animal might contain fields like: Name, age, weight and gender.
    But you might want to add fields like: Breed, Fur-type, age-in-dog-year

    By extending "Animal", you'll only need to write code for the new fields instead of all of them.
    This is also here we're using getters and setters to get and set individual values of our object-class.


    2. Custom behavior
    This is why we extend stuff like Activity, Fragment, Dialog and SQLiteOpenHelper.
    We want to alter the behavior of the classes. This is done by overriding functions.

    But, as you might know, there is a lot going on in Activity.onCreate(..) for example.
    If we just override it, the activity wont start and you'll just get an exception.

    There is 2 ways to solve this:

    1. Copy the onCreate-code from Activity.java in the Android source code.
    This is obviously not very practical because both activities and fragments must perform a number of operations in order to function(or method) properly.
    (i.e. managing life cycle, optimizing memory usage, drawing the layout to the screen, etc.)

    2. Class the same function in the base class.
    This is where 'super' comes in to play.
    This allows you to override an class to add your own code, but still execute the function(or method) as defined in the base class.


    In some situations, like onCreate, super must be the first call of the function(or method), in other is doesn't.
    Google will help you sort that out when you need to.


    Context is abstract interface class that allows for access to application-specific resources, classes and up-class for application-level operations like starting activity, services, broadcasting and receiving intents.

    Activity is an subclass of Context.
    We sometimes need the pass the context as argument to functions and methods.
    This is because the function(or method), uses some function(or method) that needs a context or exist inside the context is self.

    Sometimes you only need to set the context-argument when creating a new instance of a class and are then free to call it function(or method).
    This is only false of static functions that has code that is relying on a context.


    And for your last question.
    You don't call the onCreate of the SQLiteOpenHelper manually.
    That is done by the base class and it will had created the SQLLiteDatabase-object for you.
    It will then pass that object as an argument named db for you to use.
    The first line of code in the onCreate, in your example, will build an SQL query as a String.
    You'll then call the execSQL-method that will execute the SQL query you've just built.


    There as a lot of good tutorials out there that will help you understand how the android system works and how you should work with it :)
  3. In Topic: Matrix transform different on Samsung Tab4 & S2

    Posted 14 Mar 2016

    No problem.

    Not necessarily.
    OpenGL ES is more low level than standrad 2D canvas, so you'll have more control.
    In fact, the issue might not be with the driver is self but with some changes to the canvas pipeline made by Samsung (for what ever reason).
    OpenGL ES might therefore not suffer from that same issue as the canvas it self.

    Also, for looking at the source code to that library, i seams to be using shader language for performing different tasks on the pixels.
    That might eliminate the matrix-issue all together. (I say might, as I'm not very experienced with how it all works. Not yet at least)
  4. In Topic: Matrix transform different on Samsung Tab4 & S2

    Posted 14 Mar 2016

    Yeah, processing images on the CPU is very inefficient.
    But at least you now know where the problems is :)

    Have you tired any GPU-based image processing librarys like this one? :)/>
  5. In Topic: Matrix transform different on Samsung Tab4 & S2

    Posted 14 Mar 2016

    My experience with Samsung devices tells me that this is most likely a bug in the firmware (GPU-drivers would me be first guess)
    On my app GrooveMobile, I had implemented a OpenGL music visualizer. It worked perfect on 99% of all devices across all manufactures excluding Samsung.
    When i came to Samsung-devices, I had A LOT of artifacts and exceptions that all traced back to the GPU-drivers.


    Here is a non-matrix based code for inverting a bitmap.
    Try it out. If it works as expected on both devices, then it's most likely a firmware bug on the S2. (Sorry about the commenting. It's in swedish :P )
    public static Bitmap doInvert(Bitmap src) {
    		// Skapa en ny bitmap med samma egenskapar som käll-bilden
    		Bitmap bmOut = Bitmap.createBitmap(src.getWidth(), src.getHeight(), src.getConfig());
    		// Färg infor
    		int A, R, G, B;
    		int pixelColor;
    		// Bildstorlek
    		int height = src.getHeight();
    		int width = src.getWidth();
    
    		// Skanna igenom alla pixlarna
    	    for (int y = 0; y < height; y++)
    	    {
    	        for (int x = 0; x < width; x++)
    	        {
    	        	// Hämta en pixel
    	            pixelColor = src.getPixel(x, y);
    	            // Spara alpha-kanal
    	            A = Color.alpha(pixelColor);
    	            // invertera världen för varje R/G/B kanal
    	            R = 255 - Color.red(pixelColor);
    	            G = 255 - Color.green(pixelColor);
    	            B = 255 - Color.blue(pixelColor);
    	            // Sätt ny-inverterade pixlarna till slutgiltiga bitmapen
    	            bmOut.setPixel(x, y, Color.argb(A, R, G, B)/>);
    	        }
    	    }
    
    	    // returera slutgiltiga bitmapen
    	    return bmOut;
    	}
    

My Information

Member Title:
These are the droids you're looking for
Age:
23 years old
Birthday:
May 18, 1992
Gender:
Location:
Sweden
Years Programming:
7+
Programming Languages:
C++, VB .net, C#, Arduino, Java/Android, a little PHP and basic of JavaScript

Contact Information

E-mail:
Click here to e-mail me
Website URL:
Website URL  http://https://www.facebook.com/GrooveMobile
Skype:
Skype  tanehole
LinkedIn:
https://www.linkedin.com/pub/pontus-holmberg/93/245/77a
Facebook:
https://www.facebook.com/pontus.e.holmberg

Comments

Page 1 of 1
  1. Photo

    papastan Icon

    15 Dec 2014 - 10:38
    Hi please i am trying to write an android app to measure the the signal strength from 3 wifi access points in order to do indoor position for my work at school but i lack so much in programming and will be happy if you can help me. thanks
  2. Photo

    H3R3T1C Icon

    01 Jan 2013 - 02:37
    Congrats on the promotion to expert!
  3. Photo

    EndLessMind Icon

    10 Jun 2010 - 14:37
    Don't be shy :)
Page 1 of 1