Wednesday, April 23, 2014

Will the internal method inside the class how to access external OnclickListener


posts by billcools edited 2014-04-21 19:46:40
 public class MainActivity extends ActionBarActivity 
{

@ Override
protected void onCreate (Bundle savedInstanceState)
{
super.onCreate (savedInstanceState);
setContentView (R.layout.activity_main);
if (savedInstanceState == null)
{
.. getSupportFragmentManager () beginTransaction () add (R.id.container, new PlaceholderFragment ()) commit ();.
}
}

public native String fun1 (); method / / need to call

public static class PlaceholderFragment extends Fragment
{
public PlaceholderFragment ()
{
}

@ Override
public View onCreateView (LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState)
{
View rootView = inflater.inflate (R.layout.fragment_main, container, false);
final Button btn1 = (Button) findViewById (R.id.btn1);
btn1.setOnClickListener (new Button.OnClickListener (
{
/ / Here calling external fun1 () how to do it?
});
}
}
}
<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
public static native String fun1 (); method need to call / /
Reply:
Thank you! Really the case, why must the static methods? . . . .
In addition, ask the jni package to a separate one class better, or is placed in MainActivity good inside?

No comments:

Post a Comment