Android Studio Plugin

 Hi All, 

I am a beginner in development of plugin and using IntelliJ. my question is that, if I want to inject a code inside an android application activity in a specific place for example inside Oncreat() method after variable initialization. Is there any reference or code samples that I can take a look at in order to get some Idea? 

Thank you in advance

 

0

What do you mean by "injecting code"? Could you give a sample?

0
Avatar
Permanently deleted user

yes, of course. For example, I have this activity that is called login activity

public final class LoginActivity extends AppCompatActivity {
private AuthorizationService mAuthService;
private AuthStateManager mAuthStateManager;
private Configuration mConfiguration;

and it has the onCreate() method.

the work that I want to do is that:
- find the onCreate() method inside login activity
- Insert some code inside the activity from a txt file or template file that stored inside the plugin (I make the code that should be inserted within the method bold)
protected void onCreate(Bundle savedInstanceState) {

if (mAuthStateManager.getCurrent().isAuthorized()
&& !mConfiguration.hasConfigurationChanged()) {
Log.i(TAG, "User is already authenticated, proceeding to token activity");
startActivity(new Intent(this, TokenActivity.class));
finish();
return;
}
}

thank you in advance

0
Avatar
Permanently deleted user

Okay. Thank you for your help. one more question, Template files are not supported in community edition?

 

0

Template files are supported in Community as well.

0

请先登录再写评论。