[android-developers] Multi-pane Layout best practice

2014-10-26 Thread Sergio Panico
Hi all,
i just need some clarification about the best way to design a multi-pane 
layout for my app.

More in datail, i'm just interesting in understand how is the better way to 
let the fragments communicate with their parent activity.

Accordingly to what described here
 http://developer.android.com/design/patterns/multi-pane-layouts.html 
http://developer.android.com/design/patterns/multi-pane-layouts.html and 
here http://developer.android.com/training/basics/fragments/fragment-ui.html, 
i've 
designed my UI with the following structure:
  - a main activity (let say: A_MAIN) 
  - a list fragment (F_LIST) and its related activity (A_LIST)
  - a detail fragment (F_DET) and its related activity (A_DET)
  - an edit fragment (F_EDIT) and its related activity (A_EDIT)

Moreover, each fragment
  - defines an interface (OnFragmentInteractionListener) to send the user 
action to its parent
  - participates to the the action bar with the supported actions

and the main activity (A_MAIN) implements the listener for all fragments 
and has the following layouts:
  - for smartphone (default), it contains only the F_LIST fragment. When an 
item of the list is selected, it starts the A_DET with the F_DET fragment 
for the selected item
  - for tablet (sw600dp), it contains the F_LIST and F_DET fragments. When 
an item of the list is selected, it refreshes the F_DET for the selected 
item

The issue is that the parent activity for F_DET could be both A_MAIN or 
A_DET hence, in the smartphone scenario, i've some difficulties to send the 
listener action to the A_MAIN because it is two levels back (F_DET - A_DET 
- A_MAIN)...

Where i'm wrong?

(To better clarify, i just want the same interaction behavior of gMail app 
when select an email...)

I wait for your help and advice.

Regards
Sergio

-- 
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/d/optout.


[android-developers] Wider status bar notification icon

2013-09-28 Thread Sergio Panico
Hi all,
I need your help to solve a question that hang my app's development.

The problem is that I need to show in the status bar notification area an 
icon wider then the others. More in details, suppose my notification icon 
is 24x48, there is a way to avoid Android to makes the icon unreadable, 
stretching it to 12x24 (to fill the 24x24 standard icon placeholder)? In 
other words, there is a way to show a rectangular icon (wider than 24px) 
for an app's notification?

Hope I succeed in explain myself and you can give me the right way.

Thanks a lot
Regards
Sergio

-- 
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] Avoid app to kill widget process

2012-10-20 Thread Sergio Panico
Hi all,
i'm asking your help to understand a behaviour of my app running on JB 
4.1.2.

Shortly, I want to add to my app package a widget that shows via 
AdapterViewFlipper a collection of information retrived by the app (app and 
widget shares the same model classes and some of the views). I tried some 
methods to design this and finally I choose (any other better design hints 
are welcome :) ) to separate the process of the app and that of the widget 
writing the following in the manifest file:

receiver android:name=.widget.MyApp4x1Provider
  android:label=@string/app_name
  android:process=:com.example.myapp.widget
intent-filter
action android:name=android.appwidget.action.APPWIDGET_UPDATE/
/intent-filter
meta-data android:name=android.appwidget.provider
   android:resource=@xml/myApp4x1info/
/receiver
service android:name=.widget.MyAppDataModelRemoteService
 android:permission=android.permission.BIND_REMOTEVIEWS
 android:exported=false
 android:process=:com.example.myapp.widget
 /

All works fine, but this strange behaviour: 
  - if I only execute app all goes well, the app is executed and killed 
once I remove it from the recent tasks list
  - if I add the widget on my desktop all goes well, the data are shown and 
refreshed how I expected
  - if I open the app when the widget is active on my home all coninue to 
works but when I close the app ActivityManager kills the widget process too!

Following an extract of the debug log:
[...]
(01) - 10-17 22:26:08.784: INFO/ActivityManager(306): Start proc 
com.example.myapp.widget for broadcast 
com.example.myapp/.widget.MyApp4x1Provider: pid=22467 uid=10066 gids={3003, 
1028}
(02) - 10-17 22:26:08.963: DEBUG/com.example.myapp.MyApp(22467): onCreate 
(instance: com.example.myapp.MyApp@41882800)
(03) - 10-17 22:26:08.963: 
DEBUG/com.example.myapp.widget.MyApp4x1Provider(22467): onEnabled called 
(wdgModelRefreshHandler: null)
(04) - 10-17 22:26:08.963: 
DEBUG/com.example.myapp.widget.MyApp4x1Provider(22467): onEnabled exit 
(wdgModelRefreshHandler: Handler 
(com.example.myapp.widget.MyAppWidgetProvider$RefresherDaemonHandler) 
{4191c6b0})
(05) - 10-17 22:26:08.971: 
DEBUG/com.example.myapp.widget.MyAppWidgetProvider$RefresherDaemonHandler(22467):
 
REFRESHER_BEAT done for 1 widgets
(06) - 10-17 22:26:08.987: 
DEBUG/com.example.myapp.widget.MyAppDataModelRemoteService(22467): 
onGetViewFactory (intent: 
intent:#Intent;component=com.example.myapp/.widget.MyAppDataModelRemoteService;i.appWidgetId=55;end)
(07) - 10-17 22:26:08.987: 
DEBUG/com.example.myapp.core.MyAppDataModel(22467): onDataSetChanged called
[...]
(08) - 10-17 22:38:45.971: INFO/ActivityManager(306): START 
{act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] 
flg=0x1020 cmp=com.example.myapp/.ui.Home bnds=[200,185][360,385] u=0} 
from pid 593
(09) - 10-17 22:38:46.065: INFO/ActivityManager(306): Start proc 
com.example.myapp for activity com.example.myapp/.ui.Home: pid=22961 
uid=10066 gids={3003, 1028}
(10) - 10-17 22:38:46.284: DEBUG/com.example.myapp.MyApp(22961): onCreate 
(instance: com.example.myapp.MyApp@41887670)
(11) - 10-17 22:38:46.901: INFO/ActivityManager(306): Displayed 
com.example.myapp/.ui.Home: +855ms
(12) - 10-17 22:38:49.049: 
DEBUG/com.example.myapp.widget.MyAppWidgetProvider$RefresherDaemonHandler(22467):
 
REFRESHER_BEAT done for 1 widgets
[...]
(13) - 10-17 22:38:56.706: INFO/ActivityManager(306): Killing 
22467:com.example.myapp.widget/u0a66: remove task
(14) - 10-17 22:38:56.706: INFO/ActivityManager(306): Killing 
22961:com.example.myapp/u0a66: remove task
(15) - 10-17 22:38:56.729: INFO/WindowState(306): WIN DEATH: 
Window{4186e850 com.example.myapp/com.example.myapp.ui.Home paused=true}
(16) - 10-17 22:39:06.698: WARN/ActivityManager(306): Activity destroy 
timeout for ActivityRecord{420b4b58 com.example.myapp/.ui.Home}

Where:
  - the rows from (1) to (7) show that widget works properly in its own 
process
  - the rows from (8) to (11) show the starting of the app in a separate 
process
  - with the row (12) i can see that widget conintue to work if the app is 
running
  - the rows from (13) to (16) are when I remove the app from the recent 
tasks list, and shows that, when ActivityManager kill the app process (14), 
it kills the widget one too (13)

The question is, how I can avoid ActivityManager to kill both the process, 
leaving that of widget alive?

Any suggestion is appreciated.

Thanks a lot and regards 
Sergio

-- 
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] Re: List View View Replicated when scrolling down and movie the stroller towards to up.

2012-08-16 Thread Sergio Panico
Try to take a look here.

https://groups.google.com/forum/?fromgroups#!starred/android-developers/NZ_pCPs0evM%5B1-25%5D
 

HTH
Sergio

Il giorno lunedì 13 agosto 2012 15:47:23 UTC+2, Gourab Singha ha scritto:

 List View View Replicated when scrolling down and movie the stroller 
 towards to up.   How i Solve 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

Re: [android-developers] Third-parties libraries license

2012-08-12 Thread Sergio Panico
Sure, but I thought that my doubt is faced to anyone have developed an 
application that uses Google Map library. Moreover, I don't refer to my 
specific case but to a general purpose practice that, i believe, an android 
developer more experienced than me should manage as well.

In any case, i'm sorry if I don't have exposed my doubt in the proper way.

Best regards
Sergio  

Il giorno domenica 12 agosto 2012 01:14:42 UTC+2, Spooky ha scritto:

 On Sat, Aug 11, 2012 at 04:07:49PM -0700, Sergio Panico wrote: 

  just a legal question. 

 Then you need to ask a lawyer. 

 Later, 
--jim 

 -- 
 THE SCORE:  ME:  2  CANCER:  0 
 73 DE N5IAL (/4)  | Tux (E Cat):  DS B+Wd Y 6 Y L+++ W+ C++/C++ 
 I+++ 
 spook...@gmail.com javascript:  | T++ A E H+ S V- F++ Q+++ P/P+ B++ 
 PA+ PL SC--- 
  Running Mac OS X Lion  | 
 ICBM / Hurricane: | Tiggerbelle:  DS W+S+Bts % 1.5 X L W C+++/C+ 
30.44406N 86.59909W| I+++  T A E++ H S++ V+++ Q+++ P  B++ PA++ PL+ 
 SC 

 Android Apps Listing at http://www.jstrack.org/barcodes.html 



-- 
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] Third-parties libraries license

2012-08-11 Thread Sergio Panico
Hi all,
just a legal question.

Anyone know what is the best practice to avoid legal issue in using third 
party libraries?
For my understanding, the app should foresee a section (usually the about 
or information screens) where all the 3rd parties library and/or 
trademarks are attributed to their respective owner with some copyright 
notes (for example: Google, Android, Google Maps are registered trademark 
of Google Inc. [3rd-Lib] is property of [3rd party company name]. All other 
registered trademarks or trademarks are property of their respective 
owners. All rights reserved.)

What i'm wondering is if this note is enought, or there should be an 
explicit reference to the license of the library used? (for example, see 
Google+ App, in the section Settings  About Google+  Open souce 
licenses). In this case what is the license for the addon Google Maps API 
16 (maps.jar, com.google.android.maps)?

Thanks a lot
Bye
Sergio

-- 
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] SharedPreferences clarification

2012-07-31 Thread Sergio Panico
Hi all,
I need your help to have a clarification for the preferences framework of 
Android.

Accordingly to Google API Reference 
(http://developer.android.com/reference/android/preference/PreferenceActivity.html)
 
I created my app preferences section by extending the PreferenceActivity 
class and by creating (sub)fragment for each different sections. It seems 
works well, but here is the first question:
  1. Google API documentation talks about 2 styles for creating 
preference sections of an app: one deprecated old style, and one newest 
technique fragment-based. As per my understanding, with the first old 
method, all the settings belong to only one screen, instead with the 
second it is possibile to create headers and subsection for grouping the 
settings. BTW, always for google gudelines, it is not a best practice to 
spread the setting into several section 
(http://developer.android.com/design/patterns/settings.html). So the 
question is, what of this two techniques is better to use? What is the 
criteria (for example number of settings...) to choose one or the other 
solution?

Then, assuming that i've choosen one of the technique and have implemented 
my preference section in my app, i know that all the settings are managed 
by Android with SharedPreference class. Now, I need to access to my 
settings outside the my PreferenceActivity class. I thought to work in this 
way: in my main Application class, I create a static method that, using the 
context of the app, accesses to the SharedPreferences object, retrive the 
setting I ask for, and return its value to the caller. But, the 
getSharedPreferences Context's method ask me for a name and a mode. 
Accordingly to API reference name is Desired preferences file and 
mode is the Operating mode. The question is:
  2. How can I know what is the preference file for my application, as was 
the Android framework that managed the preferences for me (within my 
PreferenceActivity class)?

Thanks a lot for all the clarification
Regards
Sergio

-- 
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] Re: SharedPreferences clarification

2012-07-31 Thread Sergio Panico
Thank you guys for your answers!

Now it is more clear!

Thanks 
Sergio


Il giorno martedì 31 luglio 2012 15:55:25 UTC+2, Sergio Panico ha scritto:

 Hi all,
 I need your help to have a clarification for the preferences framework of 
 Android.

 Accordingly to Google API Reference (
 http://developer.android.com/reference/android/preference/PreferenceActivity.html)
  
 I created my app preferences section by extending the PreferenceActivity 
 class and by creating (sub)fragment for each different sections. It seems 
 works well, but here is the first question:
   1. Google API documentation talks about 2 styles for creating 
 preference sections of an app: one deprecated old style, and one newest 
 technique fragment-based. As per my understanding, with the first old 
 method, all the settings belong to only one screen, instead with the 
 second it is possibile to create headers and subsection for grouping the 
 settings. BTW, always for google gudelines, it is not a best practice to 
 spread the setting into several section (
 http://developer.android.com/design/patterns/settings.html). So the 
 question is, what of this two techniques is better to use? What is the 
 criteria (for example number of settings...) to choose one or the other 
 solution?

 Then, assuming that i've choosen one of the technique and have implemented 
 my preference section in my app, i know that all the settings are managed 
 by Android with SharedPreference class. Now, I need to access to my 
 settings outside the my PreferenceActivity class. I thought to work in this 
 way: in my main Application class, I create a static method that, using the 
 context of the app, accesses to the SharedPreferences object, retrive the 
 setting I ask for, and return its value to the caller. But, the 
 getSharedPreferences Context's method ask me for a name and a mode. 
 Accordingly to API reference name is Desired preferences file and 
 mode is the Operating mode. The question is:
   2. How can I know what is the preference file for my application, as was 
 the Android framework that managed the preferences for me (within my 
 PreferenceActivity class)?

 Thanks a lot for all the clarification
 Regards
 Sergio


-- 
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] Re: ListView with custom view item refresh issue

2012-07-28 Thread Sergio Panico
Hi all,
I thank all for your answers.

I've understood the strange behaviour that doesn't makes my ListView to 
refreshes correctly.

Here is the link where I've found the solution: 
https://groups.google.com/forum/?fromgroups#!topic/android-developers/2Ub4yhyKumM

This topic clearly explains that, when the callback method getView is 
called, the parameter convertView is null only when ListView tries to 
draw the first 5 items, from A to E. When I scroll down the content of 
the list, and the ListView draws the items 6 and 7, it reuses the views 
previoulsy created, hence convertView is not null and my getView 
implementation goes into else branch.

What I've missed was to bind the old view, with the new model item 
getting showed. So the fix was simply to add, in this branch, the update of 
the bind between recycled view and model item.

HTH
Sergio



Il giorno giovedì 26 luglio 2012 12:59:05 UTC+2, Sergio Panico ha scritto:

 Hi all,
 I need your help to understand the refresh behaviour of a ListView where 
 I've defined a my custom view for the ListView's items.

 I think It's better explain it with an example:
 my adapter contains 7 items: A, B, C, D, E, F, G correctly initialized, 
 filled and working. The associated ListView shows 5 (out of 7) items: A, B, 
 C, D, E.
 The problem is that, when I scroll down the ListView's content instead of 
 showing me items F and G, I've got A and B items again. I understood that 
 this is only a viewing issue becouse the model elements associated with 
 the last two items, correctly belong to F and G items. :|

 Following the ovveride of getView(...) method of my adapter (extending 
 BaseAdapter):

 @Override
 public View getView(int position, View convertView, ViewGroup parent) {
 MyItemView miv = (( MyItemView  ) convertView);

 if (context == null) return null;

 if (convertView == null) {
 miv = new MyItemView ();
 .
 } else {
 miv.refreshView(); //refresh the view content
 }

 return miv;
 }

 and the refreshView() method of MyItemView (extending LinearLayout):

 @Override
 public void refreshView() {
 label1.setText(..);
 label2.setText(..);
 label2.setText(..);

 invalidate();
 }

 Thanks a lot to all!
 Bye
 Sergio


-- 
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] ListView with custom view item refresh issue

2012-07-27 Thread Sergio Panico
Hi all,
I need your help to understand the refresh behaviour of a ListView where 
I've defined a my custom view for the ListView's items.

I think It's better explain it with an example:
my adapter contains 7 items: A, B, C, D, E, F, G correctly initialized, 
filled and working. The associated ListView shows 5 (out of 7) items: A, B, 
C, D, E.
The problem is that, when I scroll down the ListView's content instead of 
showing me items F and G, I've got A and B items again. I understood that 
this is only a viewing issue becouse the model elements associated with 
the last two items, correctly belong to F and G items. :|

Following the ovveride of getView(...) method of my adapter (extending 
BaseAdapter):

@Override
public View getView(int position, View convertView, ViewGroup parent) {
MyItemView miv = (( MyItemView  ) convertView);

if (context == null) return null;

if (convertView == null) {
miv = new MyItemView ();
.
} else {
miv.refreshView(); //refresh the view content
}

return miv;
}

and the refreshView() method of MyItemView (extending LinearLayout):

@Override
public void refreshView() {
label1.setText(..);
label2.setText(..);
label2.setText(..);

invalidate();
}

Thanks a lot to all!
Bye
Sergio

-- 
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