Monday, June 10, 2013

[android help] Where does control return to after onPostExecute() method of AsynchTask?


Where does control return to after onPostExecute() method of AsynchTask?



I have an AsynchTask which is called from with in a function in my MainActivity. After the onPostExecute method is executed ,the control doesn't seem to return to the function where I called the AsynchTask.



class AsynchTestClass extends AsynchTask{
protected int doInBackGround(Integer i){
return i + 10;
}

protected void onPostExecute(Integer r){
doCalculation(r);
}
}

//calling function in Main Activity.
public void showResult()
{
new AsynchTestClass.execute(20);
//Want to continue here, but control doesn't seem to return.
}


The code I write after the new AsynchTestClass.execute(20) doesn't execute. How do I continue after the AysnchTask returns.



.

stackoverflow.comm

[android help] Monodroid ListView update problems


Monodroid ListView update problems



I'm not sure how much this will help anyone, but it seems to work fine in my instance.


I have a ViewModel class that keeps all the data I update within the App and trigger a "Collection Updated" action when a collection changes.



// All within ViewModel.cs

private Action SearchResultsUpdated;

private List m_oSearchResults;

Public List SearchResults
{
get
{
if (m_oSearchResults == null)
m_oSearchResults = new List ();
return m_oSearchResults;
}
set
{
if (value != m_oSearchResults)
{
m_oSearchResults = value;
//
// Fire update event
if (SearchResultsUpdated != null)
SearchResultsUpdated ();
}
}
}


I then add a handler for this event within the adapter class.



// All within SearchResultsAdapter.cs

public class SearchResultsAdapter : BaseAdapter
{
.
.
// Constructor
public SearchResultsAdapter (Activity oContext)
: base ()
{
// Add handler for list refresh
ViewModel.SearchResultsUpdated += NotifyDataSetChanged;
//
m_oContext = oContext;
}
}


Within the adapter I use the collection ViewModel.SearchResults as the data context for the list view. Hope that helps and is thorough enough for everyone to understand.



.

stackoverflow.comm

[android help] Questions about calabash-android support in Android Studio: Ruby, Editing features and steps, Launching tests


Questions about calabash-android support in Android Studio: Ruby, Editing features and steps, Launching tests



I'm working with Android Studio on Windows 7, 64 bit. I'm a noobie on Android Studio (or any Intelij IDE).


I downloaded and installed Ruby 1.9.3, The Ruby DevKit and calabash-android and I can successfully run Cucumber tests on my Android app using the command line (calabash-android run )


I also managed to install the Cucumber plugin for Android Studio, so that my feature files can benefit from autocomplete and such.


I have the following questions:



  • Can I install a Ruby plugin (RubyMine?) so that I can write step definitions for my tests? If so, I've heard that people can debug Cucumber tests: Can this be accomplished as well in Android Studio for Android apps?




  • Can I launch a calabash test for an Android app from Android Studio? If so, how would I go about it?




  • Can I integrate (automated) tests using calabash in Gradle builds of an Android app? If so, how would I go about it?



Thank you!


Update:


I attached a custom gradle Plugin (see groove code below that I wrote to have a basic support for running calabash-android tests.


These manual steps are still necessary:
- Install Ruby 1.9.x and its Devkit, install the calabash-android gem, etc.
- Build the appropriate (flavor of an) APK using android gradle plugin (manual or automated)


In the app's build.gradle, adding apply plugin: 'calabash' now works and it allows the build to run a feature file as a calabash test.
It examines the available product-flavors (build-flavors) and adds the appropriate calabash related tasks (e.g. calabashDebug or calabashFlavor1Release, etc).


I still haven't quite figured out how to make these tasks dependent on the build of the actual APK, so that I can be sure the appropriate APK is built and available before the calabash-task runs a test on it. If someone can help me out, that would be great! :)


Below is the groovy file that implements my 'calabash' plugin (Windows only for now):



package com.mediaarc.gradle.plugins

import org.gradle.api.*
import org.gradle.api.plugins.*
import org.gradle.api.tasks.*

class CalabashPlugin implements Plugin {
void apply(Project project) {
project.extensions.create("calabash", CalabashPluginExtension)

if (!project.android) {
throw new IllegalStateException("Android plugin is not configured.")
}

project.android.applicationVariants.each { variant ->
//println "Adding task for variant ${variant.name}"

final def buildName = variant.name
final def buildVar = variant.baseName
final def packageApp = variant.packageApplication;

//
project.task("doPrepare${buildName}") << {
project.calabash.init(project, buildVar)

def apkFile = packageApp.outputFile
project.calabash.writeCommandFile(apkFile)
}

project.task("doClean${buildName}") << {
project.calabash.init(project, buildVar)

project.calabash.clean()
}

project.task("calabash${buildName}", type: Exec, dependsOn: project["doPrepare${buildName}"]) {
project.calabash.init(project, buildVar)

project.calabash.execute(project[name])
}

project.task("cleanCalabash${buildName}", dependsOn: project["doClean${buildName}"]) {
project.calabash.init(project, buildVar)
}
}

}
}

class CalabashPluginExtension {
def root = 'src/calabash'
def resultFile = "calabash-results.html"

//protected def hash = new Object()
protected File outputFile
protected File workingDir
protected File tmpFile

protected init(Project project, def buildVariant) {
if (!buildVariant) {
buildVariant = "debug"
}

File rootFile = project.file(root)
outputFile = new File(project.file("build/reports/calabash/${buildVariant}"), resultFile)
workingDir = rootFile
}

protected writeCommandFile(def apkFile) {
if (!workingDir.exists()) {
throw new IllegalStateException("The root directory for the calabash-tests could not be found: '${workingDir}'")
}

if (!(new File(workingDir, "features").exists())) {
throw new IllegalStateException("The required 'features' directory could not be found in '${workingDir}'")
}

outputFile.parentFile.mkdirs()

def calabashCmd = "cd ${workingDir.canonicalPath}\r\ncalabash-android run \"${apkFile.canonicalPath}\" --format html --out \"${outputFile.canonicalPath}\"\r\n"
getCommandFile().write calabashCmd
}

protected execute(Exec exec) {
exec.commandLine 'cmd', '/c', getCommandFile().canonicalPath
}

protected clean() {
outputFile.delete()
}

private File getCommandFile() {
if (!tmpFile) {
tmpFile = File.createTempFile("run-calabash", ".bat")
tmpFile.deleteOnExit()
}
return tmpFile
}
}


.

stackoverflow.comm

[android help] Android Traceview Shows Activity Takes 2200 msec to Create Activity (onCreate through to onResume), How do I Determine Why?


Android Traceview Shows Activity Takes 2200 msec to Create Activity (onCreate through to onResume), How do I Determine Why?



I ran a Traceview on my Android app and the result was terrible: 2200msec. I've talked with a lot of people and have been told to go up or down the stack and find the offending code. The problem is, when I go all the way up, or all the way down the stack, there's no obvious indicator as to why (I know you're scoffing, because you're right, there is a reason, but please read-on I'm new).


If I look at Excl CPU time, BitmapFactory.nativeAssetDecode is taking a huge amount of time, well over 1400msec. Obviously this is a major part of the problem with my Activity, however, identifying where this is coming from has been a nightmare. None of my "direct" code is anywhere near (not a Child, nor Parent) this part of the stack, in fact, all my "direct" methods appear to be well-behaved, firing and finishing in mere 0-4 msec as would be expected.


One thing I've found is if I start my Traceview AFTER setContentView(), the Traceview log drops to just 90 msec. I'm honestly too new to understand this result, I know this is misleading because of course setContentView() takes time, but perhaps my layout is causing WAY too much time to be taken? Could my layout really be causing 2110 msec?


This is where I'm confused. My layout has zero overdraw and appears to be a well-formed and non-redundant XML file. My biggest layout has 41 view widgets in it, I swear I've seen many well-performing Activities with over a 100 view widgets in them. My view is designed of essentially 4 Layouts and 36 view widgets (TextViews, etc), each of these items has a Style assigned to them from the Style.xml. I hope I haven't taken things for advantage and created a monster view?


Perhaps if someone could expand on the theory to trace issues when they aren't caused by direct code you write, or the theory behind isolating the cause of the CPU time for "runaway" methods, I'd be able to better help myself (and God knows I've tried, this entire weekend in fact).


TL;DR If I start my Traceview AFTER onCreate's setContentView() it takes 2110 msec less time to load my activity than if I put it BEFORE setContentView(). My Activity's view isn't exactly complicated though, so I'm confused.


I appreciate it so much, Ryan



.

stackoverflow.comm

[android help] How does an android activity interact with app-widget (Home screen widgets)?


How does an android activity interact with app-widget (Home screen widgets)?



If I have an activity, so how can I use some of its methods (functionalities) in android widgets. Do I have to recreate the logic? What are the ways of interaction? Through intent or through service? Please please reply.



.

stackoverflow.comm

[android help] Importing contacts to app like WhatsApp


Importing contacts to app like WhatsApp


java - Importing contacts to app like WhatsApp - Stack Overflow







Tell me more ×

Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

















I have been searching for more than ten hours to find out how to import phone contacts to my app so that the page would like WhatsApp or Viber's, but to no avail.


What I'm looking for is code snippets and in which files to place the given code, so please don't tell me to use X function because that won't help me.
I'm new to making android apps so make your tutorials as simple as possible.
















Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.










lang-java






.

stackoverflow.comm

[android help] Android - Need help accessing image from shared network


Android - Need help accessing image from shared network


networking - Android - Need help accessing image from shared network - Stack Overflow







Tell me more ×

Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

















I'm creating an app that loads images from a network. I have internet permission and access network state permission but I get cannot open file error. I'm using the absolute path when specifying the file ie \\192.168.1.100\d\.folder\image.jpg.


Is this possible or is there something else that i need to do first?


























UNC paths (of the form \\\ will NOT work by default on Android: Android does not natively support those sort of references (CIFS). You should either use HTTP and one of the toolkits that provides support for that (like Volley) or look at a library like JCIFS.




















default






.

stackoverflow.comm

[android help] Change GRAVIITY and SIZE of View programmatically


Change GRAVIITY and SIZE of View programmatically



I would like to change the size of my View (CanvasView extends View) programmatically maintaining gravity. My View is inside FrameLayout, which is inside of RelativeLayout. I tried many different approaches but I am stuck...


The point is, that I would like to set size depending on screen size:



protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

ToolsAndConstants.metrics = new DisplayMetrics();

windowManager = (WindowManager) getSystemService(Context.WINDOW_SERVICE);
windowManager.getDefaultDisplay().getMetrics(ToolsAndConstants.metrics);

setContentView(R.layout.activity_dictionary);

CanvasView canvasView = (CanvasView) findViewById(R.id.activity_dictionary_CanvasView);
canvasView.canvasWidth = (ToolsAndConstants.metrics.widthPixels / 10 * 7) - 10;
canvasView.canvasHeight = (ToolsAndConstants.metrics.heightPixels / 10 * 4) - 10;
canvasView.setLayoutParams(new RelativeLayout.LayoutParams(canvasView.canvasWidth, canvasView.canvasHeight));

CanvasView canvasView = (CanvasView) findViewById(R.id.activity_dictionary_CanvasView);
canvasView.canvasWidth = (ToolsAndConstants.metrics.widthPixels / 10 * 7) - 10;
canvasView.canvasHeight = (ToolsAndConstants.metrics.heightPixels / 10 * 4) - 10;
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(ToolsAndConstants.metrics.widthPixels / 10 * 7, (ToolsAndConstants.metrics.heightPixels / 10 * 4) - 10, Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM);
FrameLayout fl = (FrameLayout) findViewById(R.id.activity_dictionary_frameLayout1);
fl.setLayoutParams(params);
canvasView.setLayoutParams(params);

(...)
}


XML file:



xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_dictionary_relativeLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/gray_patterns_vertical"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".LogReader" >

android:id="@+id/activity_dictionary_linearLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerHorizontal="true"
android:gravity="center_vertical|center_horizontal"
android:orientation="vertical" >

android:id="@+id/activity_dictionary_progressBar1"
style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" />

android:id="@+id/activity_dictionary_textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="Loading dictionary..."
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="@android:color/white" />


android:id="@+id/activity_dictionary_frameLayout1"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true" >

android:id="@+id/activity_dictionary_CanvasView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="0dp"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
class="com.example.dictionary.CanvasView"
android:orientation="vertical" />





How can I resize it?



.

stackoverflow.comm

[android help] Android - create PDF and mail as attachment


Android - create PDF and mail as attachment



The main thing I am trying to do in my app is create a PDF file from data I have (table from ArrayList). After that being done, everything should be e-mailed as 1 attachment. The best way of doing this is by writing the file to the storage system en then passing it via mail, and afterwards deleting it again. Is it possible to create a File object or something like that and pass it immediately without having to write it to the file system? Also, caching is no option I believe because the mail app doesn't have access to my stored file from my app then.


For creating the PDF, I found a very nice and handy little thing called droidtext (http://code.google.com/p/droidtext/). I believe creating the PDF is no problem. However, the problems start at saving the file. Obviously I want to create the file on the external storage, as well as on the internal storage if the external storage is unavailable.


This is what I found for the part with creating the PDF. This piece of code only represents the internal storage, because I believe that is the problem. For external storage, I only need to work with Environment.getExternalStorageDirectory(), so that's no problem.



Document document = new Document();
try {
//hard coded for testing purpose
PdfWriter.getInstance(document, openFileOutput("test.pdf", Context.MODE_WORLD_WRITEABLE));//-->deprecated, why? Alternative?
document.open();
Table table = new Table(2, 2);
table.addCell("0.0");
table.addCell("0.1");
table.addCell("1.0");
table.addCell("1.1");
document.add(table);
document.add(new Paragraph("Table converted: "));
table.setConvert2pdfptable(true);
document.add(table);
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("plain/text");
//the line below is a complete mistery for me, I've tried a lot here...
intent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file:///test.pdf"));
intent.putExtra(Intent.EXTRA_EMAIL, new String[]{getResources().getString(R.string.mail_recipient)});
intent.putExtra(Intent.EXTRA_SUBJECT, getResources().getString(R.string.mail_subject));
intent.putExtra(Intent.EXTRA_TEXT, getResources().getString(R.string.mail_body1));
startActivity(Intent.createChooser(intent, "E-mail"));
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (DocumentException e) {
e.printStackTrace();
}

document.close();


This code seems to work (I think) because it doesn't deliver errors in any kind. However, I can't locate the file on my device. I guess it should be in the root folder (/). Do the deprecated MODE_WORLD_READABLE and MODE_WORLD_WRITEABLE have an alternative?


Every time now the mailing app starts (gmail on my phone), the attachment can't be sent. After looking for a few hours around the internet, I found that the MODE_WORLD_XXX should be used in order to have access with your mailing app.


Also I am not sure if I should close the document before mailing or after. It doesn't change anything in the log.


Also, why is the MODE_WORLD_XXX deprecated? Are there alternatives?


I am terribly sorry for all the questions, but it's now passed 4 am here.


Thanks in advance, kind regards :)!



.

stackoverflow.comm

[android help] Detect Scroll Up & Scroll down in ListView


Detect Scroll Up & Scroll down in ListView



I have the following requirement:


i> At first, data for page no: 2 is fetched from the server & the items are populated in a ListView.


Considering that both the prev page & next page are available in a scenario, the following code has been added:



if(prevPageNo > 0){
mListViewActual.setOnScrollListener(this);
}

if(nextPageNo > 0){
mListViewActual.setOnScrollListener(this);
}


What conditions should I put to detect scroll up & scroll down on the following methods:



i> void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount)

ii> void onScrollStateChanged(AbsListView view, int scrollState)


After the action: scroll up & scroll down is detected , accordingly a service will be called with either the prev page no or next page no , to fetch the items to be populated in the Listview.


Any inputs will be helpful.


Gone through the following links but its not returning the correct scroll up / scroll down action:


http://stackoverflow.com/questions/9629872/how-to-detect-if-a-listview-is-scrolling-up-or-down-in-android


http://stackoverflow.com/questions/12114963/detecting-the-scrolling-direction-in-the-adapter-up-down



.

stackoverflow.comm

[android help] Android: attempting to start OpenGL activity, app crashes


Android: attempting to start OpenGL activity, app crashes



I'm a newbie to Android development. Please bear with me if this question is trivial.


I have a main activity which contains a button:



android:id="@+id/single_player"
style="@style/ButtonTheme"
android:text="Single Player"
android:visibility="visible"
android:onClick="OpenGameActivity" />


and a method inside the main activity for the button to route to:



public void OpenGameActivity()
{
Intent intent = new Intent(MainActivity.this, GameActivity.class);
startActivity(intent);
}


Now, the GameActivity.class is an activity for creating a GLSurfaceView:



import android.app.Activity;
import android.opengl.GLSurfaceView;
import android.os.Build;
import android.os.Bundle;
import android.support.v4.app.NavUtils;
import android.view.MenuItem;

public class GameActivity extends Activity {
private GLSurfaceView GridView;

public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

// Create a GLSurfaceView instance and set it
// as the ContentView for this Activity.
GridView = new GameView(this);
setContentView(GridView);
}


GameView is a simple implementation of GLSurfaceView which creates GameRender, a simple implementation of GLSurfaceView.Renderer. I set up the Activity, SurfaceView, and Renderer all based on the guide at http://developer.android.com/training/graphics/opengl/environment.html The renderer looks like this:



import android.opengl.GLES20;
import android.opengl.GLSurfaceView;
import javax.microedition.khronos.opengles.GL10;

public class GameRender implements GLSurfaceView.Renderer {


@Override
public void onDrawFrame(GL10 unused) {
// Redraw background color
GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT);
}

@Override
public void onSurfaceCreated(GL10 gl10, javax.microedition.khronos.egl.EGLConfig eglConfig) {
GLES20.glClearColor(0.5f, 0.5f, 0.5f, 1.0f);
}

@Override
public void onSurfaceChanged(GL10 gl10, int width, int height) {
GLES20.glViewport(0, 0, width, height);
}
}


the problem is, every time I click the button from my Android phone which should start the new activity, the app crashes. What am I doing wrong?


I did my research before posting this, so for clarification I DID add the new activity to the manifest:



android:name=".MainActivity"
android:label="@string/app_name" >







android:name=".GameActivity"
android:parentActivityName=".MainActivity" >
android:name="android.support.PARENT_ACTIVITY"
android:value=".MainActivity" />



.

stackoverflow.comm

[android help] Image resets to default after scrolling - Android Custom View


Image resets to default after scrolling - Android Custom View



So I've been creating a custom view similar to GridView. It loads and scrolls through images just fine when they are resources inside the app but now that I'm using images coming in through an HTTP request, the images aren't loading correctly.


When the app starts: all images are set to the default (bad)


After scrolling past that cell and immediately scrolling back to it: image loads correctly (good)


After scrolling back to that same cell sometime later: image was set back to the default (bad)


Does anyone have any ideas of what could be causing this error? I assume it's some kind of recycling issue but I haven't been able to fix it.


Here is my xml file:




android:orientation="vertical"
android:paddingBottom="1dip"
android:background="@color/white"
android:id="@+id/highlight_counter_container"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:gravity="center" >

android:id="@+id/catalog_image"
android:layout_width="match_parent"

android:layout_height="match_parent"/>

android:id="@+id/solid"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="@android:color/black" />

android:id="@+id/text_gradient"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@id/solid"
android:background="@drawable/highlight_text_gradient" />

android:id="@+id/title"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:padding="@dimen/highlight_text_padding"
android:ellipsize="end"
android:gravity="bottom"
android:maxLines="2"
android:textColor="@color/white"
android:textSize="@dimen/text_large" />



Here is an excerpt from my adapter (where I think the problem probably lies):



@Override
public View getView(int position, View convertView, ViewGroup parent) {
final LayoutParams lp;
int viewType = getItemViewType(position);
ImageView img;
PulseTextView title;
Resources res = getContext().getResources();
int height = (int) res.getDimension(R.dimen.icon_main_size);
if (convertView == null) {
LayoutInflater inflater = (LayoutInflater) mContext.get().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = inflater.inflate(R.layout.element_item, parent, false)

LayoutParams layp = new LayoutParams(height);
convertView.setLayoutParams(layp);
}
img = ViewHolder.get(convertView,R.id.catalog_image);
title = ViewHolder.get(convertView,R.id.title);


final CatalogItem channel = getCatalogItem(position);

// find the url of the associated image then set image
String url = null;
try {
url = mCatalogHandler.getImageUrl(CatalogHandler.VALUE_ICON, channel.mPrimaryKey, 100, 100);
} catch (CatalogException e) {
e.printStackTrace();
}
if (url == null || TextUtils.isEmpty(url) || url.equals("null")) {
img.setImageBitmap(mDefaultPic);
} else {
// downloads the image to img
mImageDownloader.download(url, img, mDefaultPic, false);
}
title.setText(channel.mDomain);
img.setScaleType(ScaleType.FIT_XY);
img.setTag(RAMImageCache.KEY_URL, url);

// set the gradient behind the text
View grad = convertView.findViewById(R.id.text_gradient);
ViewUtils.setHeight(grad, height * 3 / 5);
grad.getBackground().setDither(true);
View solid = convertView.findViewById(R.id.solid);
ViewUtils.setHeight(solid, height / 5);

// set the padding based on the position on the screen
DisplayMetrics displaymetrics = new DisplayMetrics();
((Activity)getContext()).getWindowManager().getDefaultDisplay().getMetrics(displaymetrics);
int width = displaymetrics.widthPixels;
if (convertView.getRight() == width && convertView.getLeft() == 0) {
convertView.setPadding(0, 0, 0, 1);
} else if (convertView.getRight() == width) {
//convertView.setPadding(1, 0, 0, 1);
convertView.setPadding(0, 0, 1, 1);
} else if (convertView.getLeft() == 0) {
//convertView.setPadding(0, 0, 1, 1);
convertView.setPadding(1, 0, 0, 1);
}

// set the onclicklistener to jump to the next fragment
convertView.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
Bundle bundle = new Bundle();
bundle.putString("channelitem", channel.getMetadata().toString());
ChannelFragment fragment = new ChannelFragment();
fragment.setArguments(bundle);
((PulseFragmentActivity)mContext.get()).openFragment(fragment);
}
});
return convertView;
}

static class ViewHolder {
ImageView img;
TextView title;

public ViewHolder(ImageView i, PulseTextView t) {
img = i;
title = t;
}

public static T get(View view, int id) {
SparseArray viewHolder = (SparseArray) view.getTag();
if (viewHolder == null) {
viewHolder = new SparseArray();
view.setTag(viewHolder);
}
View childView = viewHolder.get(id);
if (childView == null) {
childView = view.findViewById(id);
viewHolder.put(id, childView);
}
return (T) childView;
}
}


Any point in the right direction would help greatly! Let me know if there are any other code snippets you would need to see.



.

stackoverflow.comm

Google Voice on T-Mobile? [General]

Google Voice on T-Mobile? So I recently switched from a GNex on Verizon to a Moto X DE on T-Mobile. I had always used Google Voice for my v...