In an answer to a previous question, a small debate started about correct terminology for certain constructs. As I did not find a question (other than this or that, which is not quite the right thing) to address this clearly, I am making this new one.

The questionable terms and their relationships are: type, type constructor, type parameter, kinds or sorts, and values.

I also checked wikipedia for type theory, but that didn't clarify it much either.

So for the sake of having a good reference answer and to check my own understanding:

  • How are these things defined properly?
  • What is the difference between each of these things?
  • How are they related to each other?

I have a retail solution (an iOS point of sale app) to which I need to integrate "Apple Pay". How do I make it possible to accept payment details via NFC?. i.e. the customer will pay using "Apple Pay" and the cashier who is using my app should be able to process it.

Im trying to show a circular magnifier wherever the user touches the screen that will zoom that portion of the image touched. Then when the users releases the touch it will dissapear. Ive got this so far but nothing of the zoom in. I know it can be done with the OnDraw() function, but I dont understand how it works.

public boolean onTouch (View v, MotionEvent ev) {

    boolean handledHere = false;
    final int action = ev.getAction();
    final int evX = (int) ev.getX();
    final int evY = (int) ev.getY();
    int nextImage = -1;         

    ImageView imageView = (ImageView) v.findViewById (R.id.image);
    if (imageView == null) return false;

    Integer tagNum = (Integer) imageView.getTag ();
    int currentResource = (tagNum == null) ? R.drawable.p2_ship_default : tagNum.intValue ();

    switch (action) {
    case MotionEvent.ACTION_DOWN :
       if (currentResource == R.drawable.p2_ship_default) {
          nextImage = R.drawable.p2_ship_pressed;
          handledHere = true;
       } else handledHere = true;
       break;

    case MotionEvent.ACTION_UP :

       int touchColor = getHotspotColor (R.id.image_areas, evX, evY);

       ColorTool ct = new ColorTool ();
       int tolerance = 25;
       nextImage = R.drawable.p2_ship_default;
       if (ct.closeMatch (Color.RED, touchColor, tolerance)) nextImage = R.drawable.p2_ship_alien;
       else if (ct.closeMatch (Color.BLUE, touchColor, tolerance)) nextImage = R.drawable.p2_ship_powered;
       else if (ct.closeMatch (Color.YELLOW, touchColor, tolerance)) nextImage = R.drawable.p2_ship_no_star;
       else if (ct.closeMatch (Color.WHITE, touchColor, tolerance)) nextImage = R.drawable.p2_ship_default;


       if (currentResource == nextImage) {
          nextImage = R.drawable.p2_ship_default;
       } 
       handledHere = true; 
       break;

    default:
       handledHere = false;
    } 

    if (handledHere) {

       if (nextImage > 0) {
          imageView.setImageResource (nextImage);
          imageView.setTag (nextImage);
       }
    }
    return handledHere;

}

public int getHotspotColor (int hotspotId, int x, int y) {
    ImageView img = (ImageView) findViewById (hotspotId);
    if (img == null) {
        Log.d ("ImageAreasActivity", "Hot spot image not found");
        return 0;
    } else {
        img.setDrawingCacheEnabled(true); 
        Bitmap hotspots = Bitmap.createBitmap(img.getDrawingCache()); 
        if (hotspots == null) {
            Log.d ("ImageAreasActivity", "Hot spot bitmap was not created");
            return 0;
        } else {
            img.setDrawingCacheEnabled(false);
            return hotspots.getPixel(x, y);
        }
    }   
}

I am writing a little xmpp chat client in javascript, with an html front-end. I want to make this work both on mobile device browsers as well as desktop browsers. My application runs fine on my windows desktop, using IE10 and Chrome. However, on my android phone, I can see JavaScript errors in the native android browser (i.e., not Chrome for android).

This is the relevant method, in the javasceript files, that is giving problem:

    displayIncomingText: function (text) {
    console.log("Trying to process incoming message, outer html: " + "\n" + text.outerHTML + "\n\nInner html: \n" + text.innerHTML);
    var msg = text.innerHTML;
    var end = msg.search("</body>");
    if (end == -1)
    {
        return true; //do nothing
    }
    msg = msg.slice(0, end);

    var start = msg.lastIndexOf(">")+1;

    msg = msg.slice(start,end);
    $('#chattext').append("<p>"+ msg + "</p>");

    return true;
}

It parses an incoming xmpp stanza.

Specifically, this code calls msg.search(), which fails.

Here is the output I get on my android JS console:

Trying to process incoming message, outer html:
undefined

Inner html:
undefined

http://myserver.com/live/scripts/strophe.js:1650
Uncaught TypeError: Cannot call method 'search' of undefined

I am guessing that there is something different in string handling in the Android JavaScript Engine compared to Chrome's/IE10's JS engine, and/or that there is some kind of type casting going on here that works in the desktop JS engines, but not on the android JS engine.

Can anyone offer any insight into this?

Thanks,

best regards,

c

I am trying to implement the google play services sign-in to my app.

I added libraries (Google-play-services lib, basegameutils lib).I have added the sign in button. The app is not crashing. Everything that I have done seems to be ok.

I signed the app with the keytool and export it, then install it to my phone. I added the SHA1 code to my test app on developers console. And added My app Id to my app.

But when I tap on the sign in button it say with a pop-up "this app won\'t work unless you update google play services". When tap on the "update" it seems the service is up to date.

Is this a problem with my device? Or else What can I try to solve that ?

My device is Samsung Galaxy S3.

I am working on an android application which can find users nearby. I need help in design that application.

I am thinking: 1. When I start my application, I use API to find my location. 2. I send that location to my server. 3. server returns a list of other users nearby.

My question is how can the server keeps track of a list of users who are nearby?

Do I create a background service on phone who will report users location periodically? And the server maintains a list of all users' location?

Is that approach feasible?

What I want is to show a radar scannar animation in the middle of my application, with methods to start/stop scan and add some detected objects on the radar. I am quite new to android UI, I dont know how to implement this, with html or functions?

I have a Todo class with title, details and date

    public class Todo {
        private String title, details;
        Date dateAdded;

        //getters and setters goes here
    }

My Activity class public class MyActivity extends Activity implements View.OnClickListener{ private List arrayList; private TextView todo_tv; private TextView done_tv; private Button noItem; private Button addItem; ListView listView; String[] data = {}; private static int count = 0;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_my);

    arrayList = new ArrayList<String>();
    listView = (ListView)findViewById(R.id.list);

    todo_tv = (TextView) findViewById(R.id.todo_tv);
    done_tv = (TextView)findViewById(R.id.done_tv);
    noItem = (Button)findViewById(R.id.btn_noItem);
    addItem = (Button)findViewById(R.id.btn_add);
    addItem.setOnClickListener(this);

    noItem.setOnClickListener(this);

    String title = this.title.getText().toString(), details =  this.detail.getText().toString();

    if(arrayList.isEmpty()){
        todo_tv.setText("Todo( " + arrayList.size() + " )");
        done_tv.setText("Done( "+arrayList.size()+")");

        Toast.makeText(this, "Empty fields", Toast.LENGTH_SHORT).show();

    }else {
        listView.setAdapter(this, android.R.layout.simple_list_item_1, arrayList);
        //This only updates one textview
        //i want to update both the titleTextView and the detailsTextView


    }


}

how can i populate the ArrayAdapter in my Activity class with both the title and details, using an ArrayList?

Essentially, my android phone's USB port is broken, so the only way to debug is over WiFi. Unfortunately, I hadn't authorized the device on my computer back when the USB was still working.

I currently have an application that uses location updates when one of the activities is running. However, I want to pause/stop location services when the user minimizes the application, goes to the home, or moves to another activity until I need the location again. I do not want to stop the app, as there can be some continually running data. I just want to stop the location updates while the app is minimized. Then when the app is reopened, I want to begin the services again. Please and Thank You!

I would like to show one image by URL in a ImageView that I've created. But the ImageView appears in blank and no msg of error is displayed.

Here is the code that I'm using:

@Override
public Object instantiateItem(ViewGroup pager, int position) {
    ImageView imagem = new ImageView(context);
    imagem.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
    File file = new File(context.getFilesDir().getAbsolutePath() + "/Sera/hp7.png");
    imagem.setImageDrawable(Drawable.createFromPath(file.toString()));
    ((ViewPager)pager).addView(imagem, 0);
    return imagem;
}

When I load the image directly from the drawable folder it works fine.

What I am doing wrong?

PS.: I've pasted the Image in the folder /Android/data/myapplication/files/Sera/

I have made a timer app where I can tell how much time I spent on something but I need to know how to make the timer run while the phone is hibernating or I am on a different app. I have tried to use a tinyDB but all that does is save the seconds on the stopwatch, it doesn't keep running. Any ideas?

Application works properly with android studio and usb cable but it crashes when I use apt file? can anybody tell me what is the problem that the application crashes and does not show main page when I instal it trough apk?

I try create a widget that dial a USSD code, I follow a tutorial and create a widget, but when I add widget to home screen and click on that application will crash! Here is my code:

    import android.net.Uri;
import android.os.Bundle;
import android.app.Activity;
import android.app.PendingIntent;
import android.appwidget.AppWidgetManager;
import android.appwidget.AppWidgetProvider;
import android.content.Context;
import android.content.Intent;
import android.telephony.TelephonyManager;
import android.view.Menu;
import android.widget.RemoteViews;
import android.widget.Toast;

public class MainActivity extends AppWidgetProvider{
    TelephonyManager tMgr =  (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
    String o = tMgr.getSimOperator();

    String hash=Uri.encode("#");
    Intent intent;
    @Override
    public void onUpdate(Context context, AppWidgetManager appWidgetManager,
            int[] appWidgetIds) {
        // TODO Auto-generated method stub
        super.onUpdate(context, appWidgetManager, appWidgetIds);
        for(int i=0;i<appWidgetIds.length; i++){
            int appWidgetId=appWidgetIds[i];

             if(o.equals("41301"))
                { intent=new Intent("android.intent.action.CALL", Uri.parse("tel:*100"+hash));}
                else if(o.equals("41302"))
                { intent=new Intent("android.intent.action.CALL", Uri.parse("tel:*"+hash+"456"+hash));}
                else if(o.equals("41303"))
                { intent=new Intent("android.intent.action.CALL", Uri.parse("tel:*134"+hash));}
                else if(o.equals("41305"))
                { intent=new Intent("android.intent.action.CALL", Uri.parse("tel:*550"+hash));}
                else if(o.equals("41308"))
                { intent=new Intent("android.intent.action.CALL", Uri.parse("tel:*344"+hash));}


             PendingIntent pending = PendingIntent.getActivity(context, 0, intent, 0);
             RemoteViews views=new RemoteViews(context.getPackageName(),R.layout.activity_main);
             views.setOnClickPendingIntent(R.id.imageButton1, pending);
             appWidgetManager.updateAppWidget(appWidgetId, views);
        }
    }

    private TelephonyManager getSystemService(String telephonyService) {
        // TODO Auto-generated method stub
        return null;
    }

Please help me to resolve this proble...

I want write exposure photography app on Android, but I do not know really can change the shutter speed of the camera or use multiple images to create an exposure image? I have seen apps do this is: Camera FV-5, Long Exposure Camera 2 Expect people to help! Thanks!

Is there any way or any inbuilt function that I can use to pinch to zoom in and out the activity screen? I am trying to zoom in and out the entire activity. I understand that there are codes for it but I have tried and it fails. Which is why I was wondering if there is a inbuilt zoom in and out using pinch action that I can use.

Thank you

I'm trying to submit an iOS app to AppStore and I'm having the following error:

ERROR ITMS-9000: "Missing or invalid signature. The bundle 'com.google.GPPSignIn3PResources' at bundle path 'Payload/My_app_name.app/GooglePlus.bundle' is not signed using an Apple submission certificate."

I've submitted this app before I've never had this problem. Does anybody know if there is any recent change?

I am absolutely baffled as to why setting the lens position in iOS8 only works indoors. I've been testing an application for a while and have had no problems changing the lens position. Today I went outside to do some test shots and low and behold my completion handler is never being called. I can replicate this indoors by pointing the camera directly at a bright light source. Even when I am setting manual exposure and manual white balance this still happens.

Here is the relevant code for changing the lens position on the camera:

- (void) changeLensPosition : (float) lensValue
{
    void (^focusBlock)(CMTime syncTime) = ^void (CMTime syncTime) 
    {
        printf("Finished focusing lens position is %f\n", _device.lensPosition);
    };

    NSError *error = nil;
    if ([_device lockForConfiguration:&error])
    {
        printf("Attempting to change lens position to %f\n", lensValue);
        @try
        {
            [_device setFocusModeLockedWithLensPosition:lensValue completionHandler: focusBlock];
        }
        @catch (NSException *exception)
        { 
            NSLog(@"%@",[NSThread callStackSymbols]);
        }
        @finally
        {

        }
    }
    else
    {
        NSLog(@"%@", [error localizedDescription]);
    }
}

No exception is thrown and no error occurs, the application prints "Attempting to change lens position..." but never prints "Finished focusing..."

Just to recap, the application successfully changes focus indoors 100% of the time, but outdoors it succeeds 0% of the time. I can even start changing the lens position indoors and walk outside where it will immediately stop.

Just hours ago I updated xCode, iOS 8, and Yosemite to the newest versions in hopes that this is something bugged in the API. No success there.

Does anyone know a solution to this problem?

I downloaded XCode 6 GM and submitted two Swift apps to the app store today. Both passed all pre-upload verification and all the other stuff they had to pass and were successfully submitted. But then I got two emails from Apple... one for each program and they both said this:

"Dear developer,

We have discovered one or more issues with your recent delivery for "xxxxxxxx" (my app name removed). Your delivery was successful, but you may wish to correct the following issues in your next delivery:

Too many symbol files - These symbols have no corresponding slice in any binary [1431D977-72BC-308F-AB71-71529F25400B.symbols, 158C72A7-98AC-3F07-B2BE-88427591B413.symbols, 44973EAC-563E-340C-B549-55A5014A68BA.symbols, 678BF06F-0C3D-3A09-BFBF-699C7079FECD.symbols, 90907DDB-0400-38ED-BB5F-0C12333C0624.symbols, 93B79949-5757-374A-97B9-825AE1A61B7D.symbols, ABA05220-4FB0-397F-AFBB-08774A82F4CA.symbols, AD70F02A-4422-32B8-8C40-CF9B45A2CCC6.symbols, B0CC9F7D-C542-3E18-A518-B28B7ECABE80.symbols, BF6A4C3B-6FA5-3C51-8404-19C2F132458D.symbols, C9D6E078-8E2A-39D9-8DEE-476916A69CEE.symbols, CF5320DF-AB31-3845-BAD5-F6E51045D396.symbols, D4967AA3-8FB0-3712-B0DE-7F4144AF8F4B.symbols, D813B314-AD37-31D4-B675-442052994495.symbols, DF42A13F-08D8-3E71-B221-FC357E0B60F5.symbols, F5F636C2-F0E0-3CA7-8F7D-C49A36CD5C65.symbols]

After you’ve corrected the issues, you can use Xcode or Application Loader to upload a new binary to iTunes Connect.

Regards,

The App Store team"

I'm going to guess that really has nothing to do with me or my apps... and it is just a quirk of day one Swift app submissions? Both apps are still sitting in "Waiting for approval" mode. I certainly can't think of anything I could change to make what they said go away! Anyone else submit a Swift app yet and get that response? Think I should just ignore it and wait to see what happens?

Thanks for any insight!

Jim

I built a keyboard for ios 8 using one xib file and multiple subviews. However this keyboard only works in portrait mode and when the device rotates, the keyboard doesn't change its size or length. I figured I need to create another xib file with subviews for landscape and when the device rotates have the xib files switch. My question is how would I go about accomplishing this? How would I make it so that the program knows when to switch xib files. I was thinking I should use something like what is proposed in here: http://stackoverflow.com/a/25222353/2057171 but I do know know how I would implement it. Any help is appreciated.

Apple has just announced Apple Watch and said that SDK for Apple Watch is available for developers. But I don't see it on xCode 6 Golden Master. Where can I find Apple Watch SDK?