Is Google Void Purchases API bug?
When an app user buys the goods for a period of time, the user can initiate a refund, and Google himself will perform a refund without the developer.
At that time the system should be the user's “coins“ to recover. So I read the
[url=https://developers.google.com/android-publisher/voided-purchases]Google void purchase API[/url] and found:
The Google Play Voided Purchases API allows you to revoke access to in-app products that are associated with purchases that a user has voided. The user can void a purchase in the following ways:
The user requests a refund for their order.
The user cancels their order.
An order is charged back.
So I found an order ID by this API's purchaseToken, and I use the order ID in the Google developers console find some of the orders are Refund, but some are Charged, I checked my own mistakes, but did not found.
Is Google Void Purchases Bug ?
Why Charged order is return by Google Void Purchases ?
How do I get all refund orders ?
how to use ContactsContract.Contacts.CONTACT_LAST_UPDATED_TIMESTAMP in android?
I wordering how to use ContactsContract.Contacts.CONTACT_LAST_UPDATED_TIMESTAMP in android ?
Below is my code which shows IllegalStateException.
[code] Cursor allContacts = this.getContentResolver().query(
ContactsContract.RawContacts.CONTENT_URI, null, null, null, null);
StringBuilder sbCurrentVersion = new StringBuilder();
allContacts.moveToFirst();
for (int i = 0; i < allContacts.getCount(); i++) {
String id = allContacts.getString(allContacts.getColumnIndex(ContactsContract.Contacts._ID));
String name = allContacts.getString(allContacts.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME));
String col = allContacts.getString(allContacts.getColumnIndex(ContactsContract.Contacts.CONTACT_LAST_UPDATED_TIMESTAMP));
sbCurrentVersion.append(" "+id+":"+name+" : "+col);
allContacts.moveToNext();
}
It shows following IllegalStateException
java.lang.IllegalStateException: Couldn't read row 0, col -1 from CursorWindow. Make sure the Cursor is initialized correctly before accessing data from it.
at android.database.CursorWindow.nativeGetString(Native Method)
at android.database.CursorWindow.getString(CursorWindow.java:438)
at android.database.AbstractWindowedCursor.getString(AbstractWindowedCursor.java:51)
at android.database.CursorWrapper.getString(CursorWrapper.java:137)
at com.example.dj.contentobserverdemo.ContentObserverService.sGetCurrentContatcsVersions(ContentObserverService.java:111)
at com.example.dj.contentobserverdemo.ContentObserverService.access$000(ContentObserverService.java:23)
at com.example.dj.contentobserverdemo.ContentObserverService$MyContentObserver.onChange(ContentObserverService.java:83)
at android.database.ContentObserver.onChange(ContentObserver.java:130)
at android.database.ContentObserver.onChange(ContentObserver.java:145)
at android.database.ContentObserver$NotificationRunnable.run(ContentObserver.java:216)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.os.HandlerThread.run(HandlerThread.java:61)[/code]
DIsplay User's Information after Logging In Xamarin Android
I have a login system where the user have to register and can login after they register for an account. What I am trying to do is to display user information into a new .axml after successfully logging in. Any help will be appreciated. Code is shown below.
MainActivity.cs
[code]using Android.App;
using Android.Widget;
using Android.OS;
using Android.Gms.Ads;
using SQLite;
using System.IO;
using System;
namespace LogInApplication
{
[Activity(Label = "Log In Application", MainLauncher = true, Icon = "@mipmap/icon")]
public class MainActivity : Activity
{
protected AdView mAdView;
private InterstitialAd interstitialAds = null;
EditText txtusername;
EditText txtPassword;
Button btncreate;
Button btnsign;
Button btnedit;
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
// Set our view from the "main" layout resource
SetContentView(Resource.Layout.Main);
// Get our button from the layout resource,
// and attach an event to it
interstitialAds = new InterstitialAd(this);
mAdView = FindViewById<AdView>(Resource.Id.adView);
var adRequest = new AdRequest.Builder().Build();
mAdView.LoadAd(adRequest);
//setting unit id for interstitial ad
interstitialAds.AdUnitId = "ca - app - pub - 3113453000644941 / 8764416112";
//loading test ad using adrequest
interstitialAds.LoadAd(adRequest);
interstitialAds.AdListener = new AdListener(this);
btnsign = FindViewById<Button>(Resource.Id.btnlogin);
btncreate = FindViewById<Button>(Resource.Id.btnregister);
btnedit = FindViewById<Button>(Resource.Id.btnforgot);
txtusername = FindViewById<EditText>(Resource.Id.txtusername);
txtPassword = FindViewById<EditText>(Resource.Id.txtpwd);
btnsign.Click += Btnsign_Click;
btncreate.Click += Btncreate_Click;
btnedit.Click += Btnedit_Click;
CreateDB();
}
class AdListener : Android.Gms.Ads.AdListener
{
MainActivity main;
public AdListener(MainActivity innerMain)
{
main = innerMain;
}
public override void OnAdLoaded()
{
base.OnAdLoaded();
main.interstitialAds.Show();
}
}
private void Btncreate_Click(object sender, EventArgs e)
{
StartActivity(typeof(RegisterActivity));
}
private void Btnedit_Click(object sender, EventArgs e)
{
StartActivity(typeof(ForgotActivity));
}
private void Btnsign_Click(object sender, EventArgs e)
{
try
{
string dpPath = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "user.db3"); //Call Database
var db = new SQLiteConnection(dpPath);
var data = db.Table<LoginTable>(); //Call Table
var data1 = data.Where(x => x.username == txtusername.Text && x.password == txtPassword.Text).FirstOrDefault(); //Linq Query
if (data1 != null)
{
Toast.MakeText(this, "Login Success", ToastLength.Short).Show();
StartActivity(typeof(WelcomeActivity));
}
else
{
Toast.MakeText(this, "Username or Password invalid", ToastLength.Short).Show();
}
}
catch (Exception ex)
{
Toast.MakeText(this, ex.ToString(), ToastLength.Short).Show();
}
}
public string CreateDB()
{
var output = "";
output += "Creating Database if it doesn't exits";
string dpPath = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "user.db3"); //Create New Database
var db = new SQLiteConnection(dpPath);
output += "\n Database Created.....";
return output;
}
}
}[/code]
Main.axml
[code]<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/darker_gray"
android:weightSum="100"
android:minWidth="25px"
android:minHeight="25px">
<TextView
android:text="LOGIN"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="@android:color/black"
android:textSize="25sp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:id="@+id/textView1" />
<EditText
android:id="@+id/txtusername"
android:layout_width="fill_parent"
android:textColorHint="@android:color/black"
android:hint="Username"
android:layout_height="wrap_content" />
<EditText
android:id="@+id/txtpwd"
android:layout_width="fill_parent"
android:textColorHint="@android:color/black"
android:hint="Password"
android:inputType="textPassword"
android:layout_height="wrap_content" />
<Button
android:id="@+id/btnlogin"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@drawable/ButtonLogInStyle"
android:textSize="20sp"
android:text="Log In"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="20dp" />
<Button
android:id="@+id/btnforgot"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@drawable/ButtonLogInStyle"
android:textSize="15sp"
android:text="Forgot Password?"
android:layout_marginLeft="60dp"
android:layout_marginRight="60dp"
android:layout_marginBottom="20dp" />
<Button
android:id="@+id/btnregister"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@drawable/ButtonSignUpStyle"
android:textSize="20sp"
android:text="Register"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="170dp" />
<com.google.android.gms.ads.AdView
android:id="@+id/adView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
ads:adSize="BANNER"
ads:adUnitId="ca-app-pub-3940256099942544/6300978111" />
</LinearLayout>[/code]
Cannot resolve Symbol LENGTH_LONG
i am beginner i am facing with that problem that cannot resolve symbol length_long ,i used Android studio 2.2.3 and i change my all versions in grid, but still the same problem
[code]private void showLocationSettings() {
Snackbar snackbar = Snackbar.make(mainCoordinatorLayout, "Location Error: GPS Disabled!",
Snackbar.LENGTH_LONG)
.setAction("Enable", new View.OnClickListener() {
@Override public void onClick(View v) {
startActivity(new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS));
}
});
snackbar.setActionTextColor(Color.RED);
snackbar.setDuration(Snackbar.LENGTH_INDEFINITE);[/code]
WebView vs Chrome Custom Tab
I am building an app where in a Detail Activity I have to show a web page. I was going to use WebView, but then I saw Chrome Custom Tab.
What do you guys think it's better to implement and why?
How to verify if target=_blank worked in Android webview
There is an Android app which uses HTML content within a WebView. Now, this HTML content contains a target=_blank link. Sometimes it works, but sometimes it gets blocked (i.e. link opens in same window), for unknown reasons.
[code]<!-- Does not always work in WebView -->
<a id="link" href="http://example.com" target="_blank">link</a>
$('#link').click(function() {
// if (linkOpenedInNewBrowserWindow.wasSuccessful)
// Do something
});[/code]
How is it possible to check whether a click on this link actually opens the link in a new browser window or not?
How to handle ImageView click inside a row in RecyclerView?
When I click ImageView, it go to GridView activity with position. When I click others area inside a cardview, it go to ItemDetailActivtiy with position. How to do one line or less than coding when click.
[code]public class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
TextView tv_restaurant_name, tv_restaurant_address, tv_restaurant_phone;
ImageView imgview;
public ViewHolder(View itemView) {
super(itemView);
tv_restaurant_name = (TextView) itemView.findViewById(R.id.tv_restaurant_name);
tv_restaurant_address = (TextView) itemView.findViewById(R.id.tv_restaurant_address);
tv_restaurant_phone = (TextView) itemView.findViewById(R.id.tv_restaurant_phone);
imgview = (ImageView) itemView.findViewById(R.id.imgview);
tv_restaurant_name.setOnClickListener(this);
tv_restaurant_address.setOnClickListener(this);
tv_restaurant_phone.setOnClickListener(this);
imgview.setOnClickListener(this);
}
@Override
public void onClick(View v) {
int position = getAdapterPosition();
if (v.getId() == imgview.getId()) {
Intent intent = new Intent(context, GridView.class);
Bundle bundle = new Bundle();
bundle.putInt("ID", Integer.valueOf(mRestaurantList.get(position).getRestaurantId()));
intent.putExtras(bundle);
context.startActivity(intent);
} else {
context.startActivity(new Intent(context, ItemDetailActivtiy.class));
}
}
}[/code]
SQLite Database Android - Joining Tables
Hi guys, i am new on working for joining tables on my android application. I have my 3 tables named EMPLOYEES, PASSWALL and NOTEPAD. I want to access the other tables using a foreign key on my EMPLOYEES table. Do you get my point?
I need a QUERY for that and how to SELECT it and how to access data on other tables.
So how is the approach for that? thanks appreciate your suggestions.