小编A. *_* K.的帖子

未找到超级用户活动

超级用户应用程序已安装在我的手机上,但在尝试发出超级用户请求时,我的应用程序出现了以下错误:

18820-18820/com.anth.res E/AndroidRuntime: FATAL EXCEPTION: main
    android.content.ActivityNotFoundException: No Activity found to handle Intent { act=act=android.intent.action.superuser (has extras) }
    at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1512)
    ...
Run Code Online (Sandbox Code Playgroud)

这是我的活动的要求:

command = "su -c \""+command+"\"";
Intent intent = new Intent("android.intent.action.superuser"); // superuser request
intent.putExtra("name", getResources().getString(R.string.app_name)); // tell Superuser the name of the requesting app
intent.putExtra("packagename", "com.anth.res"); // tel Superuser the name of the requesting package
startActivityForResult(intent, SU_REQUEST); // make the request!
Run Code Online (Sandbox Code Playgroud)

android root android-intent

5
推荐指数
1
解决办法
523
查看次数

带有集合的JPA实体对分离成员上的contains方法返回false

我有两个JPA实体类,Group和User

Group.java:

@Entity
@Table(name = "groups")
public class Group {

    @Id
    @GeneratedValue
    private int id;


    @ManyToMany
    @JoinTable(name = "groups_members", joinColumns = {
            @JoinColumn(name = "group_id", referencedColumnName = "id")
    }, inverseJoinColumns = {
            @JoinColumn(name = "user_id", referencedColumnName = "id")
    })
    private Collection<User> members;


    //getters/setters here

}
Run Code Online (Sandbox Code Playgroud)

User.java:

@Entity
@Table(name = "users")
public class User {

    private int id;
    private String email;

    private Collection<Group> groups;

    public User() {}

    @Id
    @GeneratedValue
    public int getId() {
        return id;
    }

    public void setId(int id) { …
Run Code Online (Sandbox Code Playgroud)

java collections hibernate jpa contains

3
推荐指数
1
解决办法
835
查看次数

返回后ListFragment为空

我有一个使用HoloEverywhere构建的简单活动,其中包含一个片段容器.ListFragment在启动时出现在那里,并且正常显示.然后,单击列表项将ListFragment替换为另一个片段并将其添加到backstack.但是当我按下后退按钮时,列表是空的,尽管它正常恢复.有一些代码:

活动

public class MainActivity extends Activity implements SongsFragment.IActivityCallback {

public final static String TAG = "Lyrics";

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Log.i(TAG, "STarted.");
    setContentView(R.layout.frags);

}

@Override
public void itemSelected(int id) {
    Log.d(TAG, "itemSelected");
    LyricsFragment lyrics = new LyricsFragment();
    if(findViewById(R.id.frag_frame) != null) {
        Bundle args = new Bundle();
        args.putInt("id", id);

        lyrics.setArguments(args);

        FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
        transaction.replace(R.id.frag_frame, lyrics);
        transaction.addToBackStack(null);
        transaction.commit();
    }

}

}
Run Code Online (Sandbox Code Playgroud)

frags布局:

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/frag_frame"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" >

<fragment
    android:id="@+id/fragment1"
    android:name="android.app.ListFragment"
    android:layout_width="match_parent" …
Run Code Online (Sandbox Code Playgroud)

android android-fragments android-listfragment android-holo-everywhere

0
推荐指数
1
解决办法
4669
查看次数