Share Coding

Tutorials, Problems, Stuffs …

EditText imeOption not working

When I press “enter” on the text field, it was supposed to do the send action.
But the unexpected “new line” action occur.

Read more of this post

Android DBFlow multiple condition query with ‘LIKE’ operator

In the following case, contain some features:

  1. ConditionGroup to handle multiple condition
  2. LIKE operator with “%”, means the keyword can have words in-front or after it

Read more of this post

GSON with reserved word in the data

When using GSON, a object class should be passed to the Gson parser.
How about if there is a field named ‘default’ or other JAVA reserved word in the data?

public class LockerImageSet {

    private String default;

    private String mapImage, buildingImage, lockerImage, aroundImage;

}

The following code shows how to do that by an annotation.

public class LockerImageSet {

    @SerializedName("default")
    private String defaultImage;

    private String mapImage, buildingImage, lockerImage, aroundImage;

}

Android Pass object between Intent

1. First of all, your Object class must be

implements Serializable

2. Package your parameter into a Bundle

User user1= new User("user1", "M");
Bundle bundle = new Bundle();
bundle.putSerializable("USER", user1);

Read more of this post

SQL Server Linked Servers and Create View

Server Objects > New > Linked Server…

1

Input server name (or IP):

2

Security > Without using security context or input the remote login name and password:

3

If the view is created from “right-click > New Views”, an error received when:

Select * from [10.8.8.212].[DBName].[dbo].[TableName]
Error in FROM clause: near '10.8'. 
Unable to parse query text.

The bracket [] will be auto removed by MS Management studio:

4

You may create the view successfully by using SQL:

CREATE VIEW [dbo].[DB_VIEW]
AS
SELECT *
FROM [10.8.8.212].[DBName].[dbo].[TableName]
GO