[android-developers] Digest for android-developers@googlegroups.com - 5 updates in 5 topics

Comments: (0)
Jonathan Fajardo Roa <jfajardor9210@gmail.com>: Jul 29 06:55PM -0700

Error:Execution failed for task ':app:dexDebug'.
> com.android.ide.common.process.ProcessException:
org.gradle.process.internal.ExecException: Process 'command
'/Library/Java/JavaVirtualMachines/jdk1.7.0_71.jdk/Contents/Home/bin/java''
finished with non-zero exit value 2
Simon Giddings <mr.s.giddings@gmail.com>: Jul 29 08:44AM -0700

If anyone is needing to do the same thing, here is my working solution.
 
Note that I am targeting API 14 and above.
 
<style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar" >
<item name="android:actionMenuTextAppearance">
@style/myActionBarMenuText</item>
</style>

<!-- Override actionbar menu text appearance -->
<style name="myActionBarMenuText" parent=
"android:TextAppearance.Holo.Widget.ActionBar.Menu">
<item name="android:textAllCaps">false</item>
<!-- was 12sp, which is too small for me in mixed case -->
<item name="android:textSize">16sp</item>
</style>
 
 
I hope this will be useful for someone ...
gvi70000 <gvi70000@gmail.com>: Jul 29 12:04AM -0700

Solved by using this tutorial
https://www.bignerdranch.com/blog/customizing-android-listview-rows-subclassing/
 
On Thursday, July 23, 2015 at 9:09:07 PM UTC+2, gvi70000 wrote:
gvi70000 <gvi70000@gmail.com>: Jul 28 11:51PM -0700

Hello all,
 
In my application i have a SlidingTabLayout, each tab containing a
listview. when i go through the tabs several times the items are added in
the listview each time. how can i prevent this behaviour?
 
the second question
 
On each tab i want to add a second fragment that will hold some controls,
each fragment has to be linked with a list item from the list view, when i
switch the tab the first list item has to be selected to display the
corresponding fragment. How can i achieve this behavior?
 
my main activity
public class MainActivity extends AppCompatActivity {
Toolbar toolbar;
ViewPager viewPager;
ViewPagerAdapter viewPagerAdapter;
SlidingTabLayout slidingTabLayout;
CharSequence Titles[] = {"Basic", "Sensors", "USB"};
int Numboftabs = 3;
 
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// Creating The Toolbar and setting it as the Toolbar for the
activity
toolbar = (Toolbar) findViewById(R.id.tool_bar);
setSupportActionBar(toolbar);
// Creating The ViewPagerAdapter and Passing Fragment Manager,
Titles for the Tabs and Number Of Tabs.
viewPagerAdapter = new
ViewPagerAdapter(getSupportFragmentManager(), Titles);
// Assigning ViewPager View and setting the adapter
viewPager = (ViewPager) findViewById(R.id.pager);
viewPager.setAdapter(viewPagerAdapter);
// Assiging the Sliding Tab Layout View
slidingTabLayout = (SlidingTabLayout) findViewById(R.id.tabs);
slidingTabLayout.setDistributeEvenly(true); // To make the Tabs
Fixed set this true, This makes the tabs Space Evenly in Available width
// Setting Custom Color for the Scroll bar indicator of the Tab View
slidingTabLayout.setCustomTabColorizer(new
SlidingTabLayout.TabColorizer() {
@Override
public int getIndicatorColor(int position) {
return getResources().getColor(R.color.tabsScrollColor);
}
});
// Setting the ViewPager For the SlidingTabsLayout
slidingTabLayout.setViewPager(viewPager);
}
 
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is
present.
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
 
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
 
my view pager adapter
public class ViewPagerAdapter extends FragmentPagerAdapter {
 
CharSequence Titles[]; // This will Store the Titles of the Tabs which
are Going to be passed when ViewPagerAdapter is created
int NumbOfTabs; // Store the number of tabs, this will also be passed
when the ViewPagerAdapter is created
FragmentManager fragmentManager;
private static final int tabIcons[] = {R.drawable.hand,
R.drawable.sensors, R.drawable.fastobjects, R.drawable.gears,
R.drawable.usb};
// Build a Constructor and assign the passed Values to appropriate
values in the class
public ViewPagerAdapter(FragmentManager fm, CharSequence mTitles[]) {
super(fm);
this.fragmentManager = fm;
this.Titles = mTitles;
this.NumbOfTabs = mTitles.length;
}
//This method return the fragment for the every position in the View
Pager
@Override
public Fragment getItem(int position) {
Fragment fragment =
fragmentManager.findFragmentByTag("android:switcher:" + R.id.pager + ":" +
position);
if (fragment == null) {
Bundle arguments = new Bundle();
arguments.putInt("position", position);
arguments.putString("frag","android:switcher:" + R.id.pager +
":" + position);
fragment = new Tab_Modes();
fragment.setArguments(arguments);
return fragment;
}
else
return null;
 
}
// This method return the titles for the Tabs in the Tab Strip
@Override
public CharSequence getPageTitle(int position) {
return Titles[position];
}
// This method return the Number of tabs for the tabs Strip
@Override
public int getCount() {
return NumbOfTabs;
}
}
 
 
and my listview creator
 
public class Tab_Modes extends ListFragment {
private ArrayList<NameImg> items = new ArrayList<NameImg>();
private int crtMode;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View v = super.onCreateView(inflater, container,
savedInstanceState);
Bundle arguments = getArguments();
crtMode = arguments.getInt("position");
Toast.makeText(getActivity(), "Crt Frag :" +
arguments.getString("frag"), Toast.LENGTH_LONG).show();
switch (crtMode) {
case 0:
items.add(new NameImg("Manual", "Simple camera Control",
R.drawable.hand));
items.add(new NameImg("Bulb", "Long Exposure",
R.drawable.bulb));
items.add(new NameImg("Time Lapse", "Frame by Frame Movie",
R.drawable.timelapse));
items.add(new NameImg("HDR", "High Dinamic Range",
R.drawable.hdr));
items.add(new NameImg("IR", "Infra RED Control",
R.drawable.ir));
break;
case 1:
items.add(new NameImg("Triggered", "Trigger camera ",
R.drawable.triggrered));
items.add(new NameImg("Dark Room", "Long Exposure",
R.drawable.darkroom));
items.add(new NameImg("Lightning", "Frame by Frame Movie",
R.drawable.lightning));
break;
case 3:
items.add(new NameImg("1", "USB1", R.drawable.usb));
items.add(new NameImg("2", "USB2", R.drawable.waterdrops));
break;
}
setListAdapter(new ModesItemAdapter(getActivity(), items));
//ListView myLV = null;
//myLV = (ListView) myLV.findViewById(R.id.customListView);
//myLV.setItemChecked(0, true);
return v;
}
 
@Override
public void onListItemClick(ListView l, View v, int position, long
id) {
super.onListItemClick(l, v, position, id);
//getListView().setSelector(android.R.color.holo_blue_bright);
//Toast.makeText(getActivity(), "selected item :" + position +
" ID :" + id, Toast.LENGTH_LONG).show();
FragmentManager fm = getFragmentManager();
ModeControls myControls;
myControls = (ModeControls) fm.findFragmentByTag(position +
"ModesContent" );
if (myControls == null) {//if the fragment dosen't exists we
create it
Bundle arguments = new Bundle();
arguments.putString("myTxt", "selected item :" + position +
" ID :" + id);
FragmentTransaction ft = fm.beginTransaction();
myControls = new ModeControls();
myControls.setArguments(arguments);
ft.add(R.id.main_activity, myControls).commit();
}
}
}
 
and my modes adapter - for my data structure
 
public class ModesItemAdapter extends ArrayAdapter<NameImg> {
 
public ModesItemAdapter(Context c, List<NameImg> items) {
super(c, 0, items);
}
 
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ItemView itemView = (ItemView)convertView;
if (null == itemView)
itemView = ItemView.inflate(parent);
itemView.setItem(getItem(position));
return itemView;
}
}
Terry <terboel@gmail.com>: Jul 28 11:32PM -0700

We have just received an email from Google, with info about their new Ads
Policy.
 
I am afraid that I do not understand much of it, and I know that trying to
ask Google is a waste of time.
So I am trying to ask here instead. I am also sure that other developers
have the same questions.
 
We have a few apps with normal AdMob Banner Ads.
 
- Do our Ads use AdSense?
- Do our Ads use DoubleClick?
- Do our Ads use Cookies?
- (Are we supposed to know these things?)
- Do *we *have to do anything to comply with this new policy?
- (Why cannot Google be clearer about this and spell out what we have to do
- instead of using their usual vague formulations?)
 
Any help is appreciated.
 
Terry
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page.
To unsubscribe from this group and stop receiving emails from it send an email to android-developers+unsubscribe@googlegroups.com.

[android-developers] Digest for android-developers@googlegroups.com - 2 updates in 2 topics

Comments: (0)
Simon Giddings <mr.s.giddings@gmail.com>: Jul 28 09:35AM -0700

I have developed an application which contains this app theme style :
<style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar" />
 
I have tried various means to change the actionbar text to be mixed case
instead of all uppercase.
To illustrate, here is a screen shot -
 
<https://lh3.googleusercontent.com/-fL-5_3uD_z0/VbeuwHo1THI/AAAAAAAAArM/4ZcuCqB2spU/s1600/actionbar-uppercase-text.jpg>
 
The styles I have tried thus far have produced anything but the desired
effect.
 
How do I restyle just the letter case of these items ?
Tomas Prochazka <tomas.prochazka@gmail.com>: Jul 28 07:22AM -0700

Can you somebody explain me why *play-services-location* has depency on
*play-services-map*?
It doesn't make sense. If you want only get position you don't need whole
map rendering core, it something like 2000 methods in the map package.
In reverse way it make sense. Map must have dependency on location, but why
this?
 

 
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page.
To unsubscribe from this group and stop receiving emails from it send an email to android-developers+unsubscribe@googlegroups.com.

[android-developers] Digest for android-developers@googlegroups.com - 1 update in 1 topic

Comments: (0)
Sheng-Dean <littledot5566@gmail.com>: Jul 26 02:52AM -0700

I often find myself duplicating the exact same set of test classes such as
mocks or helpers for both Android Tests `/androidTest` and Unit Tests
`/test` when writing tests for an application module.
 
For example, I have some static functions that help me set up mocks quickly
in `/test/MockUtils.java` However, I cannot reuse this helper class in any
of my AndroidTests because they do not share the same class path -
`/androidTest` vs `/test`.
 
I've thought of creating a new module that only contains test resources.
However, this idea won't fly because the Android Gradle plugin refuses to
depend on an app module.
 
project testCommon resolves to an APK archive which is not supported as
a compilation dependency.
 
Is there any other way to create test classes that could be reused in both
Android Tests and Unit Tests?
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page.
To unsubscribe from this group and stop receiving emails from it send an email to android-developers+unsubscribe@googlegroups.com.