Office Hours — Today, September 19

Tuesday, September 17

Sep 19
9:55 AM
Mark M.
has entered the room
Mark M.
turned on guest access
10:00 AM
Gaurav B.
has entered the room
Mark M.
hello, Guarav!
how can I help you today?
10:20 AM
Bayram M.
has entered the room
Mark M.
hello, Bayram!
Bayram: how can I help you today?
10:25 AM
Bayram M.
Just bought the books and having a look around
thanks for the offer :)
Mark M.
the office hours chats are for Q&A, on Android development questions
you can find archives of past office hours transcripts at http://commonsware.com/office-hours/
normally, when you are logged into your Warescription page, you will see a calendar here, instead of the chat room access (which is only here when the office hours are live)
if either of you have a question, feel free to chime in
Bayram M.
thanks :)
Gaurav B.
Hi Mark
I was just here to check out the questions being asked
Jose L.
has entered the room
Gaurav B.
i had just one question about what is a zygote with relavane to Android Process model
Jose L.
hello everyone!
Mark M.
(BTW, hello, Jose -- I will be with you shortly!)
Guarav: When Android boots, one of the first processes created is called the zygote
10:30 AM
Mark M.
it loads the Dalvik VM, JIT compiler, and framework classes (e.g., android.*, java.*)
when any Android app runs, what really happens is that the zygote process is forked to create the app's process
all of the stuff that the zygote loads is in "copy-on-write" memory shared between all of the forks of the zygote process
this allows each app to reference a shared instance of all of that stuff, saving memory
yet, Linux's copy-on-write feature means that if a process attempts to tamper with that shared memory, the process transparently gets a local copy of that memory
this prevents one app from tampering with, say, Dalvik, and having those changes affect other apps
this architecture allows app processes to be lean (just your own classes and heap), while still offering process-level security
Gaurav B.
cool thanks
for all the information
Mark M.
Jose: do you have a question?
Jose L.
yes
it's more related to the development process and how to setup things than android development stuff
Mark M.
OK
Jose L.
I'm working on a project, it's bringing an iPad app to android, so I am starting with two projects
a library project and the app itself that uses that library project
10:35 AM
Jose L.
I have to do the library thing because this is the first of really similar apps
that share functionality
both projects (library and app) has their own git repositories
I am using gradle to set up building and such (for now mainly to build the app from a CI machine runing jenkins)
so in the root of the app project repo I have a directory with the app itself and a dependency folder where I linked a git submodule pointing to the library repo
that works fine with gradle
but
the thing is that I am setting up the dependencies using two systems
gradle AND git submodules
and that's something I don't really like
so my question is... how would you set up all this
?
I have to say that for development I cloned both repos and work with both repos at the same time
Mark M.
well, bear in mind that I am not all that well-versed in the Gradle stuff at the moment
that being said
Jose L.
using only the submodule-copy for gradle building
10:40 AM
Mark M.
I would use an AAR for the library, and have the app depend upon the AAR, not the git repo for the library
10:40 AM
Mark M.
the AAR can be published as an artifact, whether to some full Maven install or simply a local artifact directory with appropriate metadata
the dependency on the AAR can be specified in the gradle build file
Jose L.
yes, problem that I see with that approach is that I am developing both projects at the same time since I am in a really early stage of the development
Mark M.
so?
Jose L.
so everytime I make a change in the library I want to use in the app
I have to compile, build and upload the AAR to the local artifact directory
(for development in my machine I am just linking one project as dependency as the other)
Mark M.
write a batch file/shell script around the gradle script for the app that runs both builds
and use that until such time as you are ready to break the always-build-both approach when building the app
besides, today is International Talk Like a Pirate Day -- AAR files *have* to be the answer!
:-)
Jose L.
LOL true that
Bayram M.
Hello Mark I have a question :)
Jose L.
so that shell script would...
build the library and upload the artifact
and then build the app downloading the new artifact
Mark M.
(Bayram: give me one moment to wrap up this question with Jose -- I will be with you shortly!)
right, as a temporary bit of scaffolding
Jose L.
is that right?
10:45 AM
Mark M.
there may be a more elegant approach that you could do in the gradle file itself, though that's beyond what I have tried so far
Jose L.
well certainly I am not a gradle expert
just started using it
Mark M.
let me take Bayram's question, and I can come back to you in a bit
Jose L.
I'll give it a try to the shell aproach
Mark M.
Bayram: go ahead!
Jose L.
yes, thanks Mark!
Bayram M.
Thanks
Well I have a strong requirement to make my app UI very fast
but the problem is I find that UI using xml is lagging some times
should I go for view extention though it would violate the MVC pattern ?
Mark M.
no, since "UI using xml" is unlikely to be your problem
Bayram M.
ok
Mark M.
how did you determine that "UI using xml" is the source of your sluggishness?
Bayram M.
for example animations using xml aren't as fast as those made in code ...
10:50 AM
Mark M.
and your proof of this is... what, exactly?
Carlos
has entered the room
Gaurav B.
has left the room
Mark M.
if you are going to make these sorts of claims, you need evidence
(hello, Carlos, I will try to get to you shortly, before the chat ends!)
Bayram M.
Just tried both approaches and animation with xml some times are slow
Carlos
Ok Mark. thks!
Mark M.
and how did you measure "some times"?
Bayram M.
on the same device animation using xml lag when I'm updating data in bg
but those in code don't
Mark M.
what tools did you use to measure "some times"?
Bayram M.
just basic testing, I have a pull to refresh list. When I drag it my animation lag
Jeff
has entered the room
Mark M.
that is not especially scientific
Jose L.
only if it's an xml animation?
Bayram M.
yes
Mark M.
you are wasting your time worrying about solutions until you *prove* the source of your problems
10:55 AM
Mark M.
there are plenty of tools to help you better measure performance
Traceview is one
the book's chapter on detecting and removing jank covers others (e.g., systrace)
Bayram M.
So for you using xml has no performance hits ?
Mark M.
generally, it should not be an issue
let me try to take some quick questions from the newcomers before the chat ends
Carlos: do you have a quick question?
Bayram M.
ok thanks
Carlos
yes Mark
I'm trying to initialize a preference's summary text when the screenpreference is loaded in the fragment
I was able to retrieved the last stored preference value in the preferencefragment's onCreate method.
However, I don't know how to refresh the UI for that preference inside onCreate
this is what I current have:
View paste
// will return the resources available
        int res= getActivity().getResources().getIdentifier(getArguments().getString("resource"), "xml",
                                getActivity().getPackageName());

        addPreferencesFromResource(res);

        // Get a reference to the application default shared preferences.
        SharedPreferences sp = getPreferenceScreen().getSharedPreferences();
        long reminder = sp.getLong("defReminder", Calendar.getInstance().getTimeInMillis());
        Log.d("StockPreferenceFragment", "The reminder to load is: " + DateFormat.getTimeFormat(getActivity()).format(new Date(reminder)));
Mark M.
call findPreference() to retrieve the Preference object
call setSummary() on the Preference object to change its value
Carlos
I was trying that but I get a nullpointer exception
this is how I tested it:
View paste
findPreference(getResources().getResourceName(R.layout.time_preference)).setSummary("testing");
Mark M.
did you do it after calling addPreferencesFromResource()?
that is rather strange looking
Carlos
but time_preference is the layout for my timepreference.
11:00 AM
Carlos
The actual preference in xml folder is called general_preferences.xml
Mark M.
findPreference() takes the string name of the Preference as defined in the preference XML
which lines up with the name of the preference as stored in SharedPreferences
none of that has anything to do with a layout resource
Carlos
ohhhh.
Mark M.
try that and see if it helps
Jeff: the chat is just about over -- do you have a quick question?
Carlos
ok Mark. thks!
Jeff
when I set largeHeap in manifest.xml, then Eclipse flags an error because my min sdk version is 10
Mark M.
android:largeHeap was added in API level 11
it will be ignored on API Level 10 devices
Jeff
got that. but is there a way to stop Eclipse from flagging that particular error?
Jose L.
you need to target a newer version, I think
Mark M.
there should be a quick-fix that adds an ignore attribute to the element
Jose L.
and compile with the newer version
Jeff
I'll look for the quick-fix Thanks
Mark M.
that's a wrap for today's chat
Jose L.
thanks!
Jeff
Jose - compling with new version eliminates devices that I worked to support
thanks
Mark M.
the transcript will show up on http://commonsware.com/office-hours/ shortly
next chat is Tuesday, 4pm Eastern
have a pleasant day, all!
Jose L.
you too!
Bayram M.
has left the room
Jose L.
has left the room
Carlos
has left the room
Jeff
has left the room
Mark M.
turned off guest access

Tuesday, September 17

 

Office Hours

People in this transcript

  • Bayram MKHININI
  • Carlos
  • Gaurav Bhatnagar
  • Jeff
  • Jose Luis
  • Mark Murphy